mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Tiny UI fixes
Layers can no longer be dragged/resized off of the canvas Added Qwertz option to dropdown box Added default profiles for Pro L Added default profiles for GTA V LUA DrawText returns resulting text width Fixed a null reference in LuaWrapper Save button now forces a profile save too Added profile save to debug log Bumped version number
This commit is contained in:
parent
75b64b6ee6
commit
b2c09a96b5
@ -89,6 +89,7 @@ namespace Artemis.DAL
|
|||||||
}
|
}
|
||||||
|
|
||||||
File.WriteAllText(path + $@"\{prof.Name}.json", json);
|
File.WriteAllText(path + $@"\{prof.Name}.json", json);
|
||||||
|
Logger.Debug("Saved profile {0}/{1}/{2}", prof.KeyboardSlug, prof.GameName, prof.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,16 +3,18 @@ using System.Linq;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Artemis.DAL;
|
||||||
using Artemis.DeviceProviders.CoolerMaster.Utilities;
|
using Artemis.DeviceProviders.CoolerMaster.Utilities;
|
||||||
using Artemis.DeviceProviders.Logitech.Utilities;
|
using Artemis.DeviceProviders.Logitech.Utilities;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
|
using Artemis.Settings;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
|
|
||||||
namespace Artemis.DeviceProviders.CoolerMaster
|
namespace Artemis.DeviceProviders.CoolerMaster
|
||||||
{
|
{
|
||||||
public class MasterkeysProL : KeyboardProvider
|
public class MasterkeysProL : KeyboardProvider
|
||||||
{
|
{
|
||||||
private bool _hasControl;
|
private GeneralSettings _generalSettings;
|
||||||
|
|
||||||
public MasterkeysProL()
|
public MasterkeysProL()
|
||||||
{
|
{
|
||||||
@ -27,16 +29,13 @@ namespace Artemis.DeviceProviders.CoolerMaster
|
|||||||
Width = 22;
|
Width = 22;
|
||||||
|
|
||||||
PreviewSettings = new PreviewSettings(670, 189, new Thickness(-2, -5, 0, 0), Resources.masterkeys_pro_l);
|
PreviewSettings = new PreviewSettings(670, 189, new Thickness(-2, -5, 0, 0), Resources.masterkeys_pro_l);
|
||||||
|
_generalSettings = SettingsProvider.Load<GeneralSettings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Disable()
|
public override void Disable()
|
||||||
{
|
{
|
||||||
if (_hasControl)
|
CmSdk.EnableLedControl(false);
|
||||||
{
|
Thread.Sleep(500);
|
||||||
CmSdk.EnableLedControl(false);
|
|
||||||
Thread.Sleep(500);
|
|
||||||
}
|
|
||||||
_hasControl = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanEnable()
|
public override bool CanEnable()
|
||||||
@ -50,8 +49,6 @@ namespace Artemis.DeviceProviders.CoolerMaster
|
|||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);
|
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);
|
||||||
|
|
||||||
_hasControl = true;
|
|
||||||
CmSdk.EnableLedControl(true);
|
CmSdk.EnableLedControl(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +77,15 @@ namespace Artemis.DeviceProviders.CoolerMaster
|
|||||||
|
|
||||||
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
||||||
{
|
{
|
||||||
return KeyMap.QwertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
switch (_generalSettings.Layout)
|
||||||
|
{
|
||||||
|
case "Qwerty":
|
||||||
|
return KeyMap.QwertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||||
|
case "Qwertz":
|
||||||
|
return KeyMap.QwertzLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||||
|
default:
|
||||||
|
return KeyMap.AzertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,6 +83,7 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
}
|
}
|
||||||
|
|
||||||
Logger.Debug("Corsair SDK reported device as: {0}", _keyboard.DeviceInfo.Model);
|
Logger.Debug("Corsair SDK reported device as: {0}", _keyboard.DeviceInfo.Model);
|
||||||
|
|
||||||
_keyboard.Brush = _keyboardBrush ?? (_keyboardBrush = new ImageBrush());
|
_keyboard.Brush = _keyboardBrush ?? (_keyboardBrush = new ImageBrush());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ namespace Artemis.DeviceProviders
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Bitmap KeyboardBitmap(int scale) => new Bitmap(Width*scale, Height*scale);
|
public Bitmap KeyboardBitmap(int scale) => new Bitmap(Width*scale, Height*scale);
|
||||||
|
|
||||||
public Rect KeyboardRectangle(int scale) => new Rect(new Size(Width*scale, Height*scale));
|
public Rect KeyboardRectangle(int scale = 4) => new Rect(new Size(Width*scale, Height*scale));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs CanEnable asynchronously multiple times until successful, cancelled or max tries reached
|
/// Runs CanEnable asynchronously multiple times until successful, cancelled or max tries reached
|
||||||
|
|||||||
@ -28,9 +28,15 @@ namespace Artemis.DeviceProviders.Logitech
|
|||||||
|
|
||||||
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
||||||
{
|
{
|
||||||
return _generalSettings.Layout == "Qwerty"
|
switch (_generalSettings.Layout)
|
||||||
? KeyMap.QwertyLayout.FirstOrDefault(k => k.KeyCode == keyCode)
|
{
|
||||||
: KeyMap.AzertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
case "Qwerty":
|
||||||
|
return KeyMap.QwertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||||
|
case "Qwertz":
|
||||||
|
return KeyMap.QwertzLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||||
|
default:
|
||||||
|
return KeyMap.AzertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -30,9 +30,19 @@ namespace Artemis.DeviceProviders.Logitech
|
|||||||
|
|
||||||
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
||||||
{
|
{
|
||||||
var value = _generalSettings.Layout == "Qwerty"
|
KeyMatch value;
|
||||||
? KeyMap.QwertyLayout.FirstOrDefault(k => k.KeyCode == keyCode)
|
switch (_generalSettings.Layout)
|
||||||
: KeyMap.AzertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
{
|
||||||
|
case "Qwerty":
|
||||||
|
value = KeyMap.QwertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||||
|
break;
|
||||||
|
case "Qwertz":
|
||||||
|
value = KeyMap.QwertzLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
value = KeyMap.AzertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Adjust the distance by 1 on both x and y for the G910
|
// Adjust the distance by 1 on both x and y for the G910
|
||||||
return new KeyMatch(value.KeyCode, value.X + 1, value.Y + 1);
|
return new KeyMatch(value.KeyCode, value.X + 1, value.Y + 1);
|
||||||
|
|||||||
@ -2,9 +2,11 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Artemis.DAL;
|
||||||
using Artemis.DeviceProviders.Logitech.Utilities;
|
using Artemis.DeviceProviders.Logitech.Utilities;
|
||||||
using Artemis.DeviceProviders.Razer.Utilities;
|
using Artemis.DeviceProviders.Razer.Utilities;
|
||||||
using Artemis.Properties;
|
using Artemis.Properties;
|
||||||
|
using Artemis.Settings;
|
||||||
using Corale.Colore.Core;
|
using Corale.Colore.Core;
|
||||||
using Corale.Colore.Razer;
|
using Corale.Colore.Razer;
|
||||||
using Constants = Corale.Colore.Razer.Keyboard.Constants;
|
using Constants = Corale.Colore.Razer.Keyboard.Constants;
|
||||||
@ -13,6 +15,8 @@ namespace Artemis.DeviceProviders.Razer
|
|||||||
{
|
{
|
||||||
public class BlackWidow : KeyboardProvider
|
public class BlackWidow : KeyboardProvider
|
||||||
{
|
{
|
||||||
|
private GeneralSettings _generalSettings;
|
||||||
|
|
||||||
public BlackWidow()
|
public BlackWidow()
|
||||||
{
|
{
|
||||||
Name = "Razer BlackWidow Chroma";
|
Name = "Razer BlackWidow Chroma";
|
||||||
@ -24,6 +28,7 @@ namespace Artemis.DeviceProviders.Razer
|
|||||||
Height = Constants.MaxRows;
|
Height = Constants.MaxRows;
|
||||||
Width = Constants.MaxColumns;
|
Width = Constants.MaxColumns;
|
||||||
PreviewSettings = new PreviewSettings(665, 175, new Thickness(0, -15, 0, 0), Resources.blackwidow);
|
PreviewSettings = new PreviewSettings(665, 175, new Thickness(0, -15, 0, 0), Resources.blackwidow);
|
||||||
|
_generalSettings = SettingsProvider.Load<GeneralSettings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanEnable()
|
public override bool CanEnable()
|
||||||
@ -56,7 +61,15 @@ namespace Artemis.DeviceProviders.Razer
|
|||||||
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
||||||
{
|
{
|
||||||
// TODO: Needs it's own keymap or a way to get it from the Chroma SDK
|
// TODO: Needs it's own keymap or a way to get it from the Chroma SDK
|
||||||
return KeyMap.QwertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
switch (_generalSettings.Layout)
|
||||||
|
{
|
||||||
|
case "Qwerty":
|
||||||
|
return KeyMap.QwertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||||
|
case "Qwertz":
|
||||||
|
return KeyMap.QwertzLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||||
|
default:
|
||||||
|
return KeyMap.AzertyLayout.FirstOrDefault(k => k.KeyCode == keyCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -27,6 +27,9 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
|||||||
};
|
};
|
||||||
ProfileEditor = kernel.Get<ProfileEditorViewModel>(args);
|
ProfileEditor = kernel.Get<ProfileEditorViewModel>(args);
|
||||||
ProfileEditor.PropertyChanged += ProfileUpdater;
|
ProfileEditor.PropertyChanged += ProfileUpdater;
|
||||||
|
|
||||||
|
EffectModel.Profile = ProfileEditor.SelectedProfile;
|
||||||
|
ProfilePreviewModel.Profile = ProfileEditor.SelectedProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProfileEditorViewModel ProfileEditor { get; set; }
|
public ProfileEditorViewModel ProfileEditor { get; set; }
|
||||||
@ -36,6 +39,7 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
|||||||
{
|
{
|
||||||
if ((e.PropertyName != "SelectedProfile") && IsActive)
|
if ((e.PropertyName != "SelectedProfile") && IsActive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EffectModel.Profile = ProfileEditor.SelectedProfile;
|
EffectModel.Profile = ProfileEditor.SelectedProfile;
|
||||||
ProfilePreviewModel.Profile = ProfileEditor.SelectedProfile;
|
ProfilePreviewModel.Profile = ProfileEditor.SelectedProfile;
|
||||||
|
|
||||||
@ -47,6 +51,12 @@ namespace Artemis.Modules.Effects.WindowsProfile
|
|||||||
EffectSettings.Save();
|
EffectSettings.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void SaveSettings()
|
||||||
|
{
|
||||||
|
ProfileEditor.SaveSelectedProfile();
|
||||||
|
base.SaveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnActivate()
|
protected override void OnActivate()
|
||||||
{
|
{
|
||||||
base.OnActivate();
|
base.OnActivate();
|
||||||
|
|||||||
@ -25,7 +25,7 @@ namespace Artemis.Modules.Games.WoW
|
|||||||
ProcessName = "Wow-64";
|
ProcessName = "Wow-64";
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
|
|
||||||
// Currently WoW is locked behind a hidden trigger (obviously not that hidden if you're reading this)
|
// Currently WoW is locked behind a hidden trigger (obviously not that hidden since you're reading this)
|
||||||
// It is using memory reading and lets first try to contact Blizzard
|
// It is using memory reading and lets first try to contact Blizzard
|
||||||
var settings = SettingsProvider.Load<GeneralSettings>();
|
var settings = SettingsProvider.Load<GeneralSettings>();
|
||||||
Enabled = (settings.GamestatePort == 62575) && Settings.Enabled;
|
Enabled = (settings.GamestatePort == 62575) && Settings.Enabled;
|
||||||
|
|||||||
@ -54,7 +54,7 @@ namespace Artemis.Profiles.Lua
|
|||||||
_ctx.DrawRectangle(luaBrush.Brush, new Pen(), new Rect(x, y, width, height));
|
_ctx.DrawRectangle(luaBrush.Brush, new Pen(), new Rect(x, y, width, height));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawText(LuaBrush luaBrush, double x, double y, string text, int fontSize)
|
public double DrawText(LuaBrush luaBrush, double x, double y, string text, int fontSize)
|
||||||
{
|
{
|
||||||
x *= 4;
|
x *= 4;
|
||||||
y *= 4;
|
y *= 4;
|
||||||
@ -65,6 +65,7 @@ namespace Artemis.Profiles.Lua
|
|||||||
fontSize, luaBrush.Brush);
|
fontSize, luaBrush.Brush);
|
||||||
|
|
||||||
_ctx.DrawText(formatted, new Point(x, y));
|
_ctx.DrawText(formatted, new Point(x, y));
|
||||||
|
return formatted.Width/4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,8 +94,11 @@ namespace Artemis.Profiles.Lua
|
|||||||
// Clear old fields/properties
|
// Clear old fields/properties
|
||||||
KeyboardProvider = null;
|
KeyboardProvider = null;
|
||||||
ProfileModel = null;
|
ProfileModel = null;
|
||||||
|
LuaProfileWrapper = null;
|
||||||
|
LuaBrushWrapper = null;
|
||||||
LuaKeyboardWrapper?.Dispose();
|
LuaKeyboardWrapper?.Dispose();
|
||||||
LuaKeyboardWrapper = null;
|
LuaKeyboardWrapper = null;
|
||||||
|
LuaMouseWrapper = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -108,8 +111,29 @@ namespace Artemis.Profiles.Lua
|
|||||||
}
|
}
|
||||||
catch (NullReferenceException)
|
catch (NullReferenceException)
|
||||||
{
|
{
|
||||||
// Can be missing if the user script screwed up the globals
|
// TODO: Ask MoonSharp folks why this is happening
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LuaEventsWrapper != null)
|
||||||
|
{
|
||||||
|
lock (LuaEventsWrapper.InvokeLock)
|
||||||
|
{
|
||||||
|
lock (LuaScript)
|
||||||
|
{
|
||||||
|
LuaScript.DoString("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lock (LuaScript)
|
||||||
|
{
|
||||||
|
LuaScript.DoString("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LuaEventsWrapper = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -172,8 +172,7 @@ namespace Artemis.Profiles
|
|||||||
|
|
||||||
public void Deactivate()
|
public void Deactivate()
|
||||||
{
|
{
|
||||||
if (Equals(LuaWrapper.ProfileModel, this))
|
LuaWrapper.Clear();
|
||||||
LuaWrapper.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LayerModel AddLayer(LayerModel afterLayer)
|
public LayerModel AddLayer(LayerModel afterLayer)
|
||||||
|
|||||||
@ -53,8 +53,8 @@ using System.Windows;
|
|||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("1.4.0.0")]
|
[assembly: AssemblyVersion("1.5.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.4.0.0")]
|
[assembly: AssemblyFileVersion("1.5.0.0")]
|
||||||
[assembly: InternalsVisibleTo("Artemis.Tests")]
|
[assembly: InternalsVisibleTo("Artemis.Tests")]
|
||||||
[assembly: InternalsVisibleTo("Artemis.Explorables")]
|
[assembly: InternalsVisibleTo("Artemis.Explorables")]
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@ -79,7 +79,7 @@ namespace Artemis.ViewModels.Abstract
|
|||||||
MainManager.EffectManager.ChangeEffect(EffectModel, MainManager.LoopManager);
|
MainManager.EffectManager.ChangeEffect(EffectModel, MainManager.LoopManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveSettings()
|
public virtual void SaveSettings()
|
||||||
{
|
{
|
||||||
EffectSettings?.Save();
|
EffectSettings?.Save();
|
||||||
if (!EffectEnabled)
|
if (!EffectEnabled)
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Timers;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Modules.Effects.ProfilePreview;
|
using Artemis.Modules.Effects.ProfilePreview;
|
||||||
@ -30,6 +31,8 @@ namespace Artemis.ViewModels.Abstract
|
|||||||
};
|
};
|
||||||
ProfileEditor = kernel.Get<ProfileEditorViewModel>(args);
|
ProfileEditor = kernel.Get<ProfileEditorViewModel>(args);
|
||||||
ProfileEditor.PropertyChanged += ProfileUpdater;
|
ProfileEditor.PropertyChanged += ProfileUpdater;
|
||||||
|
|
||||||
|
GameModel.Profile = ProfileEditor.SelectedProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
@ -67,9 +70,11 @@ namespace Artemis.ViewModels.Abstract
|
|||||||
public void SaveSettings()
|
public void SaveSettings()
|
||||||
{
|
{
|
||||||
GameSettings?.Save();
|
GameSettings?.Save();
|
||||||
|
ProfileEditor.SaveSelectedProfile();
|
||||||
|
|
||||||
if (!GameEnabled)
|
if (!GameEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Restart the game if it's currently running to apply settings.
|
// Restart the game if it's currently running to apply settings.
|
||||||
MainManager.EffectManager.ChangeEffect(GameModel, MainManager.LoopManager);
|
MainManager.EffectManager.ChangeEffect(GameModel, MainManager.LoopManager);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,6 +89,7 @@ namespace Artemis.ViewModels.Flyouts
|
|||||||
public BindableCollection<string> Layouts => new BindableCollection<string>
|
public BindableCollection<string> Layouts => new BindableCollection<string>
|
||||||
{
|
{
|
||||||
"Qwerty",
|
"Qwerty",
|
||||||
|
"Qwertz",
|
||||||
"Azerty"
|
"Azerty"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,20 +1,26 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Artemis.DAL;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Modules.Effects.ProfilePreview;
|
using Artemis.Modules.Effects.ProfilePreview;
|
||||||
|
using Artemis.Settings;
|
||||||
using Artemis.ViewModels.Abstract;
|
using Artemis.ViewModels.Abstract;
|
||||||
|
|
||||||
namespace Artemis.ViewModels
|
namespace Artemis.ViewModels
|
||||||
{
|
{
|
||||||
public sealed class GamesViewModel : BaseViewModel
|
public sealed class GamesViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
private IOrderedEnumerable<GameViewModel> _vms;
|
private readonly IOrderedEnumerable<GameViewModel> _vms;
|
||||||
|
|
||||||
public GamesViewModel(GameViewModel[] gameViewModels, ProfileManager profileManager,
|
public GamesViewModel(GameViewModel[] gameViewModels, ProfileManager profileManager,
|
||||||
ProfilePreviewModel profilePreviewModel)
|
ProfilePreviewModel profilePreviewModel)
|
||||||
{
|
{
|
||||||
DisplayName = "Games";
|
DisplayName = "Games";
|
||||||
|
|
||||||
_vms = gameViewModels.OrderBy(g => g.DisplayName);
|
// Currently WoW is locked behind a hidden trigger (obviously not that hidden since you're reading this)
|
||||||
|
// It is using memory reading and lets first try to contact Blizzard
|
||||||
|
_vms = SettingsProvider.Load<GeneralSettings>().GamestatePort == 62575
|
||||||
|
? gameViewModels.OrderBy(g => g.DisplayName)
|
||||||
|
: gameViewModels.Where(g => g.DisplayName != "WoW").OrderBy(g => g.DisplayName);
|
||||||
|
|
||||||
profileManager.ProfilePreviewModel = profilePreviewModel;
|
profileManager.ProfilePreviewModel = profilePreviewModel;
|
||||||
profileManager.GameViewModels.AddRange(_vms);
|
profileManager.GameViewModels.AddRange(_vms);
|
||||||
|
|||||||
@ -121,9 +121,15 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
get { return _selectedProfile; }
|
get { return _selectedProfile; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (Equals(value, _selectedProfile)) return;
|
if (Equals(value, _selectedProfile))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Deactivate old profile
|
||||||
_selectedProfile?.Deactivate();
|
_selectedProfile?.Deactivate();
|
||||||
|
// Update the value
|
||||||
_selectedProfile = value;
|
_selectedProfile = value;
|
||||||
|
// Activate new profile
|
||||||
|
_selectedProfile?.Activate(_deviceManager.ActiveKeyboard);
|
||||||
NotifyOfPropertyChange(() => SelectedProfile);
|
NotifyOfPropertyChange(() => SelectedProfile);
|
||||||
NotifyOfPropertyChange(() => SelectedProfileName);
|
NotifyOfPropertyChange(() => SelectedProfileName);
|
||||||
}
|
}
|
||||||
@ -232,6 +238,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
{
|
{
|
||||||
ProfileViewModel.Deactivate();
|
ProfileViewModel.Deactivate();
|
||||||
SelectedProfile?.Deactivate();
|
SelectedProfile?.Deactivate();
|
||||||
|
_saveTimer.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -726,7 +733,12 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
|
|
||||||
private void ProfileSaveHandler(object sender, ElapsedEventArgs e)
|
private void ProfileSaveHandler(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_saving || (SelectedProfile == null))
|
SaveSelectedProfile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveSelectedProfile()
|
||||||
|
{
|
||||||
|
if (_saving || (SelectedProfile == null) || _deviceManager.ChangingKeyboard)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_saving = true;
|
_saving = true;
|
||||||
@ -739,8 +751,6 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
_saving = false;
|
_saving = false;
|
||||||
|
|
||||||
//Execute.OnUIThread(() => UpdateLayerList(ProfileViewModel.SelectedLayer));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
_blurProgress = _blurProgress + 0.025;
|
_blurProgress = _blurProgress + 0.025;
|
||||||
BlurRadius = (Math.Sin(_blurProgress*Math.PI) + 1)*10 + 10;
|
BlurRadius = (Math.Sin(_blurProgress*Math.PI) + 1)*10 + 10;
|
||||||
|
|
||||||
if (SelectedProfile == null || _deviceManager.ActiveKeyboard == null || (!ShowAll && SelectedLayer == null))
|
if (SelectedProfile == null || _deviceManager.ActiveKeyboard == null)
|
||||||
{
|
{
|
||||||
var preview = new DrawingImage();
|
var preview = new DrawingImage();
|
||||||
preview.Freeze();
|
preview.Freeze();
|
||||||
@ -321,17 +321,31 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
// If no setup or reset was done, handle the actual dragging action
|
// If no setup or reset was done, handle the actual dragging action
|
||||||
if (_resizing)
|
if (_resizing)
|
||||||
{
|
{
|
||||||
draggingProps.Width = (int) Math.Round(x - draggingProps.X);
|
var newWidth = Math.Round(x - draggingProps.X);
|
||||||
draggingProps.Height = (int) Math.Round(y - draggingProps.Y);
|
var newHeight = Math.Round(y - draggingProps.Y);
|
||||||
if (draggingProps.Width < 1)
|
|
||||||
draggingProps.Width = 1;
|
// Ensure the layer doesn't leave the canvas
|
||||||
if (draggingProps.Height < 1)
|
if (newWidth < 1 || draggingProps.X + newWidth <= 0)
|
||||||
draggingProps.Height = 1;
|
newWidth = draggingProps.Width;
|
||||||
|
if (newHeight < 1 || draggingProps.Y + newHeight <= 0)
|
||||||
|
newHeight = draggingProps.Height;
|
||||||
|
|
||||||
|
draggingProps.Width = newWidth;
|
||||||
|
draggingProps.Height = newHeight;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
draggingProps.X = (int) Math.Round(x - _draggingLayerOffset.Value.X);
|
var newX = Math.Round(x - _draggingLayerOffset.Value.X);
|
||||||
draggingProps.Y = (int) Math.Round(y - _draggingLayerOffset.Value.Y);
|
var newY = Math.Round(y - _draggingLayerOffset.Value.Y);
|
||||||
|
|
||||||
|
// Ensure the layer doesn't leave the canvas
|
||||||
|
if (newX >= SelectedProfile.Width || newX + draggingProps.Width <= 0)
|
||||||
|
newX = draggingProps.X;
|
||||||
|
if (newY >= SelectedProfile.Height || newY + draggingProps.Height <= 0)
|
||||||
|
newY = draggingProps.Y;
|
||||||
|
|
||||||
|
draggingProps.X = newX;
|
||||||
|
draggingProps.Y = newY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user