diff --git a/Corathing.sln b/Corathing.sln
index d6733d1..301083d 100644
--- a/Corathing.sln
+++ b/Corathing.sln
@@ -37,6 +37,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Corathing.Widgets.Basics",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "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.Widget.Templates", "src\Widgets\Corathing.Widget.Templates\Corathing.Widget.Templates.csproj", "{3CED3EA9-D293-44BD-9838-FC1AF1FFC626}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -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
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Debug|ARM.Build.0 = Debug|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Debug|x64.Build.0 = Debug|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Debug|x86.Build.0 = Debug|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Release|ARM.ActiveCfg = Release|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Release|ARM.Build.0 = Release|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Release|ARM64.Build.0 = Release|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Release|x64.ActiveCfg = Release|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Release|x64.Build.0 = Release|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.Release|x86.ActiveCfg = Release|Any CPU
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626}.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}
+ {3CED3EA9-D293-44BD-9838-FC1AF1FFC626} = {B32F5E62-3357-4FE1-BEB3-7CDED236BA66}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FC027A8C-0C58-494B-BE76-F403F0336A74}
diff --git a/src/Apps/Corathing.Organizer/App.xaml b/src/Apps/Corathing.Organizer/App.xaml
index 477944a..4c31e18 100644
--- a/src/Apps/Corathing.Organizer/App.xaml
+++ b/src/Apps/Corathing.Organizer/App.xaml
@@ -15,8 +15,6 @@
-
-
diff --git a/src/Apps/Corathing.Organizer/App.xaml.cs b/src/Apps/Corathing.Organizer/App.xaml.cs
index 6591e37..9aa5866 100644
--- a/src/Apps/Corathing.Organizer/App.xaml.cs
+++ b/src/Apps/Corathing.Organizer/App.xaml.cs
@@ -6,7 +6,6 @@
using System.Windows;
using Corathing.Contracts.Services;
-using Corathing.Dashboards.Services;
using Corathing.Dashboards.WPF.Services;
using Corathing.Organizer.Resources;
using Corathing.Organizer.Services;
@@ -109,7 +108,6 @@ protected override void OnStartup(StartupEventArgs e)
// Available Widgets
// --------------------------------------------------------------------------
IPackageService widgetService = Services.GetService();
- widgetService.LoadWidgetsFromDLL("Corathing.Dashboards.WPF.dll");
widgetService.LoadWidgetsFromDLL("Corathing.Widgets.Basics.dll");
//widgetService.LoadWidgetsFromDLL("DDT.Core.WidgetSystems.DefaultWidgets.dll");
//widgetService.RegisterWidgets(new List { new WidgetGenerator() });
diff --git a/src/Apps/Corathing.Organizer/MainWindow.xaml.cs b/src/Apps/Corathing.Organizer/MainWindow.xaml.cs
index 980a14c..0b32927 100644
--- a/src/Apps/Corathing.Organizer/MainWindow.xaml.cs
+++ b/src/Apps/Corathing.Organizer/MainWindow.xaml.cs
@@ -9,20 +9,51 @@
using System.Windows.Navigation;
using System.Windows.Shapes;
+using Corathing.Organizer.ViewModels;
+
using MahApps.Metro.Controls;
using Wpf.Ui.Controls;
-namespace Corathing.Organizer
+namespace Corathing.Organizer;
+
+///
+/// Interaction logic for MainWindow.xaml
+///
+public partial class MainWindow : MetroWindow
{
- ///
- /// Interaction logic for MainWindow.xaml
- ///
- public partial class MainWindow : MetroWindow
+ public MainViewModel ViewModel;
+
+ public MainWindow()
{
- public MainWindow()
+ InitializeComponent();
+
+ DataContext = ViewModel = new MainViewModel();
+
+ MouseDown += Window_MouseDown;
+ MouseDoubleClick += Window_MouseDoubleClick;
+ }
+
+ private void Window_MouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ if (e.GetPosition(this).Y >= 64)
+ return;
+
+ if (e.ChangedButton == MouseButton.Left)
{
- InitializeComponent();
+ if (WindowState == WindowState.Normal)
+ WindowState = WindowState.Maximized;
+ else
+ WindowState = WindowState.Normal;
}
}
+
+ private void Window_MouseDown(object sender, MouseButtonEventArgs e)
+ {
+ if (e.GetPosition(this).Y >= 64)
+ return;
+
+ if (e.ChangedButton == MouseButton.Left)
+ this.DragMove();
+ }
}
diff --git a/src/Shared/Corathing.Dashboards/Services/PackageService.cs b/src/Apps/Corathing.Organizer/Services/PackageService.cs
similarity index 63%
rename from src/Shared/Corathing.Dashboards/Services/PackageService.cs
rename to src/Apps/Corathing.Organizer/Services/PackageService.cs
index f618dfc..61dd509 100644
--- a/src/Shared/Corathing.Dashboards/Services/PackageService.cs
+++ b/src/Apps/Corathing.Organizer/Services/PackageService.cs
@@ -4,12 +4,15 @@
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
+using System.Windows;
-using Corathing.Contracts.Attributes;
using Corathing.Contracts.Bases;
+using Corathing.Contracts.Entries;
+
using Corathing.Contracts.Services;
-namespace Corathing.Dashboards.Services;
+namespace Corathing.Organizer.Services;
+
public class ProxyDomain : MarshalByRefObject
{
@@ -31,7 +34,7 @@ public class PackageService : IPackageService
/// Gets or sets the available widgets.
///
/// The available widgets.
- private readonly List _availableWidgets = new List();
+ private readonly List _availableWidgets = new List();
private readonly IServiceProvider _services;
public PackageService(IServiceProvider services)
@@ -40,11 +43,11 @@ public PackageService(IServiceProvider services)
}
- public void RegisterWidgets(List widgets)
+ public void RegisterWidgets(List widgets)
{
_availableWidgets.AddRange(widgets);
}
- public List GetAvailableWidgets()
+ public List GetAvailableWidgets()
{
return _availableWidgets;
}
@@ -53,7 +56,6 @@ public void LoadWidgetsFromDLL(string pathDLL)
{
Assembly a = Assembly.LoadFrom(pathDLL);
var types = a.GetTypes().Where(t => typeof(WidgetContext).IsAssignableFrom(t));
- List widgets = new List();
// TODO:
// 도메인 프록시 문제 해결 필요
//var setup = new AppDomainSetup
@@ -61,6 +63,7 @@ public void LoadWidgetsFromDLL(string pathDLL)
// ApplicationBase = AppDomain.CurrentDomain.BaseDirectory,
// PrivateBinPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
//};
+
foreach (var type in types)
{
System.Reflection.MemberInfo info = type;
@@ -68,15 +71,20 @@ public void LoadWidgetsFromDLL(string pathDLL)
for (int i = 0; i < attributes.Length; i++)
{
- if (attributes[i] is WidgetContextEntryAttribute)
+ if (attributes[i] is EntryCoraWidgetAttribute)
{
- var attribute = ((WidgetContextEntryAttribute)attributes[i]);
- attribute.RegisterServices(_services);
- widgets.Add(attribute.WidgetGenerator);
+ var attribute = ((EntryCoraWidgetAttribute)attributes[i]);
+ attribute.Configure(_services);
+ _availableWidgets.Add(attribute.Generator);
+
+ App.Current.Resources.MergedDictionaries.Add(
+ new ResourceDictionary()
+ {
+ Source = new Uri($"pack://application:,,,/{attribute.Generator.ViewType.Assembly.GetName().Name};component/{attribute.Generator.DataTemplateSource}", UriKind.Absolute)
+ }
+ );
}
}
}
-
- RegisterWidgets(widgets);
}
}
diff --git a/src/Apps/Corathing.Organizer/ViewModels/DashboardViewModel.cs b/src/Apps/Corathing.Organizer/ViewModels/DashboardViewModel.cs
index dc75125..3264074 100644
--- a/src/Apps/Corathing.Organizer/ViewModels/DashboardViewModel.cs
+++ b/src/Apps/Corathing.Organizer/ViewModels/DashboardViewModel.cs
@@ -13,7 +13,9 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
+
using Corathing.Contracts.Bases;
+using Corathing.Contracts.Entries;
using Corathing.Contracts.Services;
using Corathing.Dashboards.WPF.Controls;
@@ -21,6 +23,7 @@
using Corathing.Organizer.Extensions;
using Corathing.Organizer.Models;
using Corathing.Organizer.Views;
+
using Microsoft.Extensions.DependencyInjection;
using Wpf.Ui;
@@ -81,7 +84,7 @@ protected override void OnPropertyChanged(PropertyChangedEventArgs e)
}
[RelayCommand]
- public void AddWidget(WidgetGenerator generator)
+ public void AddWidget(CoraWidgetGenerator generator)
{
if (SelectedProject == null)
return;
@@ -290,7 +293,7 @@ public Task Start(IServiceProvider services)
IPackageService packageService = services.GetService();
foreach (var widget in packageService.GetAvailableWidgets())
{
- var fullMenuHeader = widget.MenuPath;
+ var fullMenuHeader = widget.MenuInfo.MenuPath;
if (string.IsNullOrEmpty(fullMenuHeader))
continue;
diff --git a/src/Apps/Corathing.Organizer/ViewModels/MainViewModel.cs b/src/Apps/Corathing.Organizer/ViewModels/MainViewModel.cs
new file mode 100644
index 0000000..713cfdf
--- /dev/null
+++ b/src/Apps/Corathing.Organizer/ViewModels/MainViewModel.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+using CommunityToolkit.Mvvm.ComponentModel;
+
+using Wpf.Ui.Controls;
+
+namespace Corathing.Organizer.ViewModels;
+
+///
+/// Extended with properties.
+///
+public class MenuItem : System.Windows.Controls.MenuItem
+{
+ static MenuItem()
+ {
+ IconProperty.OverrideMetadata(typeof(MenuItem), new FrameworkPropertyMetadata(null));
+ }
+
+ ///
+ /// Gets or sets displayed .
+ ///
+ [System.Diagnostics.CodeAnalysis.SuppressMessage(
+ "WpfAnalyzers.DependencyProperty",
+ "WPF0012:CLR property type should match registered type",
+ Justification = "seems harmless"
+ )]
+ public new IconElement Icon
+ {
+ get => (IconElement)GetValue(IconProperty);
+ set => SetValue(IconProperty, value);
+ }
+}
+
+public partial class MainViewModel : ObservableObject
+{
+
+ [ObservableProperty]
+ private ObservableCollection