diff --git a/Tasklight.Controller.sln b/Tasklight.Controller.sln new file mode 100644 index 0000000..902f93c --- /dev/null +++ b/Tasklight.Controller.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.36227.8 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tasklight.Controller", "Tasklight.Controller\Tasklight.Controller.csproj", "{640D033A-8F90-40FB-861E-13BE4D029C9E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {640D033A-8F90-40FB-861E-13BE4D029C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {640D033A-8F90-40FB-861E-13BE4D029C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {640D033A-8F90-40FB-861E-13BE4D029C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {640D033A-8F90-40FB-861E-13BE4D029C9E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BA316B18-8572-4E56-9E31-95465EC2066B} + EndGlobalSection +EndGlobal diff --git a/Tasklight.Controller/App.xaml b/Tasklight.Controller/App.xaml new file mode 100644 index 0000000..dbf123d --- /dev/null +++ b/Tasklight.Controller/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/Tasklight.Controller/App.xaml.cs b/Tasklight.Controller/App.xaml.cs new file mode 100644 index 0000000..f22623d --- /dev/null +++ b/Tasklight.Controller/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace Tasklight.Controller +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/Tasklight.Controller/AssemblyInfo.cs b/Tasklight.Controller/AssemblyInfo.cs new file mode 100644 index 0000000..b0ec827 --- /dev/null +++ b/Tasklight.Controller/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Tasklight.Controller/MVVM.cs b/Tasklight.Controller/MVVM.cs new file mode 100644 index 0000000..94f748d --- /dev/null +++ b/Tasklight.Controller/MVVM.cs @@ -0,0 +1,56 @@ +using System; +using System.ComponentModel; +using System.Windows.Input; + +namespace Tasklight.Controller +{ + public abstract class ModelBase : PropertyChangedBase + { + public void SetProperty(ref T storage, T value, string name) + { + //if (storage == null) + //throw new InvalidCastException("osrs_toolbox.ModelBase.UpdateProperty\nStorage cannot be null."); + if (value == null) + throw new InvalidCastException("ModelBase.UpdateProperty\nValue cannot be null."); + //if (storage.GetType() != value.GetType()) + //throw new InvalidCastException("osrs_toolbox.ModelBase.UpdateProperty\nVariable type mismatch between storage and value."); + storage = value; + OnPropertyChanged(name); + } + } + + public abstract class PropertyChangedBase : INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; + public void OnPropertyChanged(string name) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); + } + + public class RelayCommand : ICommand + { + private Action execute; + private Func? canExecute; + + + public event EventHandler? CanExecuteChanged + { + add { CommandManager.RequerySuggested += value; } + remove { CommandManager.RequerySuggested -= value; } + } + + public RelayCommand(Action execute, Func? canExecute = null) + { + this.execute = execute; + this.canExecute = canExecute; + } + + public bool CanExecute(object? parameter) + { + return this.canExecute == null || this.canExecute(parameter); + } + + public void Execute(object? parameter) + { + this.execute(parameter); + } + } +} diff --git a/Tasklight.Controller/MainWindow.xaml b/Tasklight.Controller/MainWindow.xaml new file mode 100644 index 0000000..9343a1c --- /dev/null +++ b/Tasklight.Controller/MainWindow.xaml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + +