diff --git a/src/Artemis.Core/Plugins/Abstract/DataModels/Attributes/DataModelProperty.cs b/src/Artemis.Core/Plugins/Abstract/DataModels/Attributes/DataModelProperty.cs
index 222491ae6..bccbdea3b 100644
--- a/src/Artemis.Core/Plugins/Abstract/DataModels/Attributes/DataModelProperty.cs
+++ b/src/Artemis.Core/Plugins/Abstract/DataModels/Attributes/DataModelProperty.cs
@@ -16,28 +16,23 @@ namespace Artemis.Core.Plugins.Abstract.DataModels.Attributes
public string Description { get; set; }
///
- /// Gets or sets the an optional input prefix to show before input elements in the UI.
+ /// Gets or sets the an optional prefix to show before displaying elements in the UI.
///
- public string InputPrefix { get; set; }
+ public string Prefix { get; set; }
///
- /// Gets or sets an optional input affix to show behind input elements in the UI.
+ /// Gets or sets an optional affix to show behind displaying elements in the UI.
///
- public string InputAffix { get; set; }
+ public string Affix { get; set; }
///
- /// Gets or sets an optional maximum input value, only enforced in the UI.
+ /// Gets or sets an optional maximum value, this value is not enforced but used for percentage calculations.
///
- public object MaxInputValue { get; set; }
+ public object MaxValue { get; set; }
///
- /// Gets or sets the input drag step size, used in the UI.
+ /// Gets or sets an optional minimum value, this value is not enforced but used for percentage calculations.
///
- public float InputStepSize { get; set; }
-
- ///
- /// Gets or sets an optional minimum input value, only enforced in the UI.
- ///
- public object MinInputValue { get; set; }
+ public object MinValue { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/RootView.xaml b/src/Artemis.UI/Screens/RootView.xaml
index 7479bb388..33a3cb100 100644
--- a/src/Artemis.UI/Screens/RootView.xaml
+++ b/src/Artemis.UI/Screens/RootView.xaml
@@ -57,7 +57,15 @@
IsNavigationDrawerOpen="{Binding IsSidebarVisible, Mode=TwoWay}"
Title="{Binding ActiveItem.DisplayName}"
ShowNavigationDrawerButton="True"
- DockPanel.Dock="Top" />
+ DockPanel.Dock="Top">
+
+
+
+
+
diff --git a/src/Artemis.UI/Screens/RootViewModel.cs b/src/Artemis.UI/Screens/RootViewModel.cs
index b70172f9d..c673eddac 100644
--- a/src/Artemis.UI/Screens/RootViewModel.cs
+++ b/src/Artemis.UI/Screens/RootViewModel.cs
@@ -10,6 +10,7 @@ using Artemis.Core.Services.Interfaces;
using Artemis.UI.Events;
using Artemis.UI.Screens.Settings;
using Artemis.UI.Screens.Sidebar;
+using Artemis.UI.Services.Interfaces;
using Artemis.UI.Utilities;
using MaterialDesignThemes.Wpf;
using Stylet;
@@ -20,16 +21,19 @@ namespace Artemis.UI.Screens
{
private readonly PluginSetting _colorScheme;
private readonly ICoreService _coreService;
+ private readonly IDebugService _debugService;
private readonly IEventAggregator _eventAggregator;
private readonly ThemeWatcher _themeWatcher;
- private bool _lostFocus;
private readonly Timer _titleUpdateTimer;
+ private bool _lostFocus;
- public RootViewModel(IEventAggregator eventAggregator, SidebarViewModel sidebarViewModel, ISettingsService settingsService, ICoreService coreService)
+ public RootViewModel(IEventAggregator eventAggregator, SidebarViewModel sidebarViewModel, ISettingsService settingsService, ICoreService coreService,
+ IDebugService debugService)
{
SidebarViewModel = sidebarViewModel;
_eventAggregator = eventAggregator;
_coreService = coreService;
+ _debugService = debugService;
_titleUpdateTimer = new Timer(500);
_titleUpdateTimer.Elapsed += (sender, args) => UpdateWindowTitle();
@@ -69,6 +73,11 @@ namespace Artemis.UI.Screens
_eventAggregator.Publish(new MainWindowFocusChangedEvent(true));
}
+ public void ShowDebugger()
+ {
+ _debugService.ShowDebugger();
+ }
+
public void WindowKeyDown(object sender, KeyEventArgs e)
{
_eventAggregator.Publish(new MainWindowKeyEvent(true, e));
diff --git a/src/Artemis.UI/Screens/Settings/Debug/DebugView.xaml b/src/Artemis.UI/Screens/Settings/Debug/DebugView.xaml
index 80885d037..c139f7f6e 100644
--- a/src/Artemis.UI/Screens/Settings/Debug/DebugView.xaml
+++ b/src/Artemis.UI/Screens/Settings/Debug/DebugView.xaml
@@ -25,7 +25,7 @@
DockPanel.Dock="Top"
Margin="-18 0 0 0">
-
+
diff --git a/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs b/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs
index 01ea815fb..21b85099e 100644
--- a/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs
+++ b/src/Artemis.UI/Screens/Settings/SettingsViewModel.cs
@@ -10,12 +10,11 @@ using Artemis.Core.Services.Interfaces;
using Artemis.Core.Services.Storage.Interfaces;
using Artemis.Core.Utilities;
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.Services.Interfaces;
using Artemis.UI.Shared.Services.Interfaces;
using Artemis.UI.Shared.Utilities;
-using Ninject;
using Serilog.Events;
using Stylet;
@@ -23,29 +22,24 @@ namespace Artemis.UI.Screens.Settings
{
public class SettingsViewModel : MainScreenViewModel
{
+ private readonly IDebugService _debugService;
private readonly IDeviceSettingsVmFactory _deviceSettingsVmFactory;
private readonly IDialogService _dialogService;
- private readonly IKernel _kernel;
private readonly IPluginService _pluginService;
private readonly ISettingsService _settingsService;
private readonly ISurfaceService _surfaceService;
private readonly IWindowManager _windowManager;
- public SettingsViewModel(IKernel kernel,
- ISurfaceService surfaceService,
- IPluginService pluginService,
- IDialogService dialogService,
- IWindowManager windowManager,
- ISettingsService settingsService,
- IDeviceSettingsVmFactory deviceSettingsVmFactory)
+ public SettingsViewModel(ISurfaceService surfaceService, IPluginService pluginService, IDialogService dialogService, IWindowManager windowManager,
+ IDebugService debugService, ISettingsService settingsService, IDeviceSettingsVmFactory deviceSettingsVmFactory)
{
DisplayName = "Settings";
- _kernel = kernel;
_surfaceService = surfaceService;
_pluginService = pluginService;
_dialogService = dialogService;
_windowManager = windowManager;
+ _debugService = debugService;
_settingsService = settingsService;
_deviceSettingsVmFactory = deviceSettingsVmFactory;
@@ -160,7 +154,7 @@ namespace Artemis.UI.Screens.Settings
public void ShowDebugger()
{
- _windowManager.ShowWindow(_kernel.Get());
+ _debugService.ShowDebugger();
}
public async Task ShowLogsFolder()
diff --git a/src/Artemis.UI/Services/DebugService.cs b/src/Artemis.UI/Services/DebugService.cs
new file mode 100644
index 000000000..21e143692
--- /dev/null
+++ b/src/Artemis.UI/Services/DebugService.cs
@@ -0,0 +1,62 @@
+using System.Windows;
+using Artemis.UI.Screens.Settings.Debug;
+using Artemis.UI.Services.Interfaces;
+using MaterialDesignExtensions.Controls;
+using Ninject;
+using Stylet;
+
+namespace Artemis.UI.Services
+{
+ public class DebugService : IDebugService
+ {
+ private readonly IKernel _kernel;
+ private readonly IWindowManager _windowManager;
+ private DebugViewModel _debugViewModel;
+
+ public DebugService(IKernel kernel, IWindowManager windowManager)
+ {
+ _kernel = kernel;
+ _windowManager = windowManager;
+ }
+
+ public void ShowDebugger()
+ {
+ if (_debugViewModel != null)
+ BringDebuggerToForeground();
+ else
+ CreateDebugger();
+ }
+
+ private void CreateDebugger()
+ {
+ _debugViewModel = _kernel.Get();
+ _debugViewModel.Closed += DebugViewModelOnClosed;
+
+ _windowManager.ShowWindow(_debugViewModel);
+ }
+
+ private void DebugViewModelOnClosed(object sender, CloseEventArgs e)
+ {
+ _debugViewModel.Closed -= DebugViewModelOnClosed;
+ _debugViewModel = null;
+ }
+
+ private void BringDebuggerToForeground()
+ {
+ var materialWindow = (MaterialWindow) _debugViewModel.View;
+
+ // Not as straightforward as you might think, this ensures the window always shows, even if it's behind another window etc.
+ // https://stackoverflow.com/a/4831839/5015269
+ if (!materialWindow.IsVisible)
+ materialWindow.Show();
+
+ if (materialWindow.WindowState == WindowState.Minimized)
+ materialWindow.WindowState = WindowState.Normal;
+
+ materialWindow.Activate();
+ materialWindow.Topmost = true; // important
+ materialWindow.Topmost = false; // important
+ materialWindow.Focus();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/Services/Interfaces/IDebugService.cs b/src/Artemis.UI/Services/Interfaces/IDebugService.cs
new file mode 100644
index 000000000..fd349ebba
--- /dev/null
+++ b/src/Artemis.UI/Services/Interfaces/IDebugService.cs
@@ -0,0 +1,7 @@
+namespace Artemis.UI.Services.Interfaces
+{
+ public interface IDebugService : IArtemisUIService
+ {
+ void ShowDebugger();
+ }
+}
\ No newline at end of file