1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Fixed that 'merge' >_<

This commit is contained in:
SpoinkyNL 2016-03-07 17:39:24 +01:00
parent 27660176a4
commit ef9af2cd83
55 changed files with 907 additions and 6776 deletions

View File

@ -199,7 +199,7 @@
<value>TypeWave</value> <value>TypeWave</value>
</setting> </setting>
<setting name="LastKeyboard" serializeAs="String"> <setting name="LastKeyboard" serializeAs="String">
<value>Logitech G910 RGB</value> <value />
</setting> </setting>
<setting name="EnablePointersUpdate" serializeAs="String"> <setting name="EnablePointersUpdate" serializeAs="String">
<value>True</value> <value>True</value>
@ -208,11 +208,17 @@
<value>51364</value> <value>51364</value>
</setting> </setting>
<setting name="Autorun" serializeAs="String"> <setting name="Autorun" serializeAs="String">
<value>True</value> <value>False</value>
</setting> </setting>
<setting name="Suspended" serializeAs="String"> <setting name="Suspended" serializeAs="String">
<value>False</value> <value>False</value>
</setting> </setting>
<setting name="ShowOnStartup" serializeAs="String">
<value>True</value>
</setting>
<setting name="CheckForUpdates" serializeAs="String">
<value>True</value>
</setting>
</Artemis.Settings.General> </Artemis.Settings.General>
</userSettings> </userSettings>
<runtime> <runtime>

View File

@ -1,14 +1,14 @@
<Application x:Class="Artemis.App" <Application x:Class="Artemis.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Artemis" xmlns:artemis="clr-namespace:Artemis"
DispatcherUnhandledException="Application_DispatcherUnhandledException" DispatcherUnhandledException="Application_DispatcherUnhandledException"
ShutdownMode="OnExplicitShutdown"> ShutdownMode="OnExplicitShutdown">
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary> <ResourceDictionary>
<local:ArtemisBootstrapper x:Key="ArtemisBootstrapper" /> <artemis:ArtemisBootstrapper x:Key="ArtemisBootstrapper" />
</ResourceDictionary> </ResourceDictionary>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! --> <!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" /> <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />

View File

@ -16,8 +16,8 @@ namespace Artemis.KeyboardProviders.Corsair
public CorsairRGB() public CorsairRGB()
{ {
Name = "Corsair RGB Keyboards"; Name = "Corsair RGB Keyboards";
CantEnableText = "Couldn't connect to your Corsair keyboard.\n " + 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 " + "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."; "If needed, you can select a different keyboard in Artemis under settings.";
KeyboardRegions = new List<KeyboardRegion>(); KeyboardRegions = new List<KeyboardRegion>();
} }
@ -103,7 +103,6 @@ namespace Artemis.KeyboardProviders.Corsair
/// <summary> /// <summary>
/// Properly resizes any size bitmap to the keyboard by creating a rectangle whose size is dependent on the bitmap /// Properly resizes any size bitmap to the keyboard by creating a rectangle whose size is dependent on the bitmap
/// size. /// size.
/// Does not reset the color each time. Uncomment line 48 for collor reset.
/// </summary> /// </summary>
/// <param name="bitmap"></param> /// <param name="bitmap"></param>
public override void DrawBitmap(Bitmap bitmap) public override void DrawBitmap(Bitmap bitmap)

View File

@ -1,7 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Threading; using System.Threading;
using System.Windows.Forms;
using Artemis.KeyboardProviders.Logitech.Utilities; using Artemis.KeyboardProviders.Logitech.Utilities;
namespace Artemis.KeyboardProviders.Logitech namespace Artemis.KeyboardProviders.Logitech

View File

@ -10,8 +10,10 @@ namespace Artemis.Managers
{ {
public class EffectManager public class EffectManager
{ {
private readonly MainManager _mainManager;
private readonly IEventAggregator _events; private readonly IEventAggregator _events;
private readonly MainManager _mainManager;
private bool _clearing;
private EffectModel _pauseEffect;
public EffectManager(MainManager mainManager, IEventAggregator events) public EffectManager(MainManager mainManager, IEventAggregator events)
{ {
@ -23,7 +25,6 @@ namespace Artemis.Managers
public List<EffectModel> EffectModels { get; set; } public List<EffectModel> EffectModels { get; set; }
public EffectModel ActiveEffect { get; private set; } public EffectModel ActiveEffect { get; private set; }
public EffectModel PauseEffect { get; private set; }
public IEnumerable<OverlayModel> EnabledOverlays public IEnumerable<OverlayModel> EnabledOverlays
{ {
@ -83,27 +84,27 @@ namespace Artemis.Managers
private void ChangeEffectWithPause(EffectModel effectModel) private void ChangeEffectWithPause(EffectModel effectModel)
{ {
if (PauseEffect != null) if (_pauseEffect != null)
return; return;
PauseEffect = effectModel; _pauseEffect = effectModel;
_mainManager.Pause(); _mainManager.Pause();
_mainManager.PauseCallback += MainManagerOnPauseCallback; _mainManager.PauseCallback += ChangeEffectPauseCallback;
} }
private void MainManagerOnPauseCallback() private void ChangeEffectPauseCallback()
{ {
// Change effect logic // Change effect logic
ActiveEffect?.Dispose(); ActiveEffect?.Dispose();
ActiveEffect = PauseEffect; ActiveEffect = _pauseEffect;
ActiveEffect.Enable(); ActiveEffect.Enable();
// Let the ViewModels know // Let the ViewModels know
_events.PublishOnUIThread(new ActiveEffectChanged(ActiveEffect.Name)); _events.PublishOnUIThread(new ActiveEffectChanged(ActiveEffect.Name));
PauseEffect = null;
_mainManager.Unpause(); _mainManager.Unpause();
_pauseEffect = null;
if (ActiveEffect is GameModel) if (ActiveEffect is GameModel)
return; return;
@ -118,18 +119,34 @@ namespace Artemis.Managers
/// </summary> /// </summary>
public void ClearEffect() public void ClearEffect()
{ {
if (_clearing)
return;
// Don't mess with the ActiveEffect if in the process of changing the effect. // Don't mess with the ActiveEffect if in the process of changing the effect.
if (PauseEffect != null) if (_pauseEffect != null)
return; return;
if (ActiveEffect == null) if (ActiveEffect == null)
return; return;
_clearing = true;
_mainManager.Pause();
_mainManager.PauseCallback += ClearEffectPauseCallback;
}
private void ClearEffectPauseCallback()
{
ActiveEffect.Dispose(); ActiveEffect.Dispose();
ActiveEffect = null; ActiveEffect = null;
General.Default.LastEffect = null; General.Default.LastEffect = null;
General.Default.Save(); General.Default.Save();
_events.PublishOnUIThread(new ActiveEffectChanged(""));
_clearing = false;
_mainManager.Unpause();
} }
/// <summary> /// <summary>

View File

@ -19,29 +19,40 @@ namespace Artemis.Managers
public List<KeyboardProvider> KeyboardProviders { get; set; } public List<KeyboardProvider> KeyboardProviders { get; set; }
public KeyboardProvider ActiveKeyboard { get; set; } public KeyboardProvider ActiveKeyboard { get; set; }
public bool LoadLastKeyboard() /// <summary>
/// Enables the last keyboard according to the settings file
/// </summary>
public void EnableLastKeyboard()
{ {
if (General.Default.LastKeyboard == null)
return;
if (General.Default.LastKeyboard == "")
return;
var keyboard = KeyboardProviders.FirstOrDefault(k => k.Name == General.Default.LastKeyboard); var keyboard = KeyboardProviders.FirstOrDefault(k => k.Name == General.Default.LastKeyboard);
return ChangeKeyboard(keyboard ?? KeyboardProviders.First()); EnableKeyboard(keyboard);
} }
public bool ChangeKeyboard(KeyboardProvider keyboardProvider) /// <summary>
/// Enables the given keyboard
/// </summary>
/// <param name="keyboardProvider"></param>
public void EnableKeyboard(KeyboardProvider keyboardProvider)
{ {
ReleaseActiveKeyboard();
if (keyboardProvider == null) if (keyboardProvider == null)
return false; return;
if (ActiveKeyboard != null) if (ActiveKeyboard != null)
if (keyboardProvider.Name == ActiveKeyboard.Name) if (keyboardProvider.Name == ActiveKeyboard.Name)
return true; return;
ReleaseActiveKeyboard();
// Disable everything if there's no active keyboard found // Disable everything if there's no active keyboard found
if (!keyboardProvider.CanEnable()) if (!keyboardProvider.CanEnable())
{ {
MessageBox.Show(keyboardProvider.CantEnableText, "Artemis (╯°□°)╯︵ ┻━┻", MessageBoxButtons.OK, _mainManager.DialogService.ShowErrorMessageBox(keyboardProvider.CantEnableText);
MessageBoxIcon.Warning); return;
return false;
} }
ActiveKeyboard = keyboardProvider; ActiveKeyboard = keyboardProvider;
@ -49,10 +60,11 @@ namespace Artemis.Managers
General.Default.LastKeyboard = ActiveKeyboard.Name; General.Default.LastKeyboard = ActiveKeyboard.Name;
General.Default.Save(); General.Default.Save();
return true;
} }
/// <summary>
/// Releases the active keyboard
/// </summary>
public void ReleaseActiveKeyboard() public void ReleaseActiveKeyboard()
{ {
if (ActiveKeyboard == null) if (ActiveKeyboard == null)
@ -61,5 +73,20 @@ namespace Artemis.Managers
ActiveKeyboard.Disable(); ActiveKeyboard.Disable();
ActiveKeyboard = null; ActiveKeyboard = null;
} }
/// <summary>
/// Changes the active keyboard
/// </summary>
/// <param name="keyboardProvider"></param>
public void ChangeKeyboard(KeyboardProvider keyboardProvider)
{
if (keyboardProvider == ActiveKeyboard)
return;
General.Default.LastKeyboard = keyboardProvider?.Name;
General.Default.Save();
_mainManager.Restart();
}
} }
} }

View File

@ -2,9 +2,9 @@
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Windows.Forms;
using Artemis.Events; using Artemis.Events;
using Artemis.Models; using Artemis.Models;
using Artemis.Services;
using Artemis.Utilities.GameState; using Artemis.Utilities.GameState;
using Artemis.Utilities.Keyboard; using Artemis.Utilities.Keyboard;
using Caliburn.Micro; using Caliburn.Micro;
@ -17,10 +17,12 @@ namespace Artemis.Managers
private readonly int _fps; private readonly int _fps;
private bool _paused; private bool _paused;
private bool _restarting;
public MainManager(IEventAggregator events) public MainManager(IEventAggregator events, MetroDialogService dialogService)
{ {
Events = events; Events = events;
DialogService = dialogService;
KeyboardManager = new KeyboardManager(this); KeyboardManager = new KeyboardManager(this);
EffectManager = new EffectManager(this, Events); EffectManager = new EffectManager(this, Events);
@ -28,7 +30,7 @@ namespace Artemis.Managers
_fps = 25; _fps = 25;
UpdateWorker = new BackgroundWorker {WorkerSupportsCancellation = true}; UpdateWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
ProcessWorker = new BackgroundWorker { WorkerSupportsCancellation = true }; ProcessWorker = new BackgroundWorker {WorkerSupportsCancellation = true};
UpdateWorker.DoWork += UpdateWorker_DoWork; UpdateWorker.DoWork += UpdateWorker_DoWork;
UpdateWorker.RunWorkerCompleted += BackgroundWorkerExceptionCatcher; UpdateWorker.RunWorkerCompleted += BackgroundWorkerExceptionCatcher;
@ -57,6 +59,7 @@ namespace Artemis.Managers
public GameStateWebServer GameStateWebServer { get; set; } public GameStateWebServer GameStateWebServer { get; set; }
public IEventAggregator Events { get; set; } public IEventAggregator Events { get; set; }
public MetroDialogService DialogService { get; set; }
public bool ProgramEnabled { get; private set; } public bool ProgramEnabled { get; private set; }
public bool Suspended { get; set; } public bool Suspended { get; set; }
@ -79,7 +82,8 @@ namespace Artemis.Managers
return true; return true;
// Only continue if a keyboard was loaded // Only continue if a keyboard was loaded
if (!KeyboardManager.LoadLastKeyboard()) KeyboardManager.EnableLastKeyboard();
if (KeyboardManager.ActiveKeyboard == null)
return false; return false;
Running = true; Running = true;
@ -129,6 +133,41 @@ namespace Artemis.Managers
PauseCallback = null; PauseCallback = null;
} }
public void Shutdown()
{
Stop();
ProcessWorker.CancelAsync();
GameStateWebServer.Stop();
}
public void Restart()
{
if (_restarting)
return;
if (!Running)
{
Start();
return;
}
_restarting = true;
UpdateWorker.RunWorkerCompleted += FinishRestart;
Stop();
}
public void FinishRestart(object sender, RunWorkerCompletedEventArgs e)
{
UpdateWorker.RunWorkerCompleted -= FinishRestart;
if (e.Error != null)
return;
Start();
_restarting = false;
}
/// <summary> /// <summary>
/// Loads the last active effect and starts the program /// Loads the last active effect and starts the program
/// </summary> /// </summary>
@ -255,12 +294,5 @@ namespace Artemis.Managers
} }
#endregion #endregion
public void Shutdown()
{
Stop();
ProcessWorker.CancelAsync();
GameStateWebServer.Stop();
}
} }
} }

View File

@ -8,9 +8,10 @@ namespace Artemis.Models
{ {
public delegate void SettingsUpdateHandler(EffectSettings settings); public delegate void SettingsUpdateHandler(EffectSettings settings);
public bool Initialized;
public MainManager MainManager; public MainManager MainManager;
public string Name; public string Name;
public bool Initialized;
protected EffectModel(MainManager mainManager) protected EffectModel(MainManager mainManager)
{ {

View File

@ -17,10 +17,10 @@ namespace Artemis.Modules.Effects.AudioVisualizer
{ {
private const int FftLength = 2048; private const int FftLength = 2048;
private readonly SampleAggregator _sampleAggregator = new SampleAggregator(FftLength); private readonly SampleAggregator _sampleAggregator = new SampleAggregator(FftLength);
private bool _generating;
private IWaveIn _waveIn;
private int _sensitivity;
private bool _fromBottom; private bool _fromBottom;
private bool _generating;
private int _sensitivity;
private IWaveIn _waveIn;
public AudioVisualizerModel(MainManager mainManager, AudioVisualizerSettings settings) : base(mainManager) public AudioVisualizerModel(MainManager mainManager, AudioVisualizerSettings settings) : base(mainManager)
{ {
@ -118,7 +118,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
height = (int) Math.Round(SpectrumData[i]/2.55); height = (int) Math.Round(SpectrumData[i]/2.55);
// Apply Sensitivity setting // Apply Sensitivity setting
height = height* _sensitivity; height = height*_sensitivity;
var keyboardHeight = var keyboardHeight =
(int) Math.Round(MainManager.KeyboardManager.ActiveKeyboard.Height/100.00*height*Scale); (int) Math.Round(MainManager.KeyboardManager.ActiveKeyboard.Height/100.00*height*Scale);
if (keyboardHeight > SoundRectangles[i].Height) if (keyboardHeight > SoundRectangles[i].Height)

View File

@ -38,7 +38,7 @@
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25" <ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
Style="{DynamicResource MetroCircleToggleButtonStyle}" Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" cal:Message.Attach="[Event Click] = [Action ToggleEffect]"
ToolTip="Note: You can't enable an effect when Artemis is disabled"/> ToolTip="Note: You can't enable an effect when Artemis is disabled" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
<!-- Top color --> <!-- Top color -->

View File

@ -18,7 +18,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
// Create effect model and add it to MainManager // Create effect model and add it to MainManager
EffectModel = new AudioVisualizerModel(mainManager, (AudioVisualizerSettings) EffectSettings); EffectModel = new AudioVisualizerModel(mainManager, (AudioVisualizerSettings) EffectSettings);
MainManager.EffectManager.EffectModels.Add((AudioVisualizerModel) EffectModel); MainManager.EffectManager.EffectModels.Add(EffectModel);
} }
public static string Name => "Audio Visualizer"; public static string Name => "Audio Visualizer";

View File

@ -37,7 +37,7 @@
Style="{DynamicResource MetroCircleToggleButtonStyle}" Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" cal:Message.Attach="[Event Click] = [Action ToggleEffect]"
ToolTip="Note: You can't enable an effect when Artemis is disabled" ToolTip="Note: You can't enable an effect when Artemis is disabled"
ToolTipService.ShowOnDisabled="True"/> ToolTipService.ShowOnDisabled="True" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>

View File

@ -27,7 +27,7 @@ namespace Artemis.Modules.Effects.Debug
// Create effect model and add it to MainManager // Create effect model and add it to MainManager
EffectModel = new DebugEffectModel(mainManager, (DebugEffectSettings) EffectSettings); EffectModel = new DebugEffectModel(mainManager, (DebugEffectSettings) EffectSettings);
MainManager.EffectManager.EffectModels.Add((DebugEffectModel) EffectModel); MainManager.EffectManager.EffectModels.Add(EffectModel);
} }

View File

@ -37,7 +37,8 @@
IsOpen="{Binding Path=ShowDisabledPopup, Mode=TwoWay}" Placement="Left" VerticalOffset="-10" IsOpen="{Binding Path=ShowDisabledPopup, Mode=TwoWay}" Placement="Left" VerticalOffset="-10"
PopupAnimation="Fade" StaysOpen="False"> PopupAnimation="Fade" StaysOpen="False">
<Border Margin="1"> <Border Margin="1">
<TextBlock Background="{DynamicResource AccentColorBrush}" Foreground="{DynamicResource IdealForegroundColorBrush}" <TextBlock Background="{DynamicResource AccentColorBrush}"
Foreground="{DynamicResource IdealForegroundColorBrush}"
Text="You can't enable an effect when Artemis is disabled" Padding="4" /> Text="You can't enable an effect when Artemis is disabled" Padding="4" />
</Border> </Border>
</Popup> </Popup>

View File

@ -15,7 +15,7 @@ namespace Artemis.Modules.Effects.TypeHole
// Create effect model and add it to MainManager // Create effect model and add it to MainManager
EffectModel = new TypeHoleModel(mainManager); EffectModel = new TypeHoleModel(mainManager);
MainManager.EffectManager.EffectModels.Add((TypeHoleModel) EffectModel); MainManager.EffectManager.EffectModels.Add(EffectModel);
} }
public static string Name => "Type Holes (NYI)"; public static string Name => "Type Holes (NYI)";

View File

@ -2,7 +2,6 @@
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Artemis.KeyboardProviders.Corsair; using Artemis.KeyboardProviders.Corsair;
using Artemis.KeyboardProviders.Logitech.Utilities; using Artemis.KeyboardProviders.Logitech.Utilities;
@ -24,14 +23,33 @@ namespace Artemis.Modules.Effects.TypeWave
_randomColor = Color.Red; _randomColor = Color.Red;
Settings = settings; Settings = settings;
Initialized = false; Initialized = false;
Scale = 4;
} }
public int Scale { get; set; }
public TypeWaveSettings Settings { get; set; } public TypeWaveSettings Settings { get; set; }
public override void Dispose() public override void Dispose()
{ {
Initialized = false; 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() public override void Enable()
@ -39,7 +57,7 @@ namespace Artemis.Modules.Effects.TypeWave
Initialized = false; Initialized = false;
// Listener won't start unless the effect is active // Listener won't start unless the effect is active
MainManager.KeyboardHook.Subscribe(HandleKeypress); MainManager.KeyboardHook.KeyDownCallback += KeyboardHookOnKeyDownCallback;
Initialized = true; Initialized = true;
} }
@ -54,7 +72,7 @@ namespace Artemis.Modules.Effects.TypeWave
// TODO: Get from settings // TODO: Get from settings
var fps = 25; var fps = 25;
_waves[i].Size += Settings.SpreadSpeed; _waves[i].Size += Settings.SpreadSpeed * Scale;
if (Settings.IsShiftColors) if (Settings.IsShiftColors)
_waves[i].Color = ColorHelpers.ShiftColor(_waves[i].Color, Settings.ShiftColorSpeed); _waves[i].Color = ColorHelpers.ShiftColor(_waves[i].Color, Settings.ShiftColorSpeed);
@ -78,7 +96,7 @@ namespace Artemis.Modules.Effects.TypeWave
if (_waves.Count == 0) if (_waves.Count == 0)
return null; return null;
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(); var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
using (var g = Graphics.FromImage(bitmap)) using (var g = Graphics.FromImage(bitmap))
{ {
g.Clear(Color.Transparent); g.Clear(Color.Transparent);
@ -116,27 +134,6 @@ namespace Artemis.Modules.Effects.TypeWave
} }
return bitmap; 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 public class Wave

View File

@ -40,7 +40,8 @@
IsOpen="{Binding Path=ShowDisabledPopup, Mode=TwoWay}" Placement="Left" VerticalOffset="-10" IsOpen="{Binding Path=ShowDisabledPopup, Mode=TwoWay}" Placement="Left" VerticalOffset="-10"
PopupAnimation="Fade" StaysOpen="False"> PopupAnimation="Fade" StaysOpen="False">
<Border Margin="1"> <Border Margin="1">
<TextBlock Background="{DynamicResource AccentColorBrush}" Foreground="{DynamicResource IdealForegroundColorBrush}" <TextBlock Background="{DynamicResource AccentColorBrush}"
Foreground="{DynamicResource IdealForegroundColorBrush}"
Text="You can't enable an effect when Artemis is disabled" Padding="4" /> Text="You can't enable an effect when Artemis is disabled" Padding="4" />
</Border> </Border>
</Popup> </Popup>

View File

@ -18,7 +18,7 @@ namespace Artemis.Modules.Effects.TypeWave
// Create effect model and add it to MainManager // Create effect model and add it to MainManager
EffectModel = new TypeWaveModel(mainManager, (TypeWaveSettings) EffectSettings); EffectModel = new TypeWaveModel(mainManager, (TypeWaveSettings) EffectSettings);
MainManager.EffectManager.EffectModels.Add((TypeWaveModel) EffectModel); MainManager.EffectManager.EffectModels.Add(EffectModel);
} }
public static string Name => "Type Waves"; public static string Name => "Type Waves";

View File

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.CounterStrike" GeneratedClassName="CounterStrike">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Games.CounterStrike" GeneratedClassName="CounterStrike">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User"> <Setting Name="Enabled" Type="System.Boolean" Scope="User">

View File

@ -3,14 +3,13 @@ using Artemis.Models;
namespace Artemis.Modules.Games.CounterStrike namespace Artemis.Modules.Games.CounterStrike
{ {
public class CounterStrikeSettings : EffectSettings public class CounterStrikeSettings : GameSettings
{ {
public CounterStrikeSettings() public CounterStrikeSettings()
{ {
Load(); Load();
} }
public bool Enabled { get; set; }
public string GameDirectory { get; set; } public string GameDirectory { get; set; }
public bool AmmoEnabled { get; set; } public bool AmmoEnabled { get; set; }

View File

@ -37,7 +37,7 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" /> <Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25" <ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
IsChecked="{Binding Path=CounterStrikeSettings.Enabled, Mode=TwoWay}" IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
Style="{DynamicResource MetroCircleToggleButtonStyle}" Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" /> cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
</StackPanel> </StackPanel>
@ -50,7 +50,7 @@
Width="130" HorizontalAlignment="Left" /> Width="130" HorizontalAlignment="Left" />
<Grid> <Grid>
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0" <TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
Text="{Binding Path=CounterStrikeSettings.GameDirectory, Mode=TwoWay}" Text="{Binding Path=GameSettings.GameDirectory, Mode=TwoWay}"
cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" /> cal:Message.Attach="[Event LostFocus] = [Action PlaceConfigFile]" />
<Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944" <Button x:Name="BrowseDirectory" Content="..." RenderTransformOrigin="-0.039,-0.944"
HorizontalAlignment="Right" Width="25" HorizontalAlignment="Right" Width="25"
@ -63,7 +63,7 @@
Height="16" Margin="0,10,0,9"> Height="16" Margin="0,10,0,9">
Display ammo on F-keys Display ammo on F-keys
</TextBlock> </TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.AmmoEnabled, Mode=TwoWay}" <controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.AmmoEnabled, Mode=TwoWay}"
Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
Margin="0,0,-5,0" Width="114" /> Margin="0,0,-5,0" Width="114" />
@ -73,7 +73,7 @@
Main ammo color Main ammo color
</TextBlock> </TextBlock>
<xctk:ColorPicker x:Name="MainColor" <xctk:ColorPicker x:Name="MainColor"
SelectedColor="{Binding Path=CounterStrikeSettings.AmmoMainColor, Mode=TwoWay}" SelectedColor="{Binding Path=GameSettings.AmmoMainColor, Mode=TwoWay}"
Grid.Row="3" Grid.Column="1" Width="110" HorizontalAlignment="Right" Grid.Row="3" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" /> VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
@ -83,7 +83,7 @@
Secondary ammo color Secondary ammo color
</TextBlock> </TextBlock>
<xctk:ColorPicker x:Name="SecondaryColor" <xctk:ColorPicker x:Name="SecondaryColor"
SelectedColor="{Binding Path=CounterStrikeSettings.AmmoSecondaryColor, Mode=TwoWay}" SelectedColor="{Binding Path=GameSettings.AmmoSecondaryColor, Mode=TwoWay}"
Grid.Row="4" Grid.Column="1" Width="110" HorizontalAlignment="Right" Grid.Row="4" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" /> VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
@ -92,7 +92,7 @@
Height="16" Margin="0,9,0,10"> Height="16" Margin="0,9,0,10">
Display smoked effect Display smoked effect
</TextBlock> </TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.SmokeEnabled, Mode=TwoWay}" <controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.SmokeEnabled, Mode=TwoWay}"
Grid.Row="5" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No" Grid.Row="5" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
Margin="0,0,-5,0" Width="114" /> Margin="0,0,-5,0" Width="114" />
@ -101,7 +101,7 @@
Height="16" Margin="0,10,0,9"> Height="16" Margin="0,10,0,9">
Display flashed effect Display flashed effect
</TextBlock> </TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.FlashEnabled, Mode=TwoWay}" <controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.FlashEnabled, Mode=TwoWay}"
Grid.Row="6" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No" Grid.Row="6" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
Margin="0,0,-5,0" Width="114" /> Margin="0,0,-5,0" Width="114" />
@ -110,7 +110,7 @@
Height="16" Margin="0,9,0,10"> Height="16" Margin="0,9,0,10">
Color keyboard according to team Color keyboard according to team
</TextBlock> </TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.TeamColorEnabled, Mode=TwoWay}" <controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.TeamColorEnabled, Mode=TwoWay}"
Grid.Row="7" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No" Grid.Row="7" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
Margin="0,0,-5,0" Width="114" /> Margin="0,0,-5,0" Width="114" />
@ -119,7 +119,7 @@
Height="16" Margin="0,10,0,9"> Height="16" Margin="0,10,0,9">
Color keyboard red on low HP Color keyboard red on low HP
</TextBlock> </TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=CounterStrikeSettings.LowHpEnabled, Mode=TwoWay}" <controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.LowHpEnabled, Mode=TwoWay}"
Grid.Row="8" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No" Grid.Row="8" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
Margin="0,0,-5,0" Width="114" /> Margin="0,0,-5,0" Width="114" />

View File

@ -2,92 +2,63 @@
using System.Windows.Forms; using System.Windows.Forms;
using Artemis.Managers; using Artemis.Managers;
using Artemis.Properties; using Artemis.Properties;
using Screen = Caliburn.Micro.Screen; using Artemis.ViewModels.Abstract;
namespace Artemis.Modules.Games.CounterStrike namespace Artemis.Modules.Games.CounterStrike
{ {
public class CounterStrikeViewModel : Screen public class CounterStrikeViewModel : GameViewModel
{ {
private CounterStrikeSettings _counterStrikeSettings;
public CounterStrikeViewModel(MainManager mainManager) public CounterStrikeViewModel(MainManager mainManager)
{ {
MainManager = mainManager; MainManager = mainManager;
// Settings are loaded from file by class // Settings are loaded from file by class
CounterStrikeSettings = new CounterStrikeSettings(); GameSettings = new CounterStrikeSettings();
// Create effect model and add it to MainManager // Create effect model and add it to MainManager
CounterStrikeModel = new CounterStrikeModel(mainManager, CounterStrikeSettings); GameModel = new CounterStrikeModel(mainManager, (CounterStrikeSettings) GameSettings);
MainManager.EffectManager.EffectModels.Add(CounterStrikeModel); MainManager.EffectManager.EffectModels.Add(GameModel);
PlaceConfigFile(); PlaceConfigFile();
} }
public CounterStrikeSettings CounterStrikeSettings
{
get { return _counterStrikeSettings; }
set
{
if (Equals(value, _counterStrikeSettings)) return;
_counterStrikeSettings = value;
NotifyOfPropertyChange(() => CounterStrikeSettings);
}
}
public CounterStrikeModel CounterStrikeModel { get; set; }
public MainManager MainManager { get; set; }
public static string Name => "CS:GO"; public static string Name => "CS:GO";
public string Content => "Counter-Strike: GO Content"; public string Content => "Counter-Strike: GO Content";
public void SaveSettings()
{
CounterStrikeSettings?.Save();
}
public void ResetSettings()
{
// TODO: Confirmation dialog (Generic MVVM approach)
CounterStrikeSettings.ToDefault();
NotifyOfPropertyChange(() => CounterStrikeSettings);
SaveSettings();
}
public void ToggleEffect()
{
CounterStrikeModel.Enabled = _counterStrikeSettings.Enabled;
}
public void BrowseDirectory() public void BrowseDirectory()
{ {
var dialog = new FolderBrowserDialog {SelectedPath = CounterStrikeSettings.GameDirectory}; var dialog = new FolderBrowserDialog {SelectedPath = ((CounterStrikeSettings) GameSettings).GameDirectory};
var result = dialog.ShowDialog(); var result = dialog.ShowDialog();
if (result != DialogResult.OK) if (result != DialogResult.OK)
return; return;
CounterStrikeSettings.GameDirectory = dialog.SelectedPath; ((CounterStrikeSettings) GameSettings).GameDirectory = dialog.SelectedPath;
NotifyOfPropertyChange(() => CounterStrikeSettings); NotifyOfPropertyChange(() => GameSettings);
GameSettings.Save();
PlaceConfigFile(); PlaceConfigFile();
} }
public void PlaceConfigFile() public void PlaceConfigFile()
{ {
if (CounterStrikeSettings.GameDirectory == string.Empty) if (((CounterStrikeSettings) GameSettings).GameDirectory == string.Empty)
return; return;
if (Directory.Exists(CounterStrikeSettings.GameDirectory + "/csgo/cfg")) if (Directory.Exists(((CounterStrikeSettings) GameSettings).GameDirectory + "/csgo/cfg"))
{ {
var cfgFile = Resources.gamestateConfiguration.Replace("{{port}}", var cfgFile = Resources.gamestateConfiguration.Replace("{{port}}",
MainManager.GameStateWebServer.Port.ToString()); MainManager.GameStateWebServer.Port.ToString());
File.WriteAllText(CounterStrikeSettings.GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg", File.WriteAllText(
((CounterStrikeSettings) GameSettings).GameDirectory + "/csgo/cfg/gamestate_integration_artemis.cfg",
cfgFile); cfgFile);
return; return;
} }
MessageBox.Show("Please select a valid CS:GO directory"); MainManager.DialogService.ShowErrorMessageBox("Please select a valid CS:GO directory\n\n" +
CounterStrikeSettings.GameDirectory = string.Empty; @"By default CS:GO is in \SteamApps\common\Counter-Strike Global Offensive");
NotifyOfPropertyChange(() => CounterStrikeSettings); ((CounterStrikeSettings) GameSettings).GameDirectory = string.Empty;
NotifyOfPropertyChange(() => GameSettings);
GameSettings.Save();
} }
} }
} }

View File

@ -1,17 +1,15 @@
using Artemis.Managers; using Artemis.Managers;
using Caliburn.Micro; using Artemis.ViewModels.Abstract;
namespace Artemis.Modules.Games.Dota2 namespace Artemis.Modules.Games.Dota2
{ {
public class Dota2ViewModel : Screen public class Dota2ViewModel : GameViewModel
{ {
public Dota2ViewModel(MainManager mainManager) public Dota2ViewModel(MainManager mainManager)
{ {
MainManager = mainManager; MainManager = mainManager;
} }
public MainManager MainManager { get; set; }
public static string Name => "Dota 2 (NYI)"; public static string Name => "Dota 2 (NYI)";
public string Content => "Dota 2 Content"; public string Content => "Dota 2 Content";
} }

View File

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.RocketLeague" GeneratedClassName="RocketLeague">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Games.RocketLeague" GeneratedClassName="RocketLeague">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User"> <Setting Name="Enabled" Type="System.Boolean" Scope="User">

View File

@ -49,6 +49,8 @@ namespace Artemis.Modules.Games.RocketLeague
{ {
Initialized = false; Initialized = false;
_contextualColor = Settings.ContextualColor;
_boostRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color> _boostRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
{ {
ColorHelpers.ToDrawingColor(Settings.MainColor), ColorHelpers.ToDrawingColor(Settings.MainColor),
@ -71,7 +73,6 @@ namespace Artemis.Modules.Games.RocketLeague
if (_memory == null) if (_memory == null)
return; return;
ContextualColor = Settings.ContextualColor;
var offsets = _pointer.GameAddresses.First(ga => ga.Description == "Boost").ToString(); var offsets = _pointer.GameAddresses.First(ga => ga.Description == "Boost").ToString();
var boostAddress = _memory.GetAddress("\"RocketLeague.exe\"" + offsets); var boostAddress = _memory.GetAddress("\"RocketLeague.exe\"" + offsets);
var boostFloat = _memory.ReadFloat(boostAddress)*100/3; var boostFloat = _memory.ReadFloat(boostAddress)*100/3;

View File

@ -3,14 +3,13 @@ using Artemis.Models;
namespace Artemis.Modules.Games.RocketLeague namespace Artemis.Modules.Games.RocketLeague
{ {
public class RocketLeagueSettings : EffectSettings public class RocketLeagueSettings : GameSettings
{ {
public RocketLeagueSettings() public RocketLeagueSettings()
{ {
Load(); Load();
} }
public bool Enabled { get; set; }
public Color MainColor { get; set; } public Color MainColor { get; set; }
public Color SecondaryColor { get; set; } public Color SecondaryColor { get; set; }
public bool ContextualColor { get; set; } public bool ContextualColor { get; set; }

View File

@ -34,7 +34,7 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" /> <Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25" <ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
IsChecked="{Binding Path=RocketLeagueSettings.Enabled, Mode=TwoWay}" IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
Style="{DynamicResource MetroCircleToggleButtonStyle}" Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" /> cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
</StackPanel> </StackPanel>
@ -46,7 +46,7 @@
Main boost display color Main boost display color
</TextBlock> </TextBlock>
<xctk:ColorPicker x:Name="MainColor" <xctk:ColorPicker x:Name="MainColor"
SelectedColor="{Binding Path=RocketLeagueSettings.MainColor, Mode=TwoWay}" SelectedColor="{Binding Path=GameSettings.MainColor, Mode=TwoWay}"
Grid.Row="1" Grid.Column="1" Width="110" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" /> VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
@ -56,7 +56,7 @@
Secondary boost display color Secondary boost display color
</TextBlock> </TextBlock>
<xctk:ColorPicker x:Name="SecondaryColor" <xctk:ColorPicker x:Name="SecondaryColor"
SelectedColor="{Binding Path=RocketLeagueSettings.SecondaryColor, Mode=TwoWay}" SelectedColor="{Binding Path=GameSettings.SecondaryColor, Mode=TwoWay}"
Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" /> VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
@ -65,7 +65,7 @@
Height="16" Margin="0,8"> Height="16" Margin="0,8">
Color bar according to boost amount Color bar according to boost amount
</TextBlock> </TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=RocketLeagueSettings.ContextualColor, Mode=TwoWay}" <controls:ToggleSwitch IsChecked="{Binding Path=GameSettings.ContextualColor, Mode=TwoWay}"
Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
Margin="0,0,-5,0" Width="114" /> Margin="0,0,-5,0" Width="114" />
@ -76,9 +76,10 @@
Tip: To find a color combination you like, start an exhibition match, pickup 100 boost and play around with the colors. Tip: To find a color combination you like, start an exhibition match, pickup 100 boost and play around with the colors.
They'll appear on your keyboard immediately! Once you're satisfied don't forget to click save changes. They'll appear on your keyboard immediately! Once you're satisfied don't forget to click save changes.
</TextBlock> </TextBlock>
<TextBlock x:Name="VersionText" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8" <TextBlock x:Name="VersionText" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center"
Margin="0,8"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold" TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
Foreground="{DynamicResource HighlightBrush}" MaxWidth="510" TextAlignment="Justify"/> Foreground="{DynamicResource HighlightBrush}" MaxWidth="510" TextAlignment="Justify" />
<!-- Buttons --> <!-- Buttons -->
<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom"> <StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" VerticalAlignment="Bottom">

View File

@ -1,16 +1,14 @@
using Artemis.Managers; using Artemis.Managers;
using Artemis.Models;
using Artemis.Settings; using Artemis.Settings;
using Artemis.Utilities; using Artemis.Utilities;
using Artemis.Utilities.Memory; using Artemis.Utilities.Memory;
using Caliburn.Micro; using Artemis.ViewModels.Abstract;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Artemis.Modules.Games.RocketLeague namespace Artemis.Modules.Games.RocketLeague
{ {
public class RocketLeagueViewModel : Screen public class RocketLeagueViewModel : GameViewModel
{ {
private RocketLeagueSettings _rocketLeagueSettings;
private string _versionText; private string _versionText;
public RocketLeagueViewModel(MainManager mainManager) public RocketLeagueViewModel(MainManager mainManager)
@ -18,15 +16,17 @@ namespace Artemis.Modules.Games.RocketLeague
MainManager = mainManager; MainManager = mainManager;
// Settings are loaded from file by class // Settings are loaded from file by class
RocketLeagueSettings = new RocketLeagueSettings(); GameSettings = new RocketLeagueSettings();
// Create effect model and add it to MainManager // Create effect model and add it to MainManager
RocketLeagueModel = new RocketLeagueModel(mainManager, RocketLeagueSettings); GameModel = new RocketLeagueModel(mainManager, (RocketLeagueSettings) GameSettings);
MainManager.EffectManager.EffectModels.Add(RocketLeagueModel); MainManager.EffectManager.EffectModels.Add(GameModel);
SetVersionText(); SetVersionText();
} }
public static string Name => "Rocket League";
public string VersionText public string VersionText
{ {
get { return _versionText; } get { return _versionText; }
@ -38,22 +38,8 @@ namespace Artemis.Modules.Games.RocketLeague
} }
} }
public static string Name => "Rocket League";
public MainManager MainManager { get; set; }
public RocketLeagueModel RocketLeagueModel { get; set; } public RocketLeagueModel RocketLeagueModel { get; set; }
public RocketLeagueSettings RocketLeagueSettings
{
get { return _rocketLeagueSettings; }
set
{
if (Equals(value, _rocketLeagueSettings)) return;
_rocketLeagueSettings = value;
NotifyOfPropertyChange(() => RocketLeagueSettings);
}
}
private void SetVersionText() private void SetVersionText()
{ {
if (!General.Default.EnablePointersUpdate) if (!General.Default.EnablePointersUpdate)
@ -65,32 +51,10 @@ namespace Artemis.Modules.Games.RocketLeague
Updater.GetPointers(); Updater.GetPointers();
var version = JsonConvert var version = JsonConvert
.DeserializeObject<GamePointersCollectionModel>(Offsets.Default.RocketLeague) .DeserializeObject<GamePointersCollection>(Offsets.Default.RocketLeague)
.GameVersion; .GameVersion;
VersionText = $"Note: Requires patch {version}. When a new patch is released Artemis downloads " + VersionText = $"Note: Requires patch {version}. When a new patch is released Artemis downloads " +
"new pointers for the latest version (unless disabled in settings)."; "new pointers for the latest version (unless disabled in settings).";
} }
public void SaveSettings()
{
if (RocketLeagueModel == null)
return;
RocketLeagueSettings.Save();
}
public void ResetSettings()
{
// TODO: Confirmation dialog (Generic MVVM approach)
RocketLeagueSettings.ToDefault();
NotifyOfPropertyChange(() => RocketLeagueSettings);
SaveSettings();
}
public void ToggleEffect()
{
RocketLeagueModel.Enabled = _rocketLeagueSettings.Enabled;
}
} }
} }

View File

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Games.Witcher3" GeneratedClassName="Witcher3">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Games.Witcher3" GeneratedClassName="Witcher3">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User"> <Setting Name="Enabled" Type="System.Boolean" Scope="User">

View File

@ -2,15 +2,13 @@
namespace Artemis.Modules.Games.Witcher3 namespace Artemis.Modules.Games.Witcher3
{ {
public class Witcher3Settings : EffectSettings public class Witcher3Settings : GameSettings
{ {
public Witcher3Settings() public Witcher3Settings()
{ {
Load(); Load();
} }
public bool Enabled { get; set; }
public sealed override void Load() public sealed override void Load()
{ {
Enabled = Witcher3.Default.Enabled; Enabled = Witcher3.Default.Enabled;

View File

@ -29,7 +29,7 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" /> <Label Content="Enable effect" Margin="0 3 0 0" HorizontalAlignment="Right" />
<ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25" <ToggleButton x:Name="EffectEnabled" Margin="0 3 0 0" Width="25" Height="25"
IsChecked="{Binding Path=Witcher3Settings.Enabled, Mode=TwoWay}" IsChecked="{Binding Path=GameSettings.Enabled, Mode=TwoWay}"
Style="{DynamicResource MetroCircleToggleButtonStyle}" Style="{DynamicResource MetroCircleToggleButtonStyle}"
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" /> cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
</StackPanel> </StackPanel>

View File

@ -5,65 +5,27 @@ using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using Artemis.Managers; using Artemis.Managers;
using Artemis.Properties; using Artemis.Properties;
using Screen = Caliburn.Micro.Screen; using Artemis.ViewModels.Abstract;
namespace Artemis.Modules.Games.Witcher3 namespace Artemis.Modules.Games.Witcher3
{ {
public class Witcher3ViewModel : Screen public class Witcher3ViewModel : GameViewModel
{ {
private Witcher3Settings _witcher3Settings;
public Witcher3ViewModel(MainManager mainManager) public Witcher3ViewModel(MainManager mainManager)
{ {
MainManager = mainManager; MainManager = mainManager;
// Settings are loaded from file by class // Settings are loaded from file by class
Witcher3Settings = new Witcher3Settings(); GameSettings = new Witcher3Settings();
// Create effect model and add it to MainManager // Create effect model and add it to MainManager
Witcher3Model = new Witcher3Model(mainManager, Witcher3Settings); GameModel = new Witcher3Model(mainManager, (Witcher3Settings) GameSettings);
MainManager.EffectManager.EffectModels.Add(Witcher3Model); MainManager.EffectManager.EffectModels.Add(GameModel);
} }
public static string Name => "The Witcher 3"; public static string Name => "The Witcher 3";
public MainManager MainManager { get; set; } public async void AutoInstall()
public Witcher3Model Witcher3Model { get; set; }
public Witcher3Settings Witcher3Settings
{
get { return _witcher3Settings; }
set
{
if (Equals(value, _witcher3Settings)) return;
_witcher3Settings = value;
NotifyOfPropertyChange(() => Witcher3Settings);
}
}
public void SaveSettings()
{
if (Witcher3Model == null)
return;
Witcher3Settings.Save();
}
public void ResetSettings()
{
// TODO: Confirmation dialog (Generic MVVM approach)
Witcher3Settings.ToDefault();
NotifyOfPropertyChange(() => Witcher3Settings);
SaveSettings();
}
public void ToggleEffect()
{
Witcher3Model.Enabled = _witcher3Settings.Enabled;
}
public void AutoInstall()
{ {
// Request The Witcher 3 folder // Request The Witcher 3 folder
var dialog = new FolderBrowserDialog var dialog = new FolderBrowserDialog
@ -77,14 +39,15 @@ namespace Artemis.Modules.Games.Witcher3
// If the subfolder doesn't contain witcher3.exe, it's the wrong folder. // If the subfolder doesn't contain witcher3.exe, it's the wrong folder.
if (!File.Exists(dialog.SelectedPath + @"\bin\x64\witcher3.exe")) if (!File.Exists(dialog.SelectedPath + @"\bin\x64\witcher3.exe"))
{ {
var error = MessageBox.Show("That's not a valid Witcher 3 directory\n\n" + var retry = await
MainManager.DialogService.ShowQuestionMessageBox("Installation error",
"That's not a valid Witcher 3 directory\n\n" +
"Default directories:\n" + "Default directories:\n" +
"Steam: C:\\Program Files (x86)\\Steam\\steamapps\\common\\The Witcher 3\n" + "Steam: \\SteamApps\\common\\The Witcher 3\n" +
"GOG: C:\\GOG Games\\The Witcher 3 Wild Hunt", "Installation error", "GOG: C:\\GOG Games\\The Witcher 3 Wild Hunt\n\n" +
MessageBoxButtons.RetryCancel); "Retry?");
if (error == DialogResult.Retry) if (retry.Value)
AutoInstall(); AutoInstall();
else
return; return;
} }
@ -99,17 +62,21 @@ namespace Artemis.Modules.Games.Witcher3
// Don't trip over our own mod // Don't trip over our own mod
if (!file.Contains("modArtemis")) if (!file.Contains("modArtemis"))
{ {
MessageBox.Show("Oh no, you have a conflicting mod!\n\n" + var viewHelp = await
MainManager.DialogService.ShowQuestionMessageBox("Conflicting mod found",
"Oh no, you have a conflicting mod!\n\n" +
"Conflicting file: " + file.Remove(0, dialog.SelectedPath.Length) + "Conflicting file: " + file.Remove(0, dialog.SelectedPath.Length) +
"\n\nOnce you press OK you will be taken to an instructions page.", "\n\nWould you like to view instructions on how to manually install the mod?");
"Conflicting mod found"); if (!viewHelp.Value)
return;
// Put the mod in the documents folder instead // Put the mod in the documents folder instead
// Create the directory structure // Create the directory structure
var folder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis"; var folder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis";
if ( if (
!Directory.Exists(folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player")) !Directory.Exists(folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player"))
Directory.CreateDirectory(folder + @"\Witcher3\mods\modArtemis\content\scripts\game\player"); Directory.CreateDirectory(folder +
@"\Witcher3\mods\modArtemis\content\scripts\game\player");
if ( if (
!Directory.Exists(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc")) !Directory.Exists(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc"))
Directory.CreateDirectory(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc"); Directory.CreateDirectory(folder + @"\Witcher3\bin\config\r4game\user_config_matrix\pc");
@ -122,7 +89,6 @@ namespace Artemis.Modules.Games.Witcher3
Resources.playerWitcherWs); Resources.playerWitcherWs);
Process.Start(new ProcessStartInfo("https://github.com/SpoinkyNL/Artemis/wiki/The-Witcher-3")); Process.Start(new ProcessStartInfo("https://github.com/SpoinkyNL/Artemis/wiki/The-Witcher-3"));
return; return;
} }
} }
@ -140,7 +106,7 @@ namespace Artemis.Modules.Games.Witcher3
File.WriteAllText(dialog.SelectedPath + @"\mods\modArtemis\content\scripts\game\player\playerWitcher.ws", File.WriteAllText(dialog.SelectedPath + @"\mods\modArtemis\content\scripts\game\player\playerWitcher.ws",
Resources.playerWitcherWs); Resources.playerWitcherWs);
MessageBox.Show("The mod was successfully installed!", "Success"); MainManager.DialogService.ShowMessageBox("Success", "The mod was successfully installed!");
} }
} }
} }

View File

@ -1,5 +1,7 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Modules.Overlays.VolumeDisplay" GeneratedClassName="VolumeDisplay">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Modules.Overlays.VolumeDisplay" GeneratedClassName="VolumeDisplay">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="Enabled" Type="System.Boolean" Scope="User"> <Setting Name="Enabled" Type="System.Boolean" Scope="User">

View File

@ -1,6 +1,5 @@
using System.Drawing; using System.Drawing;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Artemis.Managers; using Artemis.Managers;
using Artemis.Models; using Artemis.Models;
@ -25,13 +24,13 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
public override void Dispose() public override void Dispose()
{ {
MainManager.KeyboardHook.Unsubscribe(HandleKeypress); MainManager.KeyboardHook.KeyDownCallback -= KeyPressTask;
} }
public override void Enable() public override void Enable()
{ {
// Listener won't start unless the effect is active // Listener won't start unless the effect is active
MainManager.KeyboardHook.Subscribe(HandleKeypress); MainManager.KeyboardHook.KeyDownCallback += KeyPressTask;
} }
public override void Update() public override void Update()
@ -80,11 +79,6 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
return bitmap; return bitmap;
} }
private void HandleKeypress(object sender, KeyEventArgs e)
{
Task.Factory.StartNew(() => KeyPressTask(e));
}
private void KeyPressTask(KeyEventArgs e) private void KeyPressTask(KeyEventArgs e)
{ {
if (e.KeyCode != Keys.VolumeUp && e.KeyCode != Keys.VolumeDown) if (e.KeyCode != Keys.VolumeUp && e.KeyCode != Keys.VolumeDown)

View File

@ -55,10 +55,10 @@
<xctk:ColorPicker x:Name="SecondaryColor" <xctk:ColorPicker x:Name="SecondaryColor"
SelectedColor="{Binding Path=VolumeDisplaySettings.SecondaryColor, Mode=TwoWay}" SelectedColor="{Binding Path=VolumeDisplaySettings.SecondaryColor, Mode=TwoWay}"
Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" > VerticalAlignment="Center" Margin="0,5,-1,5" Height="22">
<xctk:ColorPicker.Template> <xctk:ColorPicker.Template>
<ControlTemplate> <ControlTemplate>
<Rectangle ></Rectangle> <Rectangle />
</ControlTemplate> </ControlTemplate>
</xctk:ColorPicker.Template> </xctk:ColorPicker.Template>
</xctk:ColorPicker> </xctk:ColorPicker>

View File

@ -113,6 +113,26 @@ namespace Artemis.Properties {
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon logo {
get {
object obj = ResourceManager.GetObject("logo", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon logo_disabled {
get {
object obj = ResourceManager.GetObject("logo_disabled", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to /***********************************************************************/ /// Looks up a localized string similar to /***********************************************************************/
////** © 2015 CD PROJEKT S.A. All rights reserved. ////** © 2015 CD PROJEKT S.A. All rights reserved.

View File

@ -127,6 +127,12 @@
<data name="gamestateConfiguration" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="gamestateConfiguration" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\counterstrike\gamestateconfiguration.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value> <value>..\resources\counterstrike\gamestateconfiguration.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data> </data>
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="logo_disabled" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logo-disabled.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="playerWitcherWs" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="playerWitcherWs" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\witcher3\playerwitcher.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value> <value>..\resources\witcher3\playerwitcher.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-16</value>
</data> </data>

View File

@ -37,7 +37,7 @@ namespace Artemis.Settings {
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Logitech G910 RGB")] [global::System.Configuration.DefaultSettingValueAttribute("")]
public string LastKeyboard { public string LastKeyboard {
get { get {
return ((string)(this["LastKeyboard"])); return ((string)(this["LastKeyboard"]));
@ -73,7 +73,7 @@ namespace Artemis.Settings {
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")] [global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool Autorun { public bool Autorun {
get { get {
return ((bool)(this["Autorun"])); return ((bool)(this["Autorun"]));
@ -94,5 +94,29 @@ namespace Artemis.Settings {
this["Suspended"] = value; this["Suspended"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool ShowOnStartup {
get {
return ((bool)(this["ShowOnStartup"]));
}
set {
this["ShowOnStartup"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool CheckForUpdates {
get {
return ((bool)(this["CheckForUpdates"]));
}
set {
this["CheckForUpdates"] = value;
}
}
} }
} }

View File

@ -1,14 +1,12 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="General">
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"
GeneratedClassNamespace="Artemis.Settings" GeneratedClassName="General">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="LastEffect" Type="System.String" Scope="User"> <Setting Name="LastEffect" Type="System.String" Scope="User">
<Value Profile="(Default)">TypeWave</Value> <Value Profile="(Default)">TypeWave</Value>
</Setting> </Setting>
<Setting Name="LastKeyboard" Type="System.String" Scope="User"> <Setting Name="LastKeyboard" Type="System.String" Scope="User">
<Value Profile="(Default)">Logitech G910 RGB</Value> <Value Profile="(Default)" />
</Setting> </Setting>
<Setting Name="EnablePointersUpdate" Type="System.Boolean" Scope="User"> <Setting Name="EnablePointersUpdate" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value> <Value Profile="(Default)">True</Value>
@ -17,10 +15,16 @@
<Value Profile="(Default)">51364</Value> <Value Profile="(Default)">51364</Value>
</Setting> </Setting>
<Setting Name="Autorun" Type="System.Boolean" Scope="User"> <Setting Name="Autorun" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value> <Value Profile="(Default)">False</Value>
</Setting> </Setting>
<Setting Name="Suspended" Type="System.Boolean" Scope="User"> <Setting Name="Suspended" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value> <Value Profile="(Default)">False</Value>
</Setting> </Setting>
<Setting Name="ShowOnStartup" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="CheckForUpdates" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -38,6 +38,26 @@ namespace Artemis.Settings
} }
} }
public bool CheckForUpdates
{
get { return General.Default.CheckForUpdates; }
set
{
if (General.Default.CheckForUpdates == value) return;
General.Default.CheckForUpdates = value;
}
}
public bool ShowOnStartup
{
get { return General.Default.ShowOnStartup; }
set
{
if (General.Default.ShowOnStartup == value) return;
General.Default.ShowOnStartup = value;
}
}
private void ApplyGamestatePort() private void ApplyGamestatePort()
{ {
// TODO: Restart Gamestate server with new port // TODO: Restart Gamestate server with new port
@ -71,6 +91,8 @@ namespace Artemis.Settings
GamestatePort = 51364; GamestatePort = 51364;
EnablePointersUpdate = true; EnablePointersUpdate = true;
Autorun = true; Autorun = true;
CheckForUpdates = true;
ShowOnStartup = true;
SaveSettings(); SaveSettings();
} }

View File

@ -1,7 +1,9 @@
using System.IO; using System;
using System.IO;
using System.Net; using System.Net;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Windows.Forms;
using Artemis.Settings; using Artemis.Settings;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -29,11 +31,18 @@ namespace Artemis.Utilities.GameState
if (Running) if (Running)
return; return;
try
{
_listener.Prefixes.Clear(); _listener.Prefixes.Clear();
Port = General.Default.GamestatePort; Port = General.Default.GamestatePort;
_listener.Prefixes.Add($"http://localhost:{Port}/"); _listener.Prefixes.Add($"http://localhost:{Port}/");
_listener.Start(); _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 => ThreadPool.QueueUserWorkItem(o =>
{ {

View File

@ -1,34 +1,24 @@
using System.Windows.Forms; using System.Threading.Tasks;
using Gma.System.MouseKeyHook; using System.Windows.Forms;
using VirtualInput;
namespace Artemis.Utilities.Keyboard namespace Artemis.Utilities.Keyboard
{ {
public class KeyboardHook public class KeyboardHook
{ {
private IKeyboardMouseEvents _mGlobalHook; public delegate void KeyDownCallbackHandler(KeyEventArgs e);
public int Subscriptions { get; set; }
public void Subscribe(KeyEventHandler handleKeypress) public KeyboardHook()
{ {
if (_mGlobalHook == null) VirtualKeyboard.KeyDown += VirtualKeyboardOnKeyDown;
_mGlobalHook = Hook.GlobalEvents(); VirtualKeyboard.StartInterceptor();
_mGlobalHook.KeyDown += handleKeypress;
Subscriptions++;
} }
public void Unsubscribe(KeyEventHandler handleKeypress) private void VirtualKeyboardOnKeyDown(object sender, KeyEventArgs keyEventArgs)
{ {
if (_mGlobalHook == null) Task.Factory.StartNew(() => { KeyDownCallback?.Invoke(keyEventArgs); });
return;
_mGlobalHook.KeyDown -= handleKeypress;
Subscriptions--;
if (Subscriptions >= 1)
return;
_mGlobalHook.Dispose();
_mGlobalHook = null;
} }
public event KeyDownCallbackHandler KeyDownCallback;
} }
} }

View File

@ -1,12 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Artemis.Models;
using Artemis.Settings;
using Newtonsoft.Json;
namespace Artemis.Utilities.Memory namespace Artemis.Utilities.Memory
{ {

View File

@ -3,9 +3,10 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Windows.Forms; using System.Threading.Tasks;
using Artemis.Models; using Artemis.Services;
using Artemis.Settings; using Artemis.Settings;
using Artemis.Utilities.Memory;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
@ -13,22 +14,27 @@ namespace Artemis.Utilities
{ {
public static class Updater public static class Updater
{ {
public static int CurrentVersion = 100; public static int CurrentVersion = 102;
public static void CheckForUpdate() public static async Task<Action> CheckForUpdate(MetroDialogService dialogService)
{ {
if (!General.Default.CheckForUpdates)
return null;
var newRelease = IsUpdateAvailable(); var newRelease = IsUpdateAvailable();
if (newRelease == null) if (newRelease == null)
return; return null;
var viewUpdate = var viewUpdate = await
MessageBox.Show( dialogService.ShowQuestionMessageBox("Update available",
$"A new version of Artemis is available, version {newRelease["tag_name"].Value<string>()}.\n" + $"A new version of Artemis is available, version {newRelease["tag_name"].Value<string>()}.\n" +
"Do you wish to view the update on GitHub now?\n\n" + "Do you wish to view the update on GitHub now?\n\n" +
"Note: You can disable update notifications in the settings menu", "Artemis - Update available", "Note: You can disable update notifications in the settings menu");
MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (viewUpdate == DialogResult.Yes) if (viewUpdate.Value)
Process.Start(new ProcessStartInfo(newRelease["html_url"].Value<string>())); Process.Start(new ProcessStartInfo(newRelease["html_url"].Value<string>()));
return null;
} }
public static JObject IsUpdateAvailable() public static JObject IsUpdateAvailable()
@ -80,7 +86,7 @@ namespace Artemis.Utilities
"https://raw.githubusercontent.com/SpoinkyNL/Artemis/master/pointers.json?random=" + rand.Next()); "https://raw.githubusercontent.com/SpoinkyNL/Artemis/master/pointers.json?random=" + rand.Next());
// Get a list of pointers // Get a list of pointers
var pointers = JsonConvert.DeserializeObject<List<GamePointersCollectionModel>>(json); var pointers = JsonConvert.DeserializeObject<List<GamePointersCollection>>(json);
// Assign each pointer to the settings file // Assign each pointer to the settings file
var rlPointers = JsonConvert.SerializeObject(pointers.FirstOrDefault(p => p.Game == "RocketLeague")); var rlPointers = JsonConvert.SerializeObject(pointers.FirstOrDefault(p => p.Game == "RocketLeague"));
if (rlPointers != null) if (rlPointers != null)

View File

@ -61,9 +61,15 @@ namespace Artemis.ViewModels.Abstract
MainManager.EffectManager.ChangeEffect(EffectModel, true); MainManager.EffectManager.ChangeEffect(EffectModel, true);
} }
public void ResetSettings() public async void ResetSettings()
{ {
// TODO: Confirmation dialog (Generic MVVM approach) var resetConfirm = await
MainManager.DialogService.ShowQuestionMessageBox("Reset effect settings",
"Are you sure you wish to reset this effect's settings? \nAny changes you made will be lost.");
if (!resetConfirm.Value)
return;
EffectSettings.ToDefault(); EffectSettings.ToDefault();
NotifyOfPropertyChange(() => EffectSettings); NotifyOfPropertyChange(() => EffectSettings);

View File

@ -8,8 +8,9 @@ using MahApps.Metro.Controls;
namespace Artemis.ViewModels.Flyouts namespace Artemis.ViewModels.Flyouts
{ {
public class FlyoutSettingsViewModel : FlyoutBaseViewModel, IHandle<ToggleEnabled> public class FlyoutSettingsViewModel : FlyoutBaseViewModel, IHandle<ToggleEnabled>, IHandle<ActiveEffectChanged>
{ {
private string _activeEffectName;
private bool _enabled; private bool _enabled;
private GeneralSettings _generalSettings; private GeneralSettings _generalSettings;
private string _selectedKeyboardProvider; private string _selectedKeyboardProvider;
@ -38,7 +39,15 @@ namespace Artemis.ViewModels.Flyouts
public MainManager MainManager { get; set; } public MainManager MainManager { get; set; }
public BindableCollection<string> KeyboardProviders public BindableCollection<string> KeyboardProviders
=> new BindableCollection<string>(MainManager.KeyboardManager.KeyboardProviders.Select(k => k.Name)); {
get
{
var collection = new BindableCollection<string>(MainManager.KeyboardManager.KeyboardProviders
.Select(k => k.Name));
collection.Insert(0, "None");
return collection;
}
}
public string SelectedKeyboardProvider public string SelectedKeyboardProvider
{ {
@ -52,7 +61,8 @@ namespace Artemis.ViewModels.Flyouts
return; return;
MainManager.KeyboardManager.ChangeKeyboard( MainManager.KeyboardManager.ChangeKeyboard(
MainManager.KeyboardManager.KeyboardProviders.First(k => k.Name == _selectedKeyboardProvider)); MainManager.KeyboardManager.KeyboardProviders.FirstOrDefault(
k => k.Name == _selectedKeyboardProvider));
} }
} }
@ -68,6 +78,23 @@ namespace Artemis.ViewModels.Flyouts
} }
} }
public string ActiveEffectName
{
get { return _activeEffectName; }
set
{
if (value == _activeEffectName) return;
_activeEffectName = value;
NotifyOfPropertyChange(() => ActiveEffectName);
}
}
public void Handle(ActiveEffectChanged message)
{
var effectDisplay = message.ActiveEffect.Length > 0 ? message.ActiveEffect : "none";
ActiveEffectName = $"Active effect: {effectDisplay}";
}
public void Handle(ToggleEnabled message) public void Handle(ToggleEnabled message)
{ {
NotifyOfPropertyChange(() => Enabled); NotifyOfPropertyChange(() => Enabled);
@ -99,7 +126,9 @@ namespace Artemis.ViewModels.Flyouts
protected override void HandleOpen() protected override void HandleOpen()
{ {
SelectedKeyboardProvider = MainManager.KeyboardManager.ActiveKeyboard?.Name; SelectedKeyboardProvider = General.Default.LastKeyboard.Length > 0
? General.Default.LastKeyboard
: "None";
} }
} }
} }

View File

@ -1,7 +1,6 @@
using System; using System.Linq;
using System.Linq;
using System.Windows;
using Artemis.Managers; using Artemis.Managers;
using Artemis.Services;
using Artemis.ViewModels.Flyouts; using Artemis.ViewModels.Flyouts;
using Caliburn.Micro; using Caliburn.Micro;
@ -16,8 +15,10 @@ namespace Artemis.ViewModels
public ShellViewModel() public ShellViewModel()
{ {
var dialogService = new MetroDialogService(this);
IEventAggregator events = new EventAggregator(); IEventAggregator events = new EventAggregator();
MainManager = new MainManager(events);
MainManager = new MainManager(events, dialogService);
DisplayName = "Artemis"; DisplayName = "Artemis";
_welcomeVm = new WelcomeViewModel {DisplayName = "Welcome"}; _welcomeVm = new WelcomeViewModel {DisplayName = "Welcome"};
@ -49,5 +50,10 @@ namespace Artemis.ViewModels
{ {
Flyouts.First().IsOpen = !Flyouts.First().IsOpen; Flyouts.First().IsOpen = !Flyouts.First().IsOpen;
} }
public void CloseSettings()
{
Flyouts.First().IsOpen = false;
}
} }
} }

View File

@ -1,13 +1,10 @@
using System; using System;
using System.Diagnostics; using System.Windows;
using System.Threading.Tasks;
using System.Windows.Forms;
using Artemis.Events; using Artemis.Events;
using Artemis.Properties;
using Artemis.Settings;
using Artemis.Utilities; using Artemis.Utilities;
using Caliburn.Micro; using Caliburn.Micro;
using Newtonsoft.Json.Linq;
using Application = System.Windows.Application;
using Screen = Caliburn.Micro.Screen;
namespace Artemis.ViewModels namespace Artemis.ViewModels
{ {
@ -16,17 +13,10 @@ namespace Artemis.ViewModels
private readonly ShellViewModel _shellViewModel; private readonly ShellViewModel _shellViewModel;
private readonly IWindowManager _windowManager; private readonly IWindowManager _windowManager;
private string _activeIcon;
private bool _checkedForUpdate; private bool _checkedForUpdate;
private bool _enabled; private bool _enabled;
private string _toggleText; private string _toggleText;
/*
* NOTE: In this sample the system tray view-model doesn't receive any notification
* when the other window gets closed by pressing the top right 'x'.
* Thus no property notification is invoked, and system tray context-menu appears
* out of sync, still allowing 'Hide' and disabling 'Show'.
* Given the purpose of the sample - integrating Caliburn.Micro with WPF NotifyIcon -
* syncing the two view-models is not of interest here.
* */
public SystemTrayViewModel(IWindowManager windowManager, ShellViewModel shellViewModel) public SystemTrayViewModel(IWindowManager windowManager, ShellViewModel shellViewModel)
{ {
@ -35,8 +25,10 @@ namespace Artemis.ViewModels
_shellViewModel.MainManager.Events.Subscribe(this); _shellViewModel.MainManager.Events.Subscribe(this);
_shellViewModel.MainManager.EnableProgram(); _shellViewModel.MainManager.EnableProgram();
_checkedForUpdate = false; _checkedForUpdate = false;
//ActiveIcon = "../logo.ico";
// TODO: Check if show on startup is enabled, if so, show window. if (General.Default.ShowOnStartup)
ShowWindow();
} }
public bool CanShowWindow => !_shellViewModel.IsActive; public bool CanShowWindow => !_shellViewModel.IsActive;
@ -52,10 +44,21 @@ namespace Artemis.ViewModels
_enabled = value; _enabled = value;
ToggleText = _enabled ? "Disable Artemis" : "Enable Artemis"; ToggleText = _enabled ? "Disable Artemis" : "Enable Artemis";
ActiveIcon = _enabled ? "../Resources/logo.ico" : "../Resources/logo-disabled.ico";
NotifyOfPropertyChange(() => Enabled); NotifyOfPropertyChange(() => Enabled);
} }
} }
public string ActiveIcon
{
get { return _activeIcon; }
set
{
_activeIcon = value;
NotifyOfPropertyChange();
}
}
public string ToggleText public string ToggleText
{ {
get { return _toggleText; } get { return _toggleText; }
@ -93,18 +96,17 @@ namespace Artemis.ViewModels
if (!CanShowWindow) if (!CanShowWindow)
return; return;
if (!_checkedForUpdate)
{
_checkedForUpdate = true;
var updateTask = new Task(Updater.CheckForUpdate);
updateTask.Start();
}
// manually show the next window view-model // manually show the next window view-model
_windowManager.ShowWindow(_shellViewModel); _windowManager.ShowWindow(_shellViewModel);
NotifyOfPropertyChange(() => CanShowWindow); NotifyOfPropertyChange(() => CanShowWindow);
NotifyOfPropertyChange(() => CanHideWindow); NotifyOfPropertyChange(() => CanHideWindow);
if (_checkedForUpdate)
return;
_checkedForUpdate = true;
Updater.CheckForUpdate(_shellViewModel.MainManager.DialogService);
} }

View File

@ -6,7 +6,7 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:cal="http://www.caliburnproject.org" xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" d:DesignHeight="600" d:DesignWidth="300"
Width="300"> Width="300">
<UserControl.Resources> <UserControl.Resources>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" /> <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
@ -24,6 +24,8 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
@ -32,7 +34,7 @@
Content="Enable Artemis:" /> Content="Enable Artemis:" />
<controls:ToggleSwitch Grid.Row="0" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No" <controls:ToggleSwitch Grid.Row="0" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125" VerticalAlignment="Center" HorizontalAlignment="Right" Width="125"
IsChecked="{Binding Path=Enabled, Mode=TwoWay}"/> IsChecked="{Binding Path=Enabled, Mode=TwoWay}" />
<!-- Startup with Windows --> <!-- Startup with Windows -->
<Label Grid.Row="1" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left" <Label Grid.Row="1" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
@ -41,38 +43,52 @@
IsChecked="{Binding Path=GeneralSettings.Autorun, Mode=TwoWay}" IsChecked="{Binding Path=GeneralSettings.Autorun, Mode=TwoWay}"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125" /> VerticalAlignment="Center" HorizontalAlignment="Right" Width="125" />
<!-- Keyboard selection --> <!-- Show on startup -->
<Label Grid.Row="2" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left" <Label Grid.Row="2" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Show on startup:" />
<controls:ToggleSwitch Grid.Row="2" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No"
IsChecked="{Binding Path=GeneralSettings.ShowOnStartup, Mode=TwoWay}"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125" />
<!-- Keyboard selection -->
<Label Grid.Row="3" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Keyboard:" /> Content="Keyboard:" />
<ComboBox Grid.Row="2" Grid.Column="1" x:Name="KeyboardProviders" Margin="10" VerticalAlignment="Center" <ComboBox Grid.Row="3" Grid.Column="1" x:Name="KeyboardProviders" Margin="10" VerticalAlignment="Center"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Width="140" /> Width="140" />
<!-- TODO: Ugly --> <!-- TODO: Ugly -->
<!-- Gamestate port --> <!-- Gamestate port -->
<Label Grid.Row="3" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left" <Label Grid.Row="4" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Gamestate server port:" /> Content="Gamestate server port:" />
<controls:NumericUpDown Grid.Row="3" Grid.Column="1" Margin="10" VerticalAlignment="Center" <controls:NumericUpDown Grid.Row="4" Grid.Column="1" Margin="10" VerticalAlignment="Center"
HorizontalAlignment="Right" Width="120" HorizontalAlignment="Right" Width="120"
Value="{Binding Path=GeneralSettings.GamestatePort, Mode=TwoWay}" /> Value="{Binding Path=GeneralSettings.GamestatePort, Mode=TwoWay}" />
<!-- Updates check -->
<Label Grid.Row="5" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Check for updates:" />
<controls:ToggleSwitch Grid.Row="5" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125"
IsChecked="{Binding Path=GeneralSettings.CheckForUpdates, Mode=TwoWay}" />
<!-- Update pointers --> <!-- Update pointers -->
<Label Grid.Row="4" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left" <Label Grid.Row="6" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Download pointers:" /> Content="Download pointers:" />
<controls:ToggleSwitch Grid.Row="4" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No" <controls:ToggleSwitch Grid.Row="6" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125" VerticalAlignment="Center" HorizontalAlignment="Right" Width="125"
IsChecked="{Binding Path=GeneralSettings.EnablePointersUpdate, Mode=TwoWay}" /> IsChecked="{Binding Path=GeneralSettings.EnablePointersUpdate, Mode=TwoWay}" />
<!-- Buttons --> <!-- Buttons -->
<Button Grid.Row="5" Grid.Column="0" Margin="10" x:Name="ResetSettings" Content="Reset settings" <Button Grid.Row="7" Grid.Column="0" Margin="10" x:Name="ResetSettings" Content="Reset settings"
VerticalAlignment="Center" HorizontalAlignment="Left" Width="120" VerticalAlignment="Center" HorizontalAlignment="Left" Width="120"
Style="{DynamicResource SquareButtonStyle}" /> Style="{DynamicResource SquareButtonStyle}" />
<Button Grid.Row="5" Grid.Column="1" Margin="10" x:Name="SaveSettings" Content="Save changes" <Button Grid.Row="7" Grid.Column="1" Margin="10" x:Name="SaveSettings" Content="Save changes"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="120" VerticalAlignment="Center" HorizontalAlignment="Right" Width="120"
Style="{DynamicResource SquareButtonStyle}" /> Style="{DynamicResource SquareButtonStyle}" />
<!-- Version --> <!-- Version -->
<Grid Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2" Margin="10" VerticalAlignment="Bottom"> <Grid Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="2" Margin="10" VerticalAlignment="Bottom">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@ -81,11 +97,14 @@
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Artemis 1.0.1" VerticalAlignment="Center" <TextBlock Grid.Row="0" Grid.ColumnSpan="2" x:Name="ActiveEffectName" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="Artemis 1.0.2" VerticalAlignment="Center"
HorizontalAlignment="Left" /> HorizontalAlignment="Left" />
<Button Grid.Row="0" Grid.Column="1" Focusable="False" Style="{StaticResource AccentedSquareButtonStyle}" <Button Grid.Row="1" Grid.Column="1" Focusable="False"
Style="{StaticResource AccentedSquareButtonStyle}"
cal:Message.Attach="[Action NavigateTo('https://github.com/SpoinkyNL/Artemis')]" cal:Message.Attach="[Action NavigateTo('https://github.com/SpoinkyNL/Artemis')]"
Content="View on GitHub" Margin="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Right" /> Content="View on GitHub" Margin="5,0,0,0" VerticalAlignment="Center"
HorizontalAlignment="Right" />
</Grid> </Grid>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -5,10 +5,12 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:cal="http://www.caliburnproject.org" xmlns:cal="http://www.caliburnproject.org"
xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
dialogs:DialogParticipation.Register="{Binding RelativeSource={RelativeSource Self}, Path=DataContext}"
mc:Ignorable="d" mc:Ignorable="d"
Title="Artemis" Height="670" Width="690" Title="Artemis" Height="670" Width="690"
MinWidth="500" MinHeight="400" MinWidth="500" MinHeight="400"
GlowBrush="{DynamicResource AccentColorBrush}" Icon="/Artemis;component/logo.ico"> GlowBrush="{DynamicResource AccentColorBrush}" Icon="../logo.ico">
<!-- Bit of extra code to use a different icon than in the taskbar --> <!-- Bit of extra code to use a different icon than in the taskbar -->
<Controls:MetroWindow.IconTemplate> <Controls:MetroWindow.IconTemplate>
<DataTemplate> <DataTemplate>
@ -62,7 +64,7 @@
<ResourceDictionary <ResourceDictionary
Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" /> Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" />
</Grid.Resources> </Grid.Resources>
<TabControl Margin="0,10,10,10" TabStripPlacement="Left" x:Name="Items"> <TabControl Margin="0,10,10,10" TabStripPlacement="Left" x:Name="Items" cal:Message.Attach="[Event GotFocus] = [Action CloseSettings]">
<TabControl.ItemTemplate> <TabControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Text="{Binding DisplayName}" /> <TextBlock Text="{Binding DisplayName}" />

View File

@ -24,7 +24,7 @@
<!-- the application main system tray icon --> <!-- the application main system tray icon -->
<tb:TaskbarIcon x:Key="SystemTrayIcon" <tb:TaskbarIcon x:Key="SystemTrayIcon"
IconSource="../logo.ico" IconSource="{Binding Path=ActiveIcon, Mode=OneWay}"
ToolTipText="Artemis" ToolTipText="Artemis"
cal:Message.Attach="[Event TrayMouseDoubleClick] = [Action ShowWindow]" cal:Message.Attach="[Event TrayMouseDoubleClick] = [Action ShowWindow]"
ContextMenu="{StaticResource MainSysTrayMenu}" /> ContextMenu="{StaticResource MainSysTrayMenu}" />

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Select a Product Configuration -->
<InstallShieldProductConfiguration>Express</InstallShieldProductConfiguration>
<!-- Select a Visual Studio Configuration / InstallShield Release -->
<Configuration>Debug</Configuration>
<InstallShieldRelease>$(Configuration)</InstallShieldRelease>
</PropertyGroup>
<ItemGroup>
<!-- The InstallShieldProject item selects the project to build -->
<InstallShieldProject Include="$(MSBuildProjectDirectory)\$(MSBuildProjectName).isl"/>
<!-- The InstallShieldReleaseFlags sets Release Flags -->
<!--<InstallShieldReleaseFlags Include=""/>-->
<!-- The InstallShieldMergeModulePath specifies what directories are
searched for Merge Modules -->
<!--<InstallShieldMergeModulePath Include=""/>-->
</ItemGroup>
<ItemGroup>
<!-- The ProjectReference items refer to any Visual Studio solutions you want to automatically probe for Project Output Groups. -->
</ItemGroup>
<ItemGroup>
<!-- The TaggedOutputs items allow you to explicitly add extra files to output groups. Each item must include both Name and OutputGroup, as well as TargetPath metadata values. -->
<!--<TaggedOutputs Include="C:\My Test Exe.exe">
<Name>My Test Project</Name>
<OutputGroup>Primary output</OutputGroup>
<TargetPath>My Test Exe.exe</TargetPath>
</TaggedOutputs> -->
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\InstallShield\2015Limited\InstallShield.targets"/>
</Project>