diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml index 670968277..e195fd19c 100644 --- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml +++ b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml @@ -38,9 +38,16 @@ + + + + + - diff --git a/Artemis/Artemis/Modules/Effects/Debug/DebugEffectView.xaml b/Artemis/Artemis/Modules/Effects/Debug/DebugEffectView.xaml index f8de110b4..bce54efc7 100644 --- a/Artemis/Artemis/Modules/Effects/Debug/DebugEffectView.xaml +++ b/Artemis/Artemis/Modules/Effects/Debug/DebugEffectView.xaml @@ -36,6 +36,14 @@ + + + + + diff --git a/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleView.xaml b/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleView.xaml index eca24eb53..1fb37d5d7 100644 --- a/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleView.xaml +++ b/Artemis/Artemis/Modules/Effects/TypeHole/TypeHoleView.xaml @@ -31,9 +31,16 @@ diff --git a/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveView.xaml b/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveView.xaml index df0cd582d..741ea49fe 100644 --- a/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveView.xaml +++ b/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveView.xaml @@ -35,8 +35,16 @@ diff --git a/Artemis/Artemis/Utilities/Keyboard/KeyboardHook.cs b/Artemis/Artemis/Utilities/Keyboard/KeyboardHook.cs index 3cea93995..3a59e7071 100644 --- a/Artemis/Artemis/Utilities/Keyboard/KeyboardHook.cs +++ b/Artemis/Artemis/Utilities/Keyboard/KeyboardHook.cs @@ -10,7 +10,7 @@ namespace Artemis.Utilities.Keyboard public void Subscribe(KeyEventHandler handleKeypress) { - if (Subscriptions < 1) + if (_mGlobalHook == null) _mGlobalHook = Hook.GlobalEvents(); _mGlobalHook.KeyDown += handleKeypress; @@ -19,6 +19,9 @@ namespace Artemis.Utilities.Keyboard public void Unsubscribe(KeyEventHandler handleKeypress) { + if (_mGlobalHook == null) + return; + _mGlobalHook.KeyDown -= handleKeypress; Subscriptions--; diff --git a/Artemis/Artemis/ViewModels/Abstract/EffectViewModel.cs b/Artemis/Artemis/ViewModels/Abstract/EffectViewModel.cs index b03f9b760..66300f294 100644 --- a/Artemis/Artemis/ViewModels/Abstract/EffectViewModel.cs +++ b/Artemis/Artemis/ViewModels/Abstract/EffectViewModel.cs @@ -7,6 +7,7 @@ namespace Artemis.ViewModels.Abstract public abstract class EffectViewModel : Screen { private EffectSettings _effectSettings; + private bool _showDisabledPopup; public EffectModel EffectModel { get; set; } public MainManager MainManager { get; set; } @@ -24,8 +25,26 @@ namespace Artemis.ViewModels.Abstract public bool EffectEnabled => MainManager.EffectManager.ActiveEffect == EffectModel; + public bool ShowDisabledPopup + { + get { return _showDisabledPopup; } + set + { + if (value == _showDisabledPopup) return; + _showDisabledPopup = value; + NotifyOfPropertyChange(() => ShowDisabledPopup); + } + } + public void ToggleEffect() { + if (!MainManager.ProgramEnabled) + { + NotifyOfPropertyChange(() => EffectEnabled); + ShowDisabledPopup = true; + return; + } + if (EffectEnabled) MainManager.EffectManager.ClearEffect(); else diff --git a/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs b/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs index 05cc0d9f4..adfe0be1f 100644 --- a/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs +++ b/Artemis/Artemis/ViewModels/Flyouts/FlyoutSettingsViewModel.cs @@ -76,11 +76,9 @@ namespace Artemis.ViewModels.Flyouts public void ToggleEnabled() { if (Enabled) - MainManager.Stop(); - else if (MainManager.EffectManager.ActiveEffect != null) - MainManager.Start(); + MainManager.DisableProgram(); else - MainManager.Start(MainManager.EffectManager.GetLastEffect()); + MainManager.EnableProgram(); } public void ResetSettings() diff --git a/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs b/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs index 7e016ff49..6ca8dc515 100644 --- a/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs +++ b/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs @@ -65,9 +65,9 @@ namespace Artemis.ViewModels public void ToggleEnabled() { if (Enabled) - _shellViewModel.MainManager.Stop(); + _shellViewModel.MainManager.DisableProgram(); else - _shellViewModel.MainManager.Start(); + _shellViewModel.MainManager.EnableProgram(); } protected override void OnActivate()