diff --git a/Corathing.sln b/Corathing.sln index d6733d1..1dcda14 100644 --- a/Corathing.sln +++ b/Corathing.sln @@ -35,7 +35,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Corathing.Dashboards", "src EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Corathing.Widgets.Basics", "src\Widgets\Corathing.Widgets.Basics\Corathing.Widgets.Basics.csproj", "{8BB7B29E-4684-4F2F-9932-698FDAD2FCDA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Corathing.UI.WPF", "src\Shared\Corathing.UI.WPF\Corathing.UI.WPF.csproj", "{F0AF90D5-5E28-4FC1-8DBD-8B3F68A285DB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Corathing.UI.WPF", "src\Shared\Corathing.UI.WPF\Corathing.UI.WPF.csproj", "{F0AF90D5-5E28-4FC1-8DBD-8B3F68A285DB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Corathing.Dashboards.Sample", "src\Apps\Corathing.Dashboards.Sample\Corathing.Dashboards.Sample.csproj", "{D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -221,6 +223,26 @@ Global {F0AF90D5-5E28-4FC1-8DBD-8B3F68A285DB}.Release|x64.Build.0 = Release|Any CPU {F0AF90D5-5E28-4FC1-8DBD-8B3F68A285DB}.Release|x86.ActiveCfg = Release|Any CPU {F0AF90D5-5E28-4FC1-8DBD-8B3F68A285DB}.Release|x86.Build.0 = Release|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Debug|ARM.ActiveCfg = Debug|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Debug|ARM.Build.0 = Debug|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Debug|ARM64.Build.0 = Debug|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Debug|x64.ActiveCfg = Debug|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Debug|x64.Build.0 = Debug|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Debug|x86.ActiveCfg = Debug|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Debug|x86.Build.0 = Debug|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Release|Any CPU.Build.0 = Release|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Release|ARM.ActiveCfg = Release|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Release|ARM.Build.0 = Release|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Release|ARM64.ActiveCfg = Release|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Release|ARM64.Build.0 = Release|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Release|x64.ActiveCfg = Release|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Release|x64.Build.0 = Release|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Release|x86.ActiveCfg = Release|Any CPU + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -234,6 +256,7 @@ Global {B07D1162-D70E-4CCB-8F13-2E21611B9214} = {89CC8AAB-466A-47B6-98B9-93EB379F55A7} {8BB7B29E-4684-4F2F-9932-698FDAD2FCDA} = {B32F5E62-3357-4FE1-BEB3-7CDED236BA66} {F0AF90D5-5E28-4FC1-8DBD-8B3F68A285DB} = {89CC8AAB-466A-47B6-98B9-93EB379F55A7} + {D56E1CDF-FCC6-476C-BEC3-C13239A3BEFD} = {5BF1289A-1427-4306-B2E1-51E0770B6B75} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {FC027A8C-0C58-494B-BE76-F403F0336A74} diff --git a/src/Apps/Corathing.Dashboards.Sample/App.xaml b/src/Apps/Corathing.Dashboards.Sample/App.xaml new file mode 100644 index 0000000..2d6dc3c --- /dev/null +++ b/src/Apps/Corathing.Dashboards.Sample/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/src/Apps/Corathing.Dashboards.Sample/App.xaml.cs b/src/Apps/Corathing.Dashboards.Sample/App.xaml.cs new file mode 100644 index 0000000..c1a2e5e --- /dev/null +++ b/src/Apps/Corathing.Dashboards.Sample/App.xaml.cs @@ -0,0 +1,14 @@ +using System.Configuration; +using System.Data; +using System.Windows; + +namespace Corathing.Dashboards.Sample +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } + +} diff --git a/src/Apps/Corathing.Dashboards.Sample/AssemblyInfo.cs b/src/Apps/Corathing.Dashboards.Sample/AssemblyInfo.cs new file mode 100644 index 0000000..b0ec827 --- /dev/null +++ b/src/Apps/Corathing.Dashboards.Sample/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/src/Apps/Corathing.Dashboards.Sample/Corathing.Dashboards.Sample.csproj b/src/Apps/Corathing.Dashboards.Sample/Corathing.Dashboards.Sample.csproj new file mode 100644 index 0000000..ce62306 --- /dev/null +++ b/src/Apps/Corathing.Dashboards.Sample/Corathing.Dashboards.Sample.csproj @@ -0,0 +1,17 @@ + + + + WinExe + net8.0-windows + enable + enable + true + + + + + + + + + diff --git a/src/Apps/Corathing.Dashboards.Sample/MainWindow.xaml b/src/Apps/Corathing.Dashboards.Sample/MainWindow.xaml new file mode 100644 index 0000000..af90f0b --- /dev/null +++ b/src/Apps/Corathing.Dashboards.Sample/MainWindow.xaml @@ -0,0 +1,11 @@ + + + diff --git a/src/Apps/Corathing.Dashboards.Sample/MainWindow.xaml.cs b/src/Apps/Corathing.Dashboards.Sample/MainWindow.xaml.cs new file mode 100644 index 0000000..37b59ae --- /dev/null +++ b/src/Apps/Corathing.Dashboards.Sample/MainWindow.xaml.cs @@ -0,0 +1,24 @@ +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Corathing.Dashboards.Sample +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/src/Apps/Corathing.Dashboards.Sample/ViewModels/DashboardViewModel.cs b/src/Apps/Corathing.Dashboards.Sample/ViewModels/DashboardViewModel.cs new file mode 100644 index 0000000..6c181ee --- /dev/null +++ b/src/Apps/Corathing.Dashboards.Sample/ViewModels/DashboardViewModel.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; + +using Corathing.Contracts.Bases; +using Corathing.Dashboards.Sample.Widgets; +using Corathing.Dashboards.WPF.Controls; + +namespace Corathing.Dashboards.Sample.ViewModels; + +public partial class DashboardViewModel : ObservableObject +{ + [ObservableProperty] + private ObservableCollection _widgets; + [ObservableProperty] + private bool? _editMode; + + [RelayCommand] + public void ToggleEditMode() + { + EditMode = !EditMode; + } + + [RelayCommand] + public void AddWidget() + { + Widgets.Add(new EmptyWidgetContext()); + } + + [RelayCommand] + public void RemoveWidget(WidgetHost host) + { + var context = host.DataContext as WidgetContext; + Widgets.Remove(context); + } + + [RelayCommand] + public void ConfigureWidget(WidgetHost host) + { + var context = host.DataContext as WidgetContext; + // Do Something + } + + public DashboardViewModel() + { + Widgets = new ObservableCollection(); + EditMode = false; + } + + protected override void OnPropertyChanged(PropertyChangedEventArgs e) + { + base.OnPropertyChanged(e); + + foreach (var widget in Widgets) + { + widget.EditMode = EditMode; + } + } +} diff --git a/src/Apps/Corathing.Dashboards.Sample/Views/DashboardView.xaml b/src/Apps/Corathing.Dashboards.Sample/Views/DashboardView.xaml new file mode 100644 index 0000000..9dff272 --- /dev/null +++ b/src/Apps/Corathing.Dashboards.Sample/Views/DashboardView.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + - - - - + + + + + + + + + + - + - -