diff --git a/Artemis/Artemis/App.config b/Artemis/Artemis/App.config index 9c9c880e7..eb58324d3 100644 --- a/Artemis/Artemis/App.config +++ b/Artemis/Artemis/App.config @@ -2,44 +2,19 @@ - -
-
-
-
-
-
-
-
-
-
-
-
+ +
+
+
+
+
+
+
+
+
+
+
+
@@ -233,7 +208,7 @@ 51364 - True + False False diff --git a/Artemis/Artemis/App.xaml b/Artemis/Artemis/App.xaml index 9d7642210..110eccc23 100644 --- a/Artemis/Artemis/App.xaml +++ b/Artemis/Artemis/App.xaml @@ -17,7 +17,7 @@ + Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" /> diff --git a/Artemis/Artemis/Artemis.csproj b/Artemis/Artemis/Artemis.csproj index 8de9fdf7b..ef47f3c4b 100644 --- a/Artemis/Artemis/Artemis.csproj +++ b/Artemis/Artemis/Artemis.csproj @@ -35,9 +35,13 @@ false false true + https://github.com/SpoinkyNL/Artemis/wiki/Frequently-Asked-Questions-%28FAQ%29 + Artemis + Artemis 0 1.0.2.0 false + true true true @@ -74,7 +78,7 @@ false - logo.ico + Resources\logo.ico true @@ -139,10 +143,6 @@ ..\packages\CUE.NET.1.0.2.1\lib\net45\CUE.NET.dll True - - ..\packages\MouseKeyHook.5.4.0\lib\net40\Gma.System.MouseKeyHook.dll - True - ..\packages\Hardcodet.NotifyIcon.Wpf.1.0.5\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll True @@ -172,10 +172,7 @@ - - ..\packages\MahApps.Metro.1.2.4.0\lib\net45\System.Windows.Interactivity.dll - True - + @@ -189,6 +186,10 @@ ..\packages\WpfExceptionViewer.1.0.0.0\lib\VioletTape.WpfExceptionViewer.dll True + + ..\packages\VirtualInput.1.0.1\lib\net20\VirtualInput.dll + True + @@ -434,9 +435,13 @@ + + PreserveNewest + + + - SettingsSingleFileGenerator @@ -527,9 +532,6 @@ PreserveNewest - - PreserveNewest - diff --git a/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveModel.cs b/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveModel.cs index a8472f5c4..f61bd161a 100644 --- a/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveModel.cs +++ b/Artemis/Artemis/Modules/Effects/TypeWave/TypeWaveModel.cs @@ -2,7 +2,6 @@ using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; -using System.Threading.Tasks; using System.Windows.Forms; using Artemis.KeyboardProviders.Corsair; using Artemis.KeyboardProviders.Logitech.Utilities; @@ -24,14 +23,33 @@ namespace Artemis.Modules.Effects.TypeWave _randomColor = Color.Red; Settings = settings; Initialized = false; + Scale = 4; } + public int Scale { get; set; } + public TypeWaveSettings Settings { get; set; } public override void Dispose() { Initialized = false; - MainManager.KeyboardHook.Unsubscribe(HandleKeypress); + MainManager.KeyboardHook.KeyDownCallback -= KeyboardHookOnKeyDownCallback; + } + + private void KeyboardHookOnKeyDownCallback(KeyEventArgs e) + { + // More than 25 waves is pointless + if (_waves.Count >= 25) + return; + + var keyMatch = KeyMap.UsEnglishOrionKeys.FirstOrDefault(k => k.KeyCode == e.KeyCode); + if (keyMatch == null) + return; + + _waves.Add(Settings.IsRandomColors + ? new Wave(new Point(keyMatch.PosX * Scale, keyMatch.PosY * Scale), 0, _randomColor) + : new Wave(new Point(keyMatch.PosX * Scale, keyMatch.PosY * Scale), 0, + ColorHelpers.ToDrawingColor(Settings.WaveColor))); } public override void Enable() @@ -39,7 +57,7 @@ namespace Artemis.Modules.Effects.TypeWave Initialized = false; // Listener won't start unless the effect is active - MainManager.KeyboardHook.Subscribe(HandleKeypress); + MainManager.KeyboardHook.KeyDownCallback += KeyboardHookOnKeyDownCallback; Initialized = true; } @@ -54,7 +72,7 @@ namespace Artemis.Modules.Effects.TypeWave // TODO: Get from settings var fps = 25; - _waves[i].Size += Settings.SpreadSpeed; + _waves[i].Size += Settings.SpreadSpeed * Scale; if (Settings.IsShiftColors) _waves[i].Color = ColorHelpers.ShiftColor(_waves[i].Color, Settings.ShiftColorSpeed); @@ -78,7 +96,7 @@ namespace Artemis.Modules.Effects.TypeWave if (_waves.Count == 0) return null; - var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(); + var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale); using (var g = Graphics.FromImage(bitmap)) { g.Clear(Color.Transparent); @@ -116,27 +134,6 @@ namespace Artemis.Modules.Effects.TypeWave } return bitmap; } - - private void HandleKeypress(object sender, KeyEventArgs e) - { - Task.Factory.StartNew(() => KeyPressTask(e)); - } - - private void KeyPressTask(KeyEventArgs e) - { - // More than 25 waves is pointless - if (_waves.Count >= 25) - return; - - var keyMatch = KeyMap.UsEnglishOrionKeys.FirstOrDefault(k => k.KeyCode == e.KeyCode); - if (keyMatch == null) - return; - - _waves.Add(Settings.IsRandomColors - ? new Wave(new Point(keyMatch.PosX, keyMatch.PosY), 0, _randomColor) - : new Wave(new Point(keyMatch.PosX, keyMatch.PosY), 0, - ColorHelpers.ToDrawingColor(Settings.WaveColor))); - } } public class Wave diff --git a/Artemis/Artemis/Modules/Games/Dota2/Dota2ViewModel.cs b/Artemis/Artemis/Modules/Games/Dota2/Dota2ViewModel.cs index 918dd13e8..479b30e92 100644 --- a/Artemis/Artemis/Modules/Games/Dota2/Dota2ViewModel.cs +++ b/Artemis/Artemis/Modules/Games/Dota2/Dota2ViewModel.cs @@ -1,17 +1,15 @@ using Artemis.Managers; -using Caliburn.Micro; +using Artemis.ViewModels.Abstract; namespace Artemis.Modules.Games.Dota2 { - public class Dota2ViewModel : Screen + public class Dota2ViewModel : GameViewModel { public Dota2ViewModel(MainManager mainManager) { MainManager = mainManager; } - public MainManager MainManager { get; set; } - public static string Name => "Dota 2 (NYI)"; public string Content => "Dota 2 Content"; } diff --git a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3View.xaml b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3View.xaml index eba43a8b0..55ece4f20 100644 --- a/Artemis/Artemis/Modules/Games/Witcher3/Witcher3View.xaml +++ b/Artemis/Artemis/Modules/Games/Witcher3/Witcher3View.xaml @@ -29,7 +29,7 @@ diff --git a/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayModel.cs b/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayModel.cs index ff4398e5c..cbe5f5b49 100644 --- a/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayModel.cs +++ b/Artemis/Artemis/Modules/Overlays/VolumeDisplay/VolumeDisplayModel.cs @@ -1,6 +1,5 @@ using System.Drawing; using System.Runtime.InteropServices; -using System.Threading.Tasks; using System.Windows.Forms; using Artemis.Managers; using Artemis.Models; @@ -25,13 +24,13 @@ namespace Artemis.Modules.Overlays.VolumeDisplay public override void Dispose() { - MainManager.KeyboardHook.Unsubscribe(HandleKeypress); + MainManager.KeyboardHook.KeyDownCallback -= KeyPressTask; } public override void Enable() { // Listener won't start unless the effect is active - MainManager.KeyboardHook.Subscribe(HandleKeypress); + MainManager.KeyboardHook.KeyDownCallback += KeyPressTask; } public override void Update() @@ -80,11 +79,6 @@ namespace Artemis.Modules.Overlays.VolumeDisplay return bitmap; } - private void HandleKeypress(object sender, KeyEventArgs e) - { - Task.Factory.StartNew(() => KeyPressTask(e)); - } - private void KeyPressTask(KeyEventArgs e) { if (e.KeyCode != Keys.VolumeUp && e.KeyCode != Keys.VolumeDown) diff --git a/Artemis/Artemis/Properties/Resources.Designer.cs b/Artemis/Artemis/Properties/Resources.Designer.cs index 39ff59dd0..1d5940ce5 100644 --- a/Artemis/Artemis/Properties/Resources.Designer.cs +++ b/Artemis/Artemis/Properties/Resources.Designer.cs @@ -1,66 +1,66 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Artemis.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Artemis.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Artemis.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Artemis.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// /// Looks up a localized string similar to <?xml version="1.0" encoding="UTF-16"?> ///<!-- Used by Artemis to get the active Sign --> ///<UserConfig> @@ -69,25 +69,25 @@ namespace Artemis.Properties { /// <Var id="ActiveSign" displayName="ActiveSign" displayType="SLIDER:0:1:1000000"/> /// </VisibleVars> /// </Group> - ///</UserConfig>. - /// - internal static string artemisXml { - get { - return ResourceManager.GetString("artemisXml", resourceCulture); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap bow { - get { - object obj = ResourceManager.GetObject("bow", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// + ///</UserConfig>. + /// + internal static string artemisXml { + get { + return ResourceManager.GetString("artemisXml", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap bow { + get { + object obj = ResourceManager.GetObject("bow", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// /// Looks up a localized string similar to "Artemis" ///{ /// "uri" "http://localhost:{{port}}/csgo_game_event" @@ -105,36 +105,56 @@ namespace Artemis.Properties { /// "player_weapons" "1" /// "player_match_stats" "1" /// } - ///}. - /// - internal static string gamestateConfiguration { - get { - return ResourceManager.GetString("gamestateConfiguration", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to /***********************************************************************/ - ////** © 2015 CD PROJEKT S.A. All rights reserved. - ////** THE WITCHER® is a trademark of CD PROJEKT S. A. - ////** The Witcher game is based on the prose of Andrzej Sapkowski. - ////***********************************************************************/ - /// - /// - /// - /// - ///statemachine class W3PlayerWitcher extends CR4Player - ///{ - /// - /// private saved var craftingSchematics : array<name>; - /// - /// - /// private saved var alchemyRecipes : array<name>; [rest of string was truncated]";. - /// - internal static string playerWitcherWs { - get { - return ResourceManager.GetString("playerWitcherWs", resourceCulture); - } - } - } -} + ///}. + /// + internal static string gamestateConfiguration { + get { + return ResourceManager.GetString("gamestateConfiguration", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// + internal static System.Drawing.Icon logo { + get { + object obj = ResourceManager.GetObject("logo", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// + internal static System.Drawing.Icon logo_disabled { + get { + object obj = ResourceManager.GetObject("logo_disabled", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + /// + /// Looks up a localized string similar to /***********************************************************************/ + ////** © 2015 CD PROJEKT S.A. All rights reserved. + ////** THE WITCHER® is a trademark of CD PROJEKT S. A. + ////** The Witcher game is based on the prose of Andrzej Sapkowski. + ////***********************************************************************/ + /// + /// + /// + /// + ///statemachine class W3PlayerWitcher extends CR4Player + ///{ + /// + /// private saved var craftingSchematics : array<name>; + /// + /// + /// private saved var alchemyRecipes : array<name>; [rest of string was truncated]";. + /// + internal static string playerWitcherWs { + get { + return ResourceManager.GetString("playerWitcherWs", resourceCulture); + } + } + } +} diff --git a/Artemis/Artemis/Properties/Resources.resx b/Artemis/Artemis/Properties/Resources.resx index 3dd1d8537..1fa4c4c83 100644 --- a/Artemis/Artemis/Properties/Resources.resx +++ b/Artemis/Artemis/Properties/Resources.resx @@ -1,133 +1,139 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\resources\witcher3\artemis.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - - ..\Resources\bow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\resources\counterstrike\gamestateconfiguration.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - - ..\resources\witcher3\playerwitcher.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\resources\witcher3\artemis.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + + ..\Resources\bow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\resources\counterstrike\gamestateconfiguration.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + + ..\Resources\logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\logo-disabled.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\resources\witcher3\playerwitcher.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16 + \ No newline at end of file diff --git a/Artemis/Artemis/logo-disabled.ico b/Artemis/Artemis/Resources/logo-disabled.ico similarity index 100% rename from Artemis/Artemis/logo-disabled.ico rename to Artemis/Artemis/Resources/logo-disabled.ico diff --git a/Artemis/Artemis/Resources/logo.ico b/Artemis/Artemis/Resources/logo.ico new file mode 100644 index 000000000..e3f35618e Binary files /dev/null and b/Artemis/Artemis/Resources/logo.ico differ diff --git a/Artemis/Artemis/Settings/General.Designer.cs b/Artemis/Artemis/Settings/General.Designer.cs index 93f796c4e..57222230f 100644 --- a/Artemis/Artemis/Settings/General.Designer.cs +++ b/Artemis/Artemis/Settings/General.Designer.cs @@ -73,7 +73,7 @@ namespace Artemis.Settings { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] + [global::System.Configuration.DefaultSettingValueAttribute("False")] public bool Autorun { get { return ((bool)(this["Autorun"])); diff --git a/Artemis/Artemis/Settings/General.settings b/Artemis/Artemis/Settings/General.settings index 975d221fa..3d397307b 100644 --- a/Artemis/Artemis/Settings/General.settings +++ b/Artemis/Artemis/Settings/General.settings @@ -15,7 +15,7 @@ 51364 - True + False False diff --git a/Artemis/Artemis/Utilities/GameState/GameStateWebServer.cs b/Artemis/Artemis/Utilities/GameState/GameStateWebServer.cs index e2f574d0d..1dbcf3855 100644 --- a/Artemis/Artemis/Utilities/GameState/GameStateWebServer.cs +++ b/Artemis/Artemis/Utilities/GameState/GameStateWebServer.cs @@ -1,7 +1,9 @@ -using System.IO; +using System; +using System.IO; using System.Net; using System.Text; using System.Threading; +using System.Windows.Forms; using Artemis.Settings; using Newtonsoft.Json; @@ -29,11 +31,18 @@ namespace Artemis.Utilities.GameState if (Running) return; - _listener.Prefixes.Clear(); - Port = General.Default.GamestatePort; - _listener.Prefixes.Add($"http://localhost:{Port}/"); - - _listener.Start(); + try + { + _listener.Prefixes.Clear(); + Port = General.Default.GamestatePort; + _listener.Prefixes.Add($"http://localhost:{Port}/"); + + _listener.Start(); + } + catch (Exception) + { + MessageBox.Show("Couldn't start the webserver. CS:GO effect won't work :c \n\nTry changing the port in Settings and restart Artemis."); + } ThreadPool.QueueUserWorkItem(o => { diff --git a/Artemis/Artemis/Utilities/Keyboard/KeyboardHook.cs b/Artemis/Artemis/Utilities/Keyboard/KeyboardHook.cs index 3a59e7071..ddac34a73 100644 --- a/Artemis/Artemis/Utilities/Keyboard/KeyboardHook.cs +++ b/Artemis/Artemis/Utilities/Keyboard/KeyboardHook.cs @@ -1,34 +1,24 @@ -using System.Windows.Forms; -using Gma.System.MouseKeyHook; +using System.Threading.Tasks; +using System.Windows.Forms; +using VirtualInput; namespace Artemis.Utilities.Keyboard { public class KeyboardHook { - private IKeyboardMouseEvents _mGlobalHook; - public int Subscriptions { get; set; } + public delegate void KeyDownCallbackHandler(KeyEventArgs e); - public void Subscribe(KeyEventHandler handleKeypress) + public KeyboardHook() { - if (_mGlobalHook == null) - _mGlobalHook = Hook.GlobalEvents(); - - _mGlobalHook.KeyDown += handleKeypress; - Subscriptions++; + VirtualKeyboard.KeyDown += VirtualKeyboardOnKeyDown; + VirtualKeyboard.StartInterceptor(); } - public void Unsubscribe(KeyEventHandler handleKeypress) + private void VirtualKeyboardOnKeyDown(object sender, KeyEventArgs keyEventArgs) { - if (_mGlobalHook == null) - return; - - _mGlobalHook.KeyDown -= handleKeypress; - Subscriptions--; - - if (Subscriptions >= 1) - return; - _mGlobalHook.Dispose(); - _mGlobalHook = null; + Task.Factory.StartNew(() => { KeyDownCallback?.Invoke(keyEventArgs); }); } + + public event KeyDownCallbackHandler KeyDownCallback; } } \ No newline at end of file diff --git a/Artemis/Artemis/Utilities/Updater.cs b/Artemis/Artemis/Utilities/Updater.cs index 6fc81facb..fd3703a58 100644 --- a/Artemis/Artemis/Utilities/Updater.cs +++ b/Artemis/Artemis/Utilities/Updater.cs @@ -4,7 +4,6 @@ using System.Diagnostics; using System.Linq; using System.Net; using System.Threading.Tasks; -using Artemis.Models; using Artemis.Services; using Artemis.Settings; using Artemis.Utilities.Memory; @@ -15,7 +14,7 @@ namespace Artemis.Utilities { public static class Updater { - public static int CurrentVersion = 100; + public static int CurrentVersion = 102; public static async Task CheckForUpdate(MetroDialogService dialogService) { diff --git a/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs b/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs index 415c579a9..1b9bc164d 100644 --- a/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs +++ b/Artemis/Artemis/ViewModels/SystemTrayViewModel.cs @@ -1,6 +1,7 @@ using System; using System.Windows; using Artemis.Events; +using Artemis.Properties; using Artemis.Settings; using Artemis.Utilities; using Caliburn.Micro; @@ -12,6 +13,7 @@ namespace Artemis.ViewModels private readonly ShellViewModel _shellViewModel; private readonly IWindowManager _windowManager; + private string _activeIcon; private bool _checkedForUpdate; private bool _enabled; private string _toggleText; @@ -23,6 +25,7 @@ namespace Artemis.ViewModels _shellViewModel.MainManager.Events.Subscribe(this); _shellViewModel.MainManager.EnableProgram(); _checkedForUpdate = false; + //ActiveIcon = "../logo.ico"; if (General.Default.ShowOnStartup) ShowWindow(); @@ -41,10 +44,21 @@ namespace Artemis.ViewModels _enabled = value; ToggleText = _enabled ? "Disable Artemis" : "Enable Artemis"; + ActiveIcon = _enabled ? "../Resources/logo.ico" : "../Resources/logo-disabled.ico"; NotifyOfPropertyChange(() => Enabled); } } + public string ActiveIcon + { + get { return _activeIcon; } + set + { + _activeIcon = value; + NotifyOfPropertyChange(); + } + } + public string ToggleText { get { return _toggleText; } diff --git a/Artemis/Artemis/Views/ShellView.xaml b/Artemis/Artemis/Views/ShellView.xaml index 8dd081451..29ff90142 100644 --- a/Artemis/Artemis/Views/ShellView.xaml +++ b/Artemis/Artemis/Views/ShellView.xaml @@ -10,7 +10,7 @@ mc:Ignorable="d" Title="Artemis" Height="670" Width="690" MinWidth="500" MinHeight="400" - GlowBrush="{DynamicResource AccentColorBrush}" Icon="/Artemis;component/logo.ico"> + GlowBrush="{DynamicResource AccentColorBrush}" Icon="../logo.ico"> diff --git a/Artemis/Artemis/Views/SystemTrayView.xaml b/Artemis/Artemis/Views/SystemTrayView.xaml index f201f393f..b6b877020 100644 --- a/Artemis/Artemis/Views/SystemTrayView.xaml +++ b/Artemis/Artemis/Views/SystemTrayView.xaml @@ -24,7 +24,7 @@ diff --git a/Artemis/Artemis/packages.config b/Artemis/Artemis/packages.config index 1a670ab2d..38ab08916 100644 --- a/Artemis/Artemis/packages.config +++ b/Artemis/Artemis/packages.config @@ -1,5 +1,4 @@  - @@ -12,8 +11,8 @@ - + \ No newline at end of file