From 3ec90766aa5e529063a06f8e466f97d4bd41c3c3 Mon Sep 17 00:00:00 2001 From: SpoinkyNL Date: Sun, 23 Feb 2020 12:37:30 +0100 Subject: [PATCH] UI - Implemented tray icon UI - Moved dialog service to the shared UI project UI - Implemented autorun --- src/Artemis.Core/Artemis.Core.csproj | 2 + src/Artemis.Core/Constants.cs | 2 +- src/Artemis.Core/Ninject/CoreModule.cs | 11 +++ .../Artemis.UI.Shared.csproj | 3 + .../Screens/Dialogs/ConfirmDialogView.xaml | 4 +- .../Screens/Dialogs/ConfirmDialogViewModel.cs | 4 +- .../Screens/Dialogs/ExceptionDialogView.xaml | 34 ++++++++++ .../Dialogs/ExceptionDialogViewModel.cs | 27 ++++++++ .../Services/Dialog/DialogService.cs | 17 +++-- .../Services/Dialog/DialogViewModelBase.cs | 5 +- .../Services/Dialog/DialogViewModelHost.cs | 5 +- .../Interfaces/IArtemisSharedUIService.cs | 7 ++ .../Services/Interfaces/IDialogService.cs | 17 +++-- src/Artemis.UI/App.xaml | 3 +- src/Artemis.UI/Artemis.UI.csproj | 6 ++ src/Artemis.UI/Bootstrapper.cs | 16 ++--- src/Artemis.UI/Ninject/UiModule.cs | 2 +- src/Artemis.UI/Properties/launchSettings.json | 8 +++ .../Dialogs/ProfileCreateViewModel.cs | 2 +- .../Dialogs/ProfileElementRenameViewModel.cs | 2 +- .../ProfileEditor/ProfileEditorViewModel.cs | 1 + .../ProfileTree/TreeItem/FolderViewModel.cs | 1 + .../ProfileTree/TreeItem/LayerViewModel.cs | 1 + .../ProfileTree/TreeItem/TreeItemViewModel.cs | 1 + src/Artemis.UI/Screens/RootView.xaml | 26 ++++--- src/Artemis.UI/Screens/RootViewModel.cs | 1 + .../Screens/Settings/SettingsView.xaml | 4 +- .../Screens/Settings/SettingsViewModel.cs | 62 ++++++++++++++++- .../Screens/Splash/SplashViewModel.cs | 18 +++-- .../Dialogs/SurfaceCreateViewModel.cs | 2 +- .../Dialogs/SurfaceDeviceConfigViewModel.cs | 2 +- .../SurfaceEditor/SurfaceEditorViewModel.cs | 2 +- src/Artemis.UI/Screens/TrayView.xaml | 36 ++++++++++ src/Artemis.UI/Screens/TrayViewModel.cs | 67 +++++++++++++++++++ 34 files changed, 344 insertions(+), 57 deletions(-) rename src/{Artemis.UI => Artemis.UI.Shared}/Screens/Dialogs/ConfirmDialogView.xaml (90%) rename src/{Artemis.UI => Artemis.UI.Shared}/Screens/Dialogs/ConfirmDialogViewModel.cs (88%) create mode 100644 src/Artemis.UI.Shared/Screens/Dialogs/ExceptionDialogView.xaml create mode 100644 src/Artemis.UI.Shared/Screens/Dialogs/ExceptionDialogViewModel.cs rename src/{Artemis.UI => Artemis.UI.Shared}/Services/Dialog/DialogService.cs (88%) rename src/{Artemis.UI => Artemis.UI.Shared}/Services/Dialog/DialogViewModelBase.cs (84%) rename src/{Artemis.UI => Artemis.UI.Shared}/Services/Dialog/DialogViewModelHost.cs (86%) create mode 100644 src/Artemis.UI.Shared/Services/Interfaces/IArtemisSharedUIService.cs rename src/{Artemis.UI => Artemis.UI.Shared}/Services/Interfaces/IDialogService.cs (88%) create mode 100644 src/Artemis.UI/Properties/launchSettings.json create mode 100644 src/Artemis.UI/Screens/TrayView.xaml create mode 100644 src/Artemis.UI/Screens/TrayViewModel.cs diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj index 90e552ee4..eebae52f5 100644 --- a/src/Artemis.Core/Artemis.Core.csproj +++ b/src/Artemis.Core/Artemis.Core.csproj @@ -36,6 +36,7 @@ true + @@ -43,6 +44,7 @@ + diff --git a/src/Artemis.Core/Constants.cs b/src/Artemis.Core/Constants.cs index 6429f74ed..96f6f0653 100644 --- a/src/Artemis.Core/Constants.cs +++ b/src/Artemis.Core/Constants.cs @@ -6,7 +6,7 @@ namespace Artemis.Core public static class Constants { public static readonly string DataFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Artemis\\"; - public static readonly string ConnectionString = $"FileName={DataFolder}\\database.db;Mode=Exclusive"; + public static readonly string ConnectionString = $"FileName={DataFolder}\\database.db"; public static readonly PluginInfo CorePluginInfo = new PluginInfo {Guid = Guid.Parse("ffffffff-ffff-ffff-ffff-ffffffffffff"), Name = "Artemis Core"}; } } \ No newline at end of file diff --git a/src/Artemis.Core/Ninject/CoreModule.cs b/src/Artemis.Core/Ninject/CoreModule.cs index 66ea2d9d0..4743e0c98 100644 --- a/src/Artemis.Core/Ninject/CoreModule.cs +++ b/src/Artemis.Core/Ninject/CoreModule.cs @@ -4,6 +4,7 @@ using Artemis.Core.Models.Profile.KeyframeEngines; using Artemis.Core.Plugins.Models; using Artemis.Core.Services.Interfaces; using Artemis.Storage.Repositories.Interfaces; +using Artemis.UI.Shared.Services.Interfaces; using LiteDB; using Ninject.Activation; using Ninject.Extensions.Conventions; @@ -29,6 +30,16 @@ namespace Artemis.Core.Ninject .Configure(c => c.InSingletonScope()); }); + // Bind all shared UI services as singletons + Kernel.Bind(x => + { + x.FromAssemblyContaining() + .SelectAllClasses() + .InheritedFrom() + .BindAllInterfaces() + .Configure(c => c.InSingletonScope()); + }); + // Bind all protected services as singletons Kernel.Bind(x => { diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj index 2510fabe7..57159d87a 100644 --- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj +++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj @@ -19,9 +19,12 @@ pdbonly + + + diff --git a/src/Artemis.UI/Screens/Dialogs/ConfirmDialogView.xaml b/src/Artemis.UI.Shared/Screens/Dialogs/ConfirmDialogView.xaml similarity index 90% rename from src/Artemis.UI/Screens/Dialogs/ConfirmDialogView.xaml rename to src/Artemis.UI.Shared/Screens/Dialogs/ConfirmDialogView.xaml index c335cada7..fcaeacc6f 100644 --- a/src/Artemis.UI/Screens/Dialogs/ConfirmDialogView.xaml +++ b/src/Artemis.UI.Shared/Screens/Dialogs/ConfirmDialogView.xaml @@ -1,11 +1,11 @@ - diff --git a/src/Artemis.UI/Screens/Dialogs/ConfirmDialogViewModel.cs b/src/Artemis.UI.Shared/Screens/Dialogs/ConfirmDialogViewModel.cs similarity index 88% rename from src/Artemis.UI/Screens/Dialogs/ConfirmDialogViewModel.cs rename to src/Artemis.UI.Shared/Screens/Dialogs/ConfirmDialogViewModel.cs index 14b842bab..47e71b7fd 100644 --- a/src/Artemis.UI/Screens/Dialogs/ConfirmDialogViewModel.cs +++ b/src/Artemis.UI.Shared/Screens/Dialogs/ConfirmDialogViewModel.cs @@ -1,6 +1,6 @@ -using Artemis.UI.ViewModels.Dialogs; +using Artemis.UI.Shared.Services.Dialog; -namespace Artemis.UI.Screens.Dialogs +namespace Artemis.UI.Shared.Screens.Dialogs { public class ConfirmDialogViewModel : DialogViewModelBase { diff --git a/src/Artemis.UI.Shared/Screens/Dialogs/ExceptionDialogView.xaml b/src/Artemis.UI.Shared/Screens/Dialogs/ExceptionDialogView.xaml new file mode 100644 index 000000000..96efaa35c --- /dev/null +++ b/src/Artemis.UI.Shared/Screens/Dialogs/ExceptionDialogView.xaml @@ -0,0 +1,34 @@ + + + + + + + + + + + +