diff --git a/Artemis/Artemis/App.config b/Artemis/Artemis/App.config
index 9a3c84fc5..366d5c12d 100644
--- a/Artemis/Artemis/App.config
+++ b/Artemis/Artemis/App.config
@@ -196,7 +196,7 @@
TypeWave
- Corsair Gaming K95 RGB
+ Logitech G910 RGB
True
@@ -207,6 +207,9 @@
True
+
+ False
+
diff --git a/Artemis/Artemis/App.xaml b/Artemis/Artemis/App.xaml
index 0fe50d3fd..a2126df67 100644
--- a/Artemis/Artemis/App.xaml
+++ b/Artemis/Artemis/App.xaml
@@ -10,12 +10,13 @@
+
+
-
+
diff --git a/Artemis/Artemis/Artemis.csproj b/Artemis/Artemis/Artemis.csproj
index 5ce0e5878..cf29b0eae 100644
--- a/Artemis/Artemis/Artemis.csproj
+++ b/Artemis/Artemis/Artemis.csproj
@@ -151,8 +151,8 @@
..\packages\log4net.2.0.5\lib\net45-full\log4net.dll
True
-
- ..\packages\MahApps.Metro.1.3.0-ALPHA037\lib\net45\MahApps.Metro.dll
+
+ ..\packages\MahApps.Metro.1.2.4.0\lib\net45\MahApps.Metro.dll
True
@@ -172,7 +172,10 @@
-
+
+ ..\packages\MahApps.Metro.1.2.4.0\lib\net45\System.Windows.Interactivity.dll
+ True
+
diff --git a/Artemis/Artemis/KeyboardProviders/Corsair/K70.cs b/Artemis/Artemis/KeyboardProviders/Corsair/K70.cs
index 63b7b702f..bc9dbe10a 100644
--- a/Artemis/Artemis/KeyboardProviders/Corsair/K70.cs
+++ b/Artemis/Artemis/KeyboardProviders/Corsair/K70.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Drawing;
-using System.Windows.Forms;
+using System.Drawing;
using Artemis.Utilities;
using CUE.NET;
using CUE.NET.Devices.Generic.Enums;
@@ -15,7 +13,10 @@ namespace Artemis.KeyboardProviders.Corsair
public K70()
{
- Name = "Corsair Gaming K70 RGB";
+ Name = "Corsair K70 RGB";
+ CantEnableText = "Couldn't connect to your Corsair keyboard.\n " +
+ "Please check your cables and/or drivers (could be outdated) and that Corsair Utility Engine is running.\n\n " +
+ "If needed, you can select a different keyboard in Artemis under settings.";
}
public override bool CanEnable()
@@ -37,7 +38,6 @@ namespace Artemis.KeyboardProviders.Corsair
}
return true;
-
}
///
@@ -76,13 +76,13 @@ namespace Artemis.KeyboardProviders.Corsair
{
using (
var resized = ImageUtilities.ResizeImage(bitmap,
- (int)_keyboard.KeyboardRectangle.Width,
- (int)_keyboard.KeyboardRectangle.Height)
+ (int) _keyboard.KeyboardRectangle.Width,
+ (int) _keyboard.KeyboardRectangle.Height)
)
{
foreach (var item in _keyboard.Keys)
{
- var ledColor = resized.GetPixel((int)item.KeyRectangle.X, (int)item.KeyRectangle.Y);
+ var ledColor = resized.GetPixel((int) item.KeyRectangle.X, (int) item.KeyRectangle.Y);
if (ledColor == Color.FromArgb(0, 0, 0, 0))
ledColor = Color.Black;
item.Led.Color = ledColor;
diff --git a/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs b/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs
index 517ce6c14..0f75e574c 100644
--- a/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs
+++ b/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Drawing;
-using System.Windows.Forms;
+using System.Drawing;
using Artemis.Utilities;
using CUE.NET;
using CUE.NET.Devices.Generic.Enums;
@@ -15,7 +13,10 @@ namespace Artemis.KeyboardProviders.Corsair
public K95()
{
- Name = "Corsair Gaming K95 RGB";
+ Name = "Corsair K95 RGB";
+ CantEnableText = "Couldn't connect to your Corsair keyboard.\n " +
+ "Please check your cables and/or drivers (could be outdated) and that Corsair Utility Engine is running.\n\n " +
+ "If needed, you can select a different keyboard in Artemis under settings.";
}
public override bool CanEnable()
@@ -37,7 +38,6 @@ namespace Artemis.KeyboardProviders.Corsair
}
return true;
-
}
///
diff --git a/Artemis/Artemis/KeyboardProviders/KeyboardProvider.cs b/Artemis/Artemis/KeyboardProviders/KeyboardProvider.cs
index ecb9a5796..460c1ab09 100644
--- a/Artemis/Artemis/KeyboardProviders/KeyboardProvider.cs
+++ b/Artemis/Artemis/KeyboardProviders/KeyboardProvider.cs
@@ -7,6 +7,7 @@ namespace Artemis.KeyboardProviders
public string Name { get; set; }
public int Height { get; set; }
public int Width { get; set; }
+ public string CantEnableText { get; set; }
public abstract bool CanEnable();
public abstract void Enable();
diff --git a/Artemis/Artemis/KeyboardProviders/Logitech/Orion.cs b/Artemis/Artemis/KeyboardProviders/Logitech/Orion.cs
index 9ed1be889..c6cf2f2bc 100644
--- a/Artemis/Artemis/KeyboardProviders/Logitech/Orion.cs
+++ b/Artemis/Artemis/KeyboardProviders/Logitech/Orion.cs
@@ -8,7 +8,10 @@ namespace Artemis.KeyboardProviders.Logitech
{
public Orion()
{
- Name = "Logitech G910 Orion Spark RGB";
+ Name = "Logitech G910 RGB";
+ CantEnableText = "Couldn't connect to your Logitech G910.\n " +
+ "Please check your cables and updating the Logitech Gaming Software.\n\n " +
+ "If needed, you can select a different keyboard in Artemis under settings.";
Height = 6;
Width = 21;
}
diff --git a/Artemis/Artemis/KeyboardProviders/Razer/BlackWidow.cs b/Artemis/Artemis/KeyboardProviders/Razer/BlackWidow.cs
index 15cf44672..59b3bbd6d 100644
--- a/Artemis/Artemis/KeyboardProviders/Razer/BlackWidow.cs
+++ b/Artemis/Artemis/KeyboardProviders/Razer/BlackWidow.cs
@@ -3,7 +3,6 @@ using System.Drawing;
using Artemis.KeyboardProviders.Razer.Utilities;
using Corale.Colore.Core;
using Corale.Colore.Razer.Keyboard;
-using Color = Corale.Colore.Core.Color;
namespace Artemis.KeyboardProviders.Razer
{
@@ -12,6 +11,9 @@ namespace Artemis.KeyboardProviders.Razer
public BlackWidow()
{
Name = "Razer BlackWidow Chroma";
+ CantEnableText = "Couldn't connect to your Razer BlackWidow Chroma.\n " +
+ "Please check your cables and try updating Razer Synapse.\n\n " +
+ "If needed, you can select a different keyboard in Artemis under settings.";
}
public override bool CanEnable()
@@ -38,8 +40,8 @@ namespace Artemis.KeyboardProviders.Razer
public override void Enable()
{
Chroma.Instance.Initialize();
- Height = (int) Constants.MaxRows;
- Width = (int) Constants.MaxColumns;
+ Height = Constants.MaxRows;
+ Width = Constants.MaxColumns;
}
public override void Disable()
diff --git a/Artemis/Artemis/Models/MainModel.cs b/Artemis/Artemis/Models/MainModel.cs
index f92b66d46..b40d165b1 100644
--- a/Artemis/Artemis/Models/MainModel.cs
+++ b/Artemis/Artemis/Models/MainModel.cs
@@ -17,19 +17,24 @@ namespace Artemis.Models
{
public class MainModel
{
+ private readonly int _fps;
private readonly BackgroundWorker _processWorker;
private readonly BackgroundWorker _updateWorker;
+ private EffectModel _activeEffect;
+ private bool _wasSuspendedBeforeGame;
+
public MainModel(IEventAggregator events)
{
EffectModels = new List();
KeyboardProviders = ProviderHelper.GetKeyboardProviders();
GameStateWebServer = new GameStateWebServer();
KeyboardHook = new KeyboardHook();
+ Suspended = false;
Events = events;
- Fps = 25;
+ _fps = 25;
_updateWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
_processWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
_updateWorker.DoWork += UpdateWorker_DoWork;
@@ -37,16 +42,13 @@ namespace Artemis.Models
}
public KeyboardHook KeyboardHook { get; set; }
-
- public EffectModel ActiveEffect { get; set; }
public KeyboardProvider ActiveKeyboard { get; set; }
public List EffectModels { get; set; }
public List KeyboardProviders { get; set; }
-
public GameStateWebServer GameStateWebServer { get; set; }
public IEventAggregator Events { get; set; }
- public int Fps { get; set; }
- public bool Enabled { get; set; }
+ public bool Enabled { get; private set; }
+ public bool Suspended { get; private set; }
#region Effect methods
@@ -77,75 +79,31 @@ namespace Artemis.Models
Enabled = true;
Events.PublishOnUIThread(new ToggleEnabled(Enabled));
+
+ if (General.Default.Suspended && !Suspended)
+ ToggleSuspension();
}
public void ShutdownEffects()
{
if (!Enabled)
return;
-
+
// Stop the Background Worker
_updateWorker.CancelAsync();
_processWorker.CancelAsync();
// Dispose the current active effect
- ActiveEffect?.Dispose();
- ActiveEffect = null;
+ _activeEffect?.Dispose();
+ _activeEffect = null;
ActiveKeyboard?.Disable();
ActiveKeyboard = null;
-
+
Enabled = false;
Events.PublishOnUIThread(new ToggleEnabled(Enabled));
}
- private void LoadLastKeyboard()
- {
- var keyboard = KeyboardProviders.FirstOrDefault(k => k.Name == General.Default.LastKeyboard);
- ChangeKeyboard(keyboard ?? KeyboardProviders.First(k => k.Name == "Logitech G910 Orion Spark RGB"));
- }
-
- public void ChangeKeyboard(KeyboardProvider keyboardProvider)
- {
- if (ActiveKeyboard != null && keyboardProvider.Name == ActiveKeyboard.Name)
- return;
-
- ActiveKeyboard?.Disable();
-
- // Disable everything if there's no active keyboard found
- if (!keyboardProvider.CanEnable())
- {
- string message;
- if (keyboardProvider.Name.ToLower().Contains("Corsair"))
- {
- message = "Couldn't connect to the " + keyboardProvider.Name + ".\n " +
- "Please check your cables and/or drivers (could be outdated) and that Corsair Utility Engine is running.\n\n " +
- "If needed, you can select a different keyboard in Artemis under settings.";
- }
- else
- {
- message = "Couldn't connect to the " + keyboardProvider.Name + ".\n " +
- "Please check your cables and/or drivers (could be outdated).\n\n " +
- "If needed, you can select a different keyboard in Artemis under settings.";
- }
-
- ActiveKeyboard = null;
- MessageBox.Show(
- message,
- "Artemis (╯°□°)╯︵ ┻━┻",
- MessageBoxButtons.OK,
- MessageBoxIcon.Warning);
- ShutdownEffects();
- return;
- }
-
- ActiveKeyboard = keyboardProvider;
- ActiveKeyboard.Enable();
-
- General.Default.LastKeyboard = ActiveKeyboard.Name;
- General.Default.Save();
- }
-
private void LoadLastEffect()
{
var effect = EffectModels.FirstOrDefault(e => e.Name == General.Default.LastEffect);
@@ -163,21 +121,30 @@ namespace Artemis.Models
if (!gameModel.Enabled)
return;
- if (ActiveEffect != null && effectModel.Name == ActiveEffect.Name)
+ if (_activeEffect != null && effectModel.Name == _activeEffect.Name)
return;
- ActiveEffect?.Dispose();
- ActiveEffect = effectModel;
- ActiveEffect.Enable();
+ _activeEffect?.Dispose();
- if (ActiveEffect is GameModel) return;
+ // If needed, unsuspend when loading a new effect
+ if (Suspended)
+ {
+ _wasSuspendedBeforeGame = true;
+ ToggleSuspension();
+ }
+
+ _activeEffect = effectModel;
+ _activeEffect.Enable();
+
+ if (_activeEffect is GameModel)
+ return;
// Non-game effects are stored as the new LastEffect.
- General.Default.LastEffect = ActiveEffect.Name;
+ General.Default.LastEffect = _activeEffect.Name;
General.Default.Save();
// Let the ViewModels know
- Events.PublishOnUIThread(new ChangeActiveEffect(ActiveEffect.Name));
+ Events.PublishOnUIThread(new ChangeActiveEffect(_activeEffect.Name));
}
public void EnableEffect(EffectModel effectModel)
@@ -188,15 +155,71 @@ namespace Artemis.Models
ChangeEffect(effectModel);
}
+ public void ToggleSuspension()
+ {
+ if (Suspended)
+ {
+ LoadLastKeyboard();
+ Suspended = false;
+ General.Default.Suspended = false;
+ General.Default.Save();
+ Events.PublishOnUIThread(new ChangeActiveEffect(_activeEffect?.Name));
+ return;
+ }
+
+ Suspended = true;
+ General.Default.Suspended = true;
+ General.Default.Save();
+ ActiveKeyboard?.Disable();
+ ActiveKeyboard = null;
+ Events.PublishOnUIThread(new ChangeActiveEffect(_activeEffect?.Name));
+ }
+
public bool IsEnabled(EffectModel effectModel)
{
+ if (Suspended)
+ return false;
if (effectModel is GameModel)
return false;
return General.Default.LastEffect == effectModel.Name;
}
- #endregion Effect methods
+ #endregion
+
+ #region Keyboard methods
+
+ private void LoadLastKeyboard()
+ {
+ var keyboard = KeyboardProviders.FirstOrDefault(k => k.Name == General.Default.LastKeyboard);
+ ChangeKeyboard(keyboard ?? KeyboardProviders.First());
+ }
+
+ public void ChangeKeyboard(KeyboardProvider keyboardProvider)
+ {
+ if (ActiveKeyboard != null && keyboardProvider.Name == ActiveKeyboard.Name)
+ return;
+
+ ActiveKeyboard?.Disable();
+
+ // Disable everything if there's no active keyboard found
+ if (!keyboardProvider.CanEnable())
+ {
+ ActiveKeyboard = null;
+ MessageBox.Show(keyboardProvider.CantEnableText, "Artemis (╯°□°)╯︵ ┻━┻",
+ MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ ShutdownEffects();
+ return;
+ }
+
+ ActiveKeyboard = keyboardProvider;
+ ActiveKeyboard.Enable();
+
+ General.Default.LastKeyboard = ActiveKeyboard.Name;
+ General.Default.Save();
+ }
+
+ #endregion
#region Workers
@@ -205,24 +228,23 @@ namespace Artemis.Models
var sw = new Stopwatch();
while (!_updateWorker.CancellationPending)
{
- if (ActiveKeyboard == null)
+ if (ActiveKeyboard == null || Suspended)
{
- Thread.Sleep(1000 / Fps);
+ Thread.Sleep(1000/_fps);
continue;
}
sw.Start();
// Update the current effect
- ActiveEffect.Update();
+ _activeEffect.Update();
// Get ActiveEffect's bitmap
- var bitmap = ActiveEffect.GenerateBitmap();
+ var bitmap = _activeEffect.GenerateBitmap();
// Draw enabled overlays on top
- foreach (
- var overlayModel in
- EffectModels.OfType().Where(overlayModel => overlayModel.Enabled))
+ foreach (var overlayModel in EffectModels.OfType()
+ .Where(overlayModel => overlayModel.Enabled))
{
overlayModel.Update();
bitmap = bitmap != null ? overlayModel.GenerateBitmap(bitmap) : overlayModel.GenerateBitmap();
@@ -238,7 +260,7 @@ namespace Artemis.Models
}
// Sleep according to time left this frame
- var sleep = (int)(1000 / Fps - sw.ElapsedMilliseconds);
+ var sleep = (int) (1000/_fps - sw.ElapsedMilliseconds);
if (sleep > 0)
Thread.Sleep(sleep);
sw.Reset();
@@ -261,7 +283,7 @@ namespace Artemis.Models
continue;
// If the active effect is a disabled game model, disable it
- var model = ActiveEffect as GameModel;
+ var model = _activeEffect as GameModel;
if (model != null && !model.Enabled)
LoadLastEffect();
else
@@ -272,9 +294,16 @@ namespace Artemis.Models
}
// If no game process is found, but the active effect still belongs to a game,
- // set it to a normal effect
- if (!foundProcess && ActiveEffect is GameModel)
+ // set it to a normal effect, and if needed, suspend again.
+ if (!foundProcess && _activeEffect is GameModel)
+ {
LoadLastEffect();
+ if (_wasSuspendedBeforeGame)
+ {
+ ToggleSuspension();
+ _wasSuspendedBeforeGame = false;
+ }
+ }
Thread.Sleep(1000);
}
diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerViewModel.cs b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerViewModel.cs
index 3c4cce45c..fd491e91c 100644
--- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerViewModel.cs
+++ b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerViewModel.cs
@@ -46,8 +46,15 @@ namespace Artemis.Modules.Effects.AudioVisualizer
public void ToggleEffect()
{
- MainModel.EnableEffect(AudioVisualizerModel);
- NotifyOfPropertyChange(() => EffectEnabled);
+ if (EffectEnabled && !MainModel.Suspended)
+ MainModel.ToggleSuspension();
+ else if (!EffectEnabled && !MainModel.Suspended)
+ MainModel.EnableEffect(AudioVisualizerModel);
+ else
+ {
+ MainModel.ToggleSuspension();
+ MainModel.EnableEffect(AudioVisualizerModel);
+ }
}
public void SaveSettings()
diff --git a/Artemis/Artemis/Modules/Effects/Debug/DebugEffectViewModel.cs b/Artemis/Artemis/Modules/Effects/Debug/DebugEffectViewModel.cs
index 46b4f686f..0296523b9 100644
--- a/Artemis/Artemis/Modules/Effects/Debug/DebugEffectViewModel.cs
+++ b/Artemis/Artemis/Modules/Effects/Debug/DebugEffectViewModel.cs
@@ -100,7 +100,15 @@ namespace Artemis.Modules.Effects.Debug
public void ToggleEffect()
{
- MainModel.EnableEffect(DebugEffectModel);
+ if (EffectEnabled && !MainModel.Suspended)
+ MainModel.ToggleSuspension();
+ else if (!EffectEnabled && !MainModel.Suspended)
+ MainModel.EnableEffect(DebugEffectModel);
+ else
+ {
+ MainModel.ToggleSuspension();
+ MainModel.EnableEffect(DebugEffectModel);
+ }
}
public void ResetSettings()
diff --git a/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleViewModel.cs b/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleViewModel.cs
index ba2769e43..0de2f92cd 100644
--- a/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleViewModel.cs
+++ b/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleViewModel.cs
@@ -30,7 +30,15 @@ namespace Artemis.Modules.Effects.TypeHole
public void ToggleEffect()
{
- MainModel.EnableEffect(TypeHoleModel);
+ if (EffectEnabled && !MainModel.Suspended)
+ MainModel.ToggleSuspension();
+ else if (!EffectEnabled && !MainModel.Suspended)
+ MainModel.EnableEffect(TypeHoleModel);
+ else
+ {
+ MainModel.ToggleSuspension();
+ MainModel.EnableEffect(TypeHoleModel);
+ }
}
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveViewModel.cs b/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveViewModel.cs
index f56dd7a86..7e238abe4 100644
--- a/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveViewModel.cs
+++ b/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveViewModel.cs
@@ -46,8 +46,15 @@ namespace Artemis.Modules.Effects.TypeWave
public void ToggleEffect()
{
- MainModel.EnableEffect(TypeWaveModel);
- NotifyOfPropertyChange(() => EffectEnabled);
+ if (EffectEnabled && !MainModel.Suspended)
+ MainModel.ToggleSuspension();
+ else if (!EffectEnabled && !MainModel.Suspended)
+ MainModel.EnableEffect(TypeWaveModel);
+ else
+ {
+ MainModel.ToggleSuspension();
+ MainModel.EnableEffect(TypeWaveModel);
+ }
}
public void SaveSettings()
diff --git a/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayView.xaml b/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayView.xaml
index c9f3d2af7..0391dd02f 100644
--- a/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayView.xaml
+++ b/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayView.xaml
@@ -18,6 +18,7 @@
+
@@ -59,7 +60,13 @@
- Note: This is an overlay. It will go over any other active effect, and is only shown at certain moments (in this case when changing volume).
+ Note: This is an overlay. It will go over any other active effect, and is only shown at certain moments (in this case when changing volume). Please also note that it won't work if there aren't any active effects.
+
+
+
+ Please also note that it won't work if there aren't any active effects.
diff --git a/Artemis/Artemis/Settings/General.Designer.cs b/Artemis/Artemis/Settings/General.Designer.cs
index 3fb4d979a..86d434e1e 100644
--- a/Artemis/Artemis/Settings/General.Designer.cs
+++ b/Artemis/Artemis/Settings/General.Designer.cs
@@ -37,7 +37,7 @@ namespace Artemis.Settings {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Corsair Gaming K95 RGB")]
+ [global::System.Configuration.DefaultSettingValueAttribute("Logitech G910 RGB")]
public string LastKeyboard {
get {
return ((string)(this["LastKeyboard"]));
@@ -82,5 +82,17 @@ namespace Artemis.Settings {
this["Autorun"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool Suspended {
+ get {
+ return ((bool)(this["Suspended"]));
+ }
+ set {
+ this["Suspended"] = value;
+ }
+ }
}
}
diff --git a/Artemis/Artemis/Settings/General.settings b/Artemis/Artemis/Settings/General.settings
index ab7c78638..6a8523ecf 100644
--- a/Artemis/Artemis/Settings/General.settings
+++ b/Artemis/Artemis/Settings/General.settings
@@ -6,7 +6,7 @@
TypeWave
- Corsair Gaming K95 RGB
+ Logitech G910 RGB
True
@@ -17,5 +17,8 @@
True
+
+ False
+
\ No newline at end of file
diff --git a/Artemis/Artemis/Settings/GeneralSettings.cs b/Artemis/Artemis/Settings/GeneralSettings.cs
index c44be956c..16d5d04df 100644
--- a/Artemis/Artemis/Settings/GeneralSettings.cs
+++ b/Artemis/Artemis/Settings/GeneralSettings.cs
@@ -15,8 +15,6 @@ namespace Artemis.Settings
{
if (General.Default.GamestatePort == value) return;
General.Default.GamestatePort = value;
- ApplyGamestatePort();
- General.Default.Save();
}
}
@@ -27,7 +25,6 @@ namespace Artemis.Settings
{
if (General.Default.EnablePointersUpdate == value) return;
General.Default.EnablePointersUpdate = value;
- General.Default.Save();
}
}
@@ -38,8 +35,6 @@ namespace Artemis.Settings
{
if (General.Default.Autorun == value) return;
General.Default.Autorun = value;
- ApplyAutorun();
- General.Default.Save();
}
}
@@ -62,5 +57,22 @@ namespace Artemis.Settings
else if (File.Exists(startupFolder + @"\Artemis.lnk"))
File.Delete(startupFolder + @"\Artemis.lnk");
}
+
+ public void SaveSettings()
+ {
+ General.Default.Save();
+
+ ApplyAutorun();
+ ApplyGamestatePort();
+ }
+
+ public void ResetSettings()
+ {
+ GamestatePort = 51364;
+ EnablePointersUpdate = true;
+ Autorun = true;
+
+ SaveSettings();
+ }
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs b/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs
index c45110db4..8034942a9 100644
--- a/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs
+++ b/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs
@@ -80,6 +80,17 @@ namespace Artemis.ViewModels.Flyouts
MainModel.StartEffects();
}
+ public void ResetSettings()
+ {
+ GeneralSettings.ResetSettings();
+ NotifyOfPropertyChange(() => GeneralSettings);
+ }
+
+ public void SaveSettings()
+ {
+ GeneralSettings.SaveSettings();
+ }
+
public void NavigateTo(string url)
{
Process.Start(new ProcessStartInfo(url));
diff --git a/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs b/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs
index 9cfa4635f..8bbca0bd5 100644
--- a/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs
+++ b/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs
@@ -1,5 +1,6 @@
using System.Windows;
using Artemis.Events;
+using Artemis.Settings;
using Caliburn.Micro;
namespace Artemis.ViewModels
diff --git a/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml b/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml
index 5a2a4ce0c..5639142d5 100644
--- a/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml
+++ b/Artemis/Artemis/Views/Flyouts/FlyoutSettingsView.xaml
@@ -46,7 +46,7 @@
+ Width="140" />
diff --git a/Artemis/Artemis/Views/SystemTrayView.xaml b/Artemis/Artemis/Views/SystemTrayView.xaml
index 6429ad4de..afe67f3d1 100644
--- a/Artemis/Artemis/Views/SystemTrayView.xaml
+++ b/Artemis/Artemis/Views/SystemTrayView.xaml
@@ -1,6 +1,7 @@
-
-
+
@@ -28,9 +29,9 @@
cal:Message.Attach="[Event TrayMouseDoubleClick] = [Action ShowWindow]"
ContextMenu="{StaticResource MainSysTrayMenu}" />
-
+
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Artemis/Artemis/Views/SystemTrayView.xaml.cs b/Artemis/Artemis/Views/SystemTrayView.xaml.cs
index 34e2382d2..e56c8583b 100644
--- a/Artemis/Artemis/Views/SystemTrayView.xaml.cs
+++ b/Artemis/Artemis/Views/SystemTrayView.xaml.cs
@@ -1,11 +1,12 @@
using System.Windows;
+using MahApps.Metro.Controls;
namespace Artemis.Views
{
///
/// Interaction logic for SystemTrayView.xaml
///
- public partial class SystemTrayView : Window
+ public partial class SystemTrayView : MetroWindow
{
public SystemTrayView()
{
diff --git a/Artemis/Artemis/packages.config b/Artemis/Artemis/packages.config
index 0588cb6bf..e2d233c8d 100644
--- a/Artemis/Artemis/packages.config
+++ b/Artemis/Artemis/packages.config
@@ -9,7 +9,7 @@
-
+