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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/Screens/Dialogs/ExceptionDialogViewModel.cs b/src/Artemis.UI.Shared/Screens/Dialogs/ExceptionDialogViewModel.cs
new file mode 100644
index 000000000..9c4fc4057
--- /dev/null
+++ b/src/Artemis.UI.Shared/Screens/Dialogs/ExceptionDialogViewModel.cs
@@ -0,0 +1,27 @@
+using System;
+using Artemis.UI.Shared.Services.Dialog;
+using ICSharpCode.AvalonEdit;
+using ICSharpCode.AvalonEdit.Document;
+
+namespace Artemis.UI.Shared.Screens.Dialogs
+{
+ public class ExceptionDialogViewModel : DialogViewModelBase
+ {
+ public ExceptionDialogViewModel(string message, Exception exception)
+ {
+ Header = message;
+ Exception = exception;
+ Document = new TextDocument(new StringTextSource(exception.StackTrace));
+ }
+
+ public string Header { get; }
+ public Exception Exception { get; }
+
+ public IDocument Document { get; set; }
+
+ public void Close()
+ {
+ Session.Close();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/Services/Dialog/DialogService.cs b/src/Artemis.UI.Shared/Services/Dialog/DialogService.cs
similarity index 88%
rename from src/Artemis.UI/Services/Dialog/DialogService.cs
rename to src/Artemis.UI.Shared/Services/Dialog/DialogService.cs
index c9541798e..145502cf9 100644
--- a/src/Artemis.UI/Services/Dialog/DialogService.cs
+++ b/src/Artemis.UI.Shared/Services/Dialog/DialogService.cs
@@ -2,15 +2,14 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using Artemis.UI.Screens.Dialogs;
-using Artemis.UI.Services.Interfaces;
-using Artemis.UI.ViewModels.Dialogs;
+using Artemis.UI.Shared.Screens.Dialogs;
+using Artemis.UI.Shared.Services.Interfaces;
using MaterialDesignThemes.Wpf;
using Ninject;
using Ninject.Parameters;
using Stylet;
-namespace Artemis.UI.Services.Dialog
+namespace Artemis.UI.Shared.Services.Dialog
{
public class DialogService : IDialogService
{
@@ -89,6 +88,16 @@ namespace Artemis.UI.Services.Dialog
return await ShowDialog(identifier, _kernel.Get(parameters));
}
+ public async Task ShowExceptionDialog(string message, Exception exception)
+ {
+ var arguments = new IParameter[]
+ {
+ new ConstructorArgument("message", message),
+ new ConstructorArgument("exception", exception)
+ };
+ await Execute.OnUIThreadAsync(async () => await ShowDialog(arguments));
+ }
+
private async Task
+
@@ -112,8 +113,10 @@
+
+
@@ -276,6 +279,9 @@
+
+
+
True
diff --git a/src/Artemis.UI/Bootstrapper.cs b/src/Artemis.UI/Bootstrapper.cs
index 4981fd666..375b0a275 100644
--- a/src/Artemis.UI/Bootstrapper.cs
+++ b/src/Artemis.UI/Bootstrapper.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
@@ -14,9 +16,10 @@ using Stylet;
namespace Artemis.UI
{
- public class Bootstrapper : NinjectBootstrapper
+ public class Bootstrapper : NinjectBootstrapper
{
private ICoreService _core;
+ public static List StartupArguments { get; private set; }
protected override void OnExit(ExitEventArgs e)
{
@@ -28,9 +31,10 @@ namespace Artemis.UI
protected override void Launch()
{
- var windowManager = (IWindowManager) GetInstance(typeof(IWindowManager));
- var splashViewModel = new SplashViewModel(Kernel);
- windowManager.ShowWindow(splashViewModel);
+ StartupArguments = Args.ToList();
+
+ var windowManager = Kernel.Get();
+ windowManager.ShowWindow(RootViewModel);
Task.Run(() =>
{
@@ -38,10 +42,6 @@ namespace Artemis.UI
{
// Start the Artemis core
_core = Kernel.Get();
- // When the core is done, hide the splash and show the main window
- _core.Initialized += (sender, args) => ShowMainWindow(windowManager, splashViewModel);
- // While the core is instantiated, start listening for events on the splash
- splashViewModel.ListenToEvents();
}
catch (Exception e)
{
diff --git a/src/Artemis.UI/Ninject/UiModule.cs b/src/Artemis.UI/Ninject/UiModule.cs
index aafece9f7..6f9550f7b 100644
--- a/src/Artemis.UI/Ninject/UiModule.cs
+++ b/src/Artemis.UI/Ninject/UiModule.cs
@@ -4,8 +4,8 @@ using Artemis.UI.Screens;
using Artemis.UI.Screens.Module.ProfileEditor;
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput;
using Artemis.UI.Services.Interfaces;
+using Artemis.UI.Shared.Services.Dialog;
using Artemis.UI.Stylet;
-using Artemis.UI.ViewModels.Dialogs;
using FluentValidation;
using Ninject.Extensions.Conventions;
using Ninject.Modules;
diff --git a/src/Artemis.UI/Properties/launchSettings.json b/src/Artemis.UI/Properties/launchSettings.json
new file mode 100644
index 000000000..5901254fe
--- /dev/null
+++ b/src/Artemis.UI/Properties/launchSettings.json
@@ -0,0 +1,8 @@
+{
+ "profiles": {
+ "Artemis.UI": {
+ "commandName": "Project",
+ "commandLineArgs": "-autorun"
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Dialogs/ProfileCreateViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/Dialogs/ProfileCreateViewModel.cs
index a40a8405c..7fad3c749 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/Dialogs/ProfileCreateViewModel.cs
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/Dialogs/ProfileCreateViewModel.cs
@@ -1,5 +1,5 @@
using System.Threading.Tasks;
-using Artemis.UI.ViewModels.Dialogs;
+using Artemis.UI.Shared.Services.Dialog;
using FluentValidation;
using Stylet;
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Dialogs/ProfileElementRenameViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/Dialogs/ProfileElementRenameViewModel.cs
index 3bfeca8c6..10794d99b 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/Dialogs/ProfileElementRenameViewModel.cs
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/Dialogs/ProfileElementRenameViewModel.cs
@@ -1,6 +1,6 @@
using System.Threading.Tasks;
using Artemis.Core.Models.Profile;
-using Artemis.UI.ViewModels.Dialogs;
+using Artemis.UI.Shared.Services.Dialog;
using FluentValidation;
using Stylet;
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileEditorViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileEditorViewModel.cs
index 0a4aa1f33..08736326b 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileEditorViewModel.cs
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileEditorViewModel.cs
@@ -14,6 +14,7 @@ using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties;
using Artemis.UI.Screens.Module.ProfileEditor.ProfileTree;
using Artemis.UI.Screens.Module.ProfileEditor.Visualization;
using Artemis.UI.Services.Interfaces;
+using Artemis.UI.Shared.Services.Interfaces;
using Stylet;
namespace Artemis.UI.Screens.Module.ProfileEditor
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/FolderViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/FolderViewModel.cs
index 63778c3b9..36826950c 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/FolderViewModel.cs
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/FolderViewModel.cs
@@ -2,6 +2,7 @@
using Artemis.Core.Services.Interfaces;
using Artemis.UI.Ninject.Factories;
using Artemis.UI.Services.Interfaces;
+using Artemis.UI.Shared.Services.Interfaces;
namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
{
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/LayerViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/LayerViewModel.cs
index 346ce07db..6c693318d 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/LayerViewModel.cs
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/LayerViewModel.cs
@@ -2,6 +2,7 @@
using Artemis.Core.Services.Interfaces;
using Artemis.UI.Ninject.Factories;
using Artemis.UI.Services.Interfaces;
+using Artemis.UI.Shared.Services.Interfaces;
namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
{
diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs
index cbc52223d..c2a1dc86d 100644
--- a/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs
+++ b/src/Artemis.UI/Screens/Module/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs
@@ -7,6 +7,7 @@ using Artemis.UI.Exceptions;
using Artemis.UI.Ninject.Factories;
using Artemis.UI.Screens.Module.ProfileEditor.Dialogs;
using Artemis.UI.Services.Interfaces;
+using Artemis.UI.Shared.Services.Interfaces;
using Stylet;
namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
diff --git a/src/Artemis.UI/Screens/RootView.xaml b/src/Artemis.UI/Screens/RootView.xaml
index 47f1e15d8..7b94465f8 100644
--- a/src/Artemis.UI/Screens/RootView.xaml
+++ b/src/Artemis.UI/Screens/RootView.xaml
@@ -7,6 +7,7 @@
xmlns:s="https://github.com/canton7/Stylet"
xmlns:screens="clr-namespace:Artemis.UI.Screens"
xmlns:mde="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"
+ xmlns:tb="http://www.hardcodet.net/taskbar"
mc:Ignorable="d"
FadeContentIfInactive="False"
Icon="/Artemis.UI;component/Resources/logo-512.png"
@@ -50,15 +51,18 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/RootViewModel.cs b/src/Artemis.UI/Screens/RootViewModel.cs
index da6f4a4f7..4a494f6a9 100644
--- a/src/Artemis.UI/Screens/RootViewModel.cs
+++ b/src/Artemis.UI/Screens/RootViewModel.cs
@@ -2,6 +2,7 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
+using Artemis.Core.Services;
using Artemis.UI.Events;
using Artemis.UI.Screens.Sidebar;
using Artemis.UI.Utilities;
diff --git a/src/Artemis.UI/Screens/Settings/SettingsView.xaml b/src/Artemis.UI/Screens/Settings/SettingsView.xaml
index 449ba2f28..25423ff05 100644
--- a/src/Artemis.UI/Screens/Settings/SettingsView.xaml
+++ b/src/Artemis.UI/Screens/Settings/SettingsView.xaml
@@ -39,7 +39,7 @@
Start up with Windows
-
+
@@ -57,7 +57,7 @@
Start up with Windows minimized
-
+
diff --git a/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs b/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs
index 988ba4cb6..283a1f6b9 100644
--- a/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs
+++ b/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
+using System.Threading.Tasks;
using Artemis.Core;
using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Services;
@@ -12,8 +13,10 @@ using Artemis.UI.Ninject.Factories;
using Artemis.UI.Screens.Settings.Debug;
using Artemis.UI.Screens.Settings.Tabs.Devices;
using Artemis.UI.Screens.Settings.Tabs.Plugins;
+using Artemis.UI.Shared.Services.Interfaces;
using Artemis.UI.Shared.Utilities;
using MaterialDesignThemes.Wpf;
+using Microsoft.Win32;
using Ninject;
using Serilog.Events;
using Stylet;
@@ -23,6 +26,7 @@ namespace Artemis.UI.Screens.Settings
public class SettingsViewModel : MainScreenViewModel
{
private readonly IDeviceSettingsVmFactory _deviceSettingsVmFactory;
+ private readonly IDialogService _dialogService;
private readonly IKernel _kernel;
private readonly IPluginService _pluginService;
private readonly ISettingsService _settingsService;
@@ -32,6 +36,7 @@ namespace Artemis.UI.Screens.Settings
public SettingsViewModel(IKernel kernel,
ISurfaceService surfaceService,
IPluginService pluginService,
+ IDialogService dialogService,
IWindowManager windowManager,
ISettingsService settingsService,
IDeviceSettingsVmFactory deviceSettingsVmFactory)
@@ -43,6 +48,7 @@ namespace Artemis.UI.Screens.Settings
_kernel = kernel;
_surfaceService = surfaceService;
_pluginService = pluginService;
+ _dialogService = dialogService;
_windowManager = windowManager;
_settingsService = settingsService;
_deviceSettingsVmFactory = deviceSettingsVmFactory;
@@ -65,12 +71,33 @@ namespace Artemis.UI.Screens.Settings
public List> TargetFrameRates { get; set; }
public List> RenderScales { get; set; }
- public IEnumerable LogLevels { get; private set; }
+ public IEnumerable LogLevels { get; }
public List SampleSizes { get; set; }
public BindableCollection DeviceSettingsViewModels { get; set; }
public BindableCollection Plugins { get; set; }
+ public bool StartWithWindows
+ {
+ get => _settingsService.GetSetting("UI.AutoRun", false).Value;
+ set
+ {
+ _settingsService.GetSetting("UI.AutoRun", false).Value = value;
+ _settingsService.GetSetting("UI.AutoRun", false).Save();
+ Task.Run(ApplyAutorun);
+ }
+ }
+
+ public bool StartMinimized
+ {
+ get => !_settingsService.GetSetting("UI.ShowOnStartup", true).Value;
+ set
+ {
+ _settingsService.GetSetting("UI.ShowOnStartup", true).Value = !value;
+ _settingsService.GetSetting("UI.ShowOnStartup", true).Save();
+ }
+ }
+
public Tuple SelectedRenderScale
{
get => RenderScales.FirstOrDefault(s => Math.Abs(s.Item2 - RenderScale) < 0.01);
@@ -138,8 +165,10 @@ namespace Artemis.UI.Screens.Settings
Process.Start(Constants.DataFolder);
}
- protected override void OnActivate()
+ protected override void OnInitialActivate()
{
+ Task.Run(ApplyAutorun);
+
DeviceSettingsViewModels.Clear();
foreach (var device in _surfaceService.ActiveSurface.Devices)
DeviceSettingsViewModels.Add(_deviceSettingsVmFactory.Create(device));
@@ -149,7 +178,34 @@ namespace Artemis.UI.Screens.Settings
foreach (var plugin in _pluginService.GetPluginsOfType())
Plugins.Add(new PluginSettingsViewModel(plugin));
- base.OnActivate();
+ base.OnInitialActivate();
+ }
+
+ protected override void OnClose()
+ {
+ DeviceSettingsViewModels.Clear();
+ Plugins.Clear();
+ base.OnClose();
+ }
+
+ private async Task ApplyAutorun()
+ {
+ try
+ {
+ var key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
+ if (key == null)
+ key = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
+
+ if (StartWithWindows)
+ key.SetValue("Artemis", $"\"{Process.GetCurrentProcess().MainModule.FileName}\" -autorun");
+ else
+ key.DeleteValue("Artemis", false);
+ }
+ catch (Exception e)
+ {
+ await _dialogService.ShowExceptionDialog("An exception occured while trying to apply the auto run setting", e);
+ throw;
+ }
}
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Splash/SplashViewModel.cs b/src/Artemis.UI/Screens/Splash/SplashViewModel.cs
index e4f95549a..29438afc6 100644
--- a/src/Artemis.UI/Screens/Splash/SplashViewModel.cs
+++ b/src/Artemis.UI/Screens/Splash/SplashViewModel.cs
@@ -8,22 +8,26 @@ namespace Artemis.UI.Screens.Splash
{
public class SplashViewModel : Screen
{
- private readonly IKernel _kernel;
+ private readonly ICoreService _coreService;
+ private readonly IPluginService _pluginService;
- public SplashViewModel(IKernel kernel)
+ public SplashViewModel(ICoreService coreService, IPluginService pluginService)
{
- _kernel = kernel;
+ _coreService = coreService;
+ _pluginService = pluginService;
Status = "Initializing Core";
+
+ ListenToEvents();
}
public string Status { get; set; }
public void ListenToEvents()
{
- var pluginService = _kernel.Get();
- pluginService.CopyingBuildInPlugins += (sender, args) => Status = "Updating built-in plugins";
- pluginService.PluginLoading += (sender, args) => Status = "Loading plugin: " + args.PluginInfo.Name;
- pluginService.PluginLoaded += (sender, args) => Status = "Initializing UI";
+ _coreService.Initialized += (sender, args) => Execute.OnUIThread(() => RequestClose());
+ _pluginService.CopyingBuildInPlugins += (sender, args) => Status = "Updating built-in plugins";
+ _pluginService.PluginLoading += (sender, args) => Status = "Loading plugin: " + args.PluginInfo.Name;
+ _pluginService.PluginLoaded += (sender, args) => Status = "Initializing UI";
}
// ReSharper disable once UnusedMember.Global - Called from view
diff --git a/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceCreateViewModel.cs b/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceCreateViewModel.cs
index 126e97f09..870af2e86 100644
--- a/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceCreateViewModel.cs
+++ b/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceCreateViewModel.cs
@@ -1,5 +1,5 @@
using System.Threading.Tasks;
-using Artemis.UI.ViewModels.Dialogs;
+using Artemis.UI.Shared.Services.Dialog;
using Stylet;
namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
diff --git a/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceDeviceConfigViewModel.cs b/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceDeviceConfigViewModel.cs
index ab58f6b4f..5ad430311 100644
--- a/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceDeviceConfigViewModel.cs
+++ b/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceDeviceConfigViewModel.cs
@@ -1,6 +1,6 @@
using System.Threading.Tasks;
using Artemis.UI.Screens.SurfaceEditor.Visualization;
-using Artemis.UI.ViewModels.Dialogs;
+using Artemis.UI.Shared.Services.Dialog;
using Stylet;
namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
diff --git a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs
index 3b8e52a45..87239d9ae 100644
--- a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs
+++ b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs
@@ -14,7 +14,7 @@ using Artemis.Core.Services.Storage.Interfaces;
using Artemis.UI.Screens.Shared;
using Artemis.UI.Screens.SurfaceEditor.Dialogs;
using Artemis.UI.Screens.SurfaceEditor.Visualization;
-using Artemis.UI.Services.Interfaces;
+using Artemis.UI.Shared.Services.Interfaces;
using MaterialDesignThemes.Wpf;
using Stylet;
diff --git a/src/Artemis.UI/Screens/TrayView.xaml b/src/Artemis.UI/Screens/TrayView.xaml
new file mode 100644
index 000000000..7e976721c
--- /dev/null
+++ b/src/Artemis.UI/Screens/TrayView.xaml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Artemis.UI/Screens/TrayViewModel.cs b/src/Artemis.UI/Screens/TrayViewModel.cs
new file mode 100644
index 000000000..d563fe193
--- /dev/null
+++ b/src/Artemis.UI/Screens/TrayViewModel.cs
@@ -0,0 +1,67 @@
+using System.Windows;
+using Artemis.Core.Services;
+using Artemis.Core.Services.Interfaces;
+using Artemis.UI.Screens.Splash;
+using Ninject;
+using Stylet;
+
+namespace Artemis.UI.Screens
+{
+ public class TrayViewModel : Screen
+ {
+ private readonly ICoreService _coreService;
+ private readonly IKernel _kernel;
+ private readonly IWindowManager _windowManager;
+
+ public TrayViewModel(IKernel kernel, IWindowManager windowManager, ICoreService coreService, ISettingsService settingsService)
+ {
+ _kernel = kernel;
+ _windowManager = windowManager;
+ _coreService = coreService;
+ CanShowRootViewModel = true;
+
+ var autoRunning = Bootstrapper.StartupArguments.Contains("-autorun");
+ var showOnAutoRun = settingsService.GetSetting("UI.ShowOnStartup", true).Value;
+ if (!autoRunning || showOnAutoRun)
+ {
+ ShowSplashScreen();
+ _coreService.Initialized += (sender, args) => TrayBringToForeground();
+ }
+ }
+
+ public bool CanShowRootViewModel { get; set; }
+
+ public void TrayBringToForeground()
+ {
+ if (!CanShowRootViewModel)
+ return;
+ CanShowRootViewModel = false;
+
+ Execute.OnUIThread(() =>
+ {
+ var rootViewModel = _kernel.Get();
+ rootViewModel.Closed += RootViewModelOnClosed;
+ _windowManager.ShowWindow(rootViewModel);
+ });
+ }
+
+ public void TrayExit()
+ {
+ Application.Current.Shutdown();
+ }
+
+ private void ShowSplashScreen()
+ {
+ Execute.OnUIThread(() =>
+ {
+ var splashViewModel = _kernel.Get();
+ _windowManager.ShowWindow(splashViewModel);
+ });
+ }
+
+ private void RootViewModelOnClosed(object sender, CloseEventArgs e)
+ {
+ CanShowRootViewModel = true;
+ }
+ }
+}
\ No newline at end of file