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

Cleaned up margins in views, improved Corsair mouse/headset null-handling. Added theme switching (WIP)

This commit is contained in:
SpoinkyNL 2016-05-31 18:45:26 +02:00
parent eb59ddc816
commit dd5889ec3e
20 changed files with 251 additions and 177 deletions

View File

@ -264,6 +264,9 @@
<setting name="CheckForUpdates" serializeAs="String">
<value>True</value>
</setting>
<setting name="Theme" serializeAs="String">
<value>Light</value>
</setting>
</Artemis.Settings.General>
</userSettings>
<runtime>

View File

@ -15,9 +15,9 @@
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/Styles/Accents/CorsairYellow.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Teal.xaml" />
<ResourceDictionary
Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
<ResourceDictionary Source="/Resources/Icons.xaml" />
<ResourceDictionary Source="Styles/ColorBox.xaml" />
</ResourceDictionary.MergedDictionaries>

View File

@ -670,10 +670,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Styles\Accents\CorsairYellow.xaml">
<Resource Include="Styles\Accents\CorsairYellow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</Resource>
<Page Include="Styles\ColorBox.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Media;
@ -33,7 +34,7 @@ namespace Artemis.DeviceProviders.Corsair
public override void Disable()
{
if (CueSDK.ProtocolDetails != null)
CueSDK.Reinitialize(true);
CueSDK.Reinitialize();
}
public override void UpdateDevice(Brush brush)
@ -65,36 +66,29 @@ namespace Artemis.DeviceProviders.Corsair
private static bool CanInitializeSdk()
{
// Try for about 10 seconds, in case CUE isn't started yet
var tries = 0;
while (tries < 9)
// If already initialized, return result right away
if (CueSDK.ProtocolDetails != null)
return CueSDK.HeadsetSDK != null;
// Else try to enable the SDK
for (var tries = 0; tries < 9; tries++)
{
if (CueSDK.ProtocolDetails != null)
break;
try
{
if (CueSDK.ProtocolDetails == null)
CueSDK.Initialize(true);
else
return true;
CueSDK.Initialize();
}
catch (CUEException e)
catch (Exception)
{
if (e.Error != CorsairError.ServerNotFound)
return true;
tries++;
Thread.Sleep(1000);
continue;
Thread.Sleep(2000);
}
catch (WrapperException)
{
CueSDK.Reinitialize(true);
return true;
}
return true;
}
return false;
if (CueSDK.ProtocolDetails == null)
return false;
return CueSDK.HeadsetSDK != null;
}
}
}

View File

@ -1,25 +1,25 @@
using System.Linq;
using System;
using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Media;
using Artemis.Utilities;
using CUE.NET;
using CUE.NET.Devices.Generic.Enums;
using CUE.NET.Exceptions;
using Ninject.Extensions.Logging;
namespace Artemis.DeviceProviders.Corsair
{
internal class CorsairMice : DeviceProvider
{
public ILogger Logger { get; set; }
public CorsairMice(ILogger logger)
{
Logger = logger;
Type = DeviceType.Mouse;
}
public ILogger Logger { get; set; }
public override bool TryEnable()
{
CanUse = CanInitializeSdk();
@ -33,7 +33,7 @@ namespace Artemis.DeviceProviders.Corsair
public override void Disable()
{
if (CueSDK.ProtocolDetails != null)
CueSDK.Reinitialize(true);
CueSDK.Reinitialize();
}
public override void UpdateDevice(Brush brush)
@ -42,7 +42,7 @@ namespace Artemis.DeviceProviders.Corsair
return;
var leds = CueSDK.MouseSDK.Leds.Count();
var rect = new Rect(new Size(leds*20, leds* 20));
var rect = new Rect(new Size(leds*20, leds*20));
var img = brush.Dispatcher.Invoke(() =>
{
var visual = new DrawingVisual();
@ -57,7 +57,7 @@ namespace Artemis.DeviceProviders.Corsair
{
corsairLed.Color = ledIndex == 0
? img.GetPixel(0, 0)
: img.GetPixel((ledIndex + 1) * 20 - 1, (ledIndex + 1) * 20 - 1);
: img.GetPixel((ledIndex + 1)*20 - 1, (ledIndex + 1)*20 - 1);
ledIndex++;
}
@ -66,36 +66,29 @@ namespace Artemis.DeviceProviders.Corsair
private static bool CanInitializeSdk()
{
// Try for about 10 seconds, in case CUE isn't started yet
var tries = 0;
while (tries < 9)
// If already initialized, return result right away
if (CueSDK.ProtocolDetails != null)
return CueSDK.MouseSDK != null;
// Else try to enable the SDK
for (var tries = 0; tries < 9; tries++)
{
if (CueSDK.ProtocolDetails != null)
break;
try
{
if (CueSDK.ProtocolDetails == null)
CueSDK.Initialize(true);
else
return true;
CueSDK.Initialize();
}
catch (CUEException e)
catch (Exception)
{
if (e.Error != CorsairError.ServerNotFound)
return true;
tries++;
Thread.Sleep(1000);
continue;
Thread.Sleep(2000);
}
catch (WrapperException)
{
CueSDK.Reinitialize(true);
return true;
}
return true;
}
return false;
if (CueSDK.ProtocolDetails == null)
return false;
return CueSDK.MouseSDK != null;
}
}
}

View File

@ -1,13 +1,12 @@
using System.Drawing;
using System;
using System.Drawing;
using System.Threading;
using System.Windows;
using Artemis.Properties;
using Artemis.Utilities;
using CUE.NET;
using CUE.NET.Brushes;
using CUE.NET.Devices.Generic.Enums;
using CUE.NET.Devices.Keyboard;
using CUE.NET.Exceptions;
namespace Artemis.DeviceProviders.Corsair
{
@ -26,34 +25,29 @@ namespace Artemis.DeviceProviders.Corsair
public override bool CanEnable()
{
// Try for about 10 seconds, in case CUE isn't started yet
var tries = 0;
while (tries < 9)
// If already initialized, return result right away
if (CueSDK.ProtocolDetails != null)
return CueSDK.KeyboardSDK != null;
// Else try to enable the SDK
for (var tries = 0; tries < 9; tries++)
{
if (CueSDK.ProtocolDetails != null)
break;
try
{
if (CueSDK.ProtocolDetails == null)
CueSDK.Initialize(true);
CueSDK.Initialize();
}
catch (CUEException e)
catch (Exception)
{
if (e.Error == CorsairError.ServerNotFound)
{
tries++;
Thread.Sleep(1000);
continue;
}
Thread.Sleep(2000);
}
catch (WrapperException)
{
CueSDK.Reinitialize(true);
return true;
}
return true;
}
return false;
if (CueSDK.ProtocolDetails == null)
return false;
return CueSDK.KeyboardSDK != null;
}
/// <summary>
@ -62,7 +56,7 @@ namespace Artemis.DeviceProviders.Corsair
public override void Enable()
{
if (CueSDK.ProtocolDetails == null)
CueSDK.Initialize(true);
CueSDK.Initialize();
_keyboard = CueSDK.KeyboardSDK;
switch (_keyboard.DeviceInfo.Model)
@ -93,7 +87,7 @@ namespace Artemis.DeviceProviders.Corsair
public override void Disable()
{
if (CueSDK.ProtocolDetails != null)
CueSDK.Reinitialize(true);
CueSDK.Reinitialize();
}
/// <summary>

View File

@ -19,10 +19,10 @@ namespace Artemis.Models.Profiles
}
public string Name { get; set; }
public int Order { get; set; }
public LayerType LayerType { get; set; }
public bool Enabled { get; set; }
public bool Expanded { get; set; }
public int Order { get; set; }
public LayerPropertiesModel Properties { get; set; }
public ChildItemCollection<LayerModel, LayerModel> Children { get; }

View File

@ -26,9 +26,9 @@ namespace Artemis.Models.Profiles
public ChildItemCollection<ProfileModel, LayerModel> Layers { get; }
public string Name { get; set; }
public bool IsDefault { get; set; }
public string KeyboardName { get; set; }
public string GameName { get; set; }
public bool IsDefault { get; set; }
[XmlIgnore]
public DrawingVisual DrawingVisual { get; set; }

View File

@ -7,14 +7,14 @@
mc:Ignorable="d"
d:DesignHeight="476.986" d:DesignWidth="538.772">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Grid Margin="15, 5, 15, 5">
<Grid Margin="15,5,5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="80" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
@ -39,8 +39,8 @@
<StackPanel Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2" Margin="0,0,1,0">
<Label FontSize="16" Content="CS:GO Directory" FontFamily="Segoe UI Semibold" Foreground="#535353"
Width="130" HorizontalAlignment="Left" />
<Label FontSize="20" HorizontalAlignment="Left" Content="CS:GO Directory" />
<Grid>
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
Text="{Binding Path=GameSettings.GameDirectory, Mode=TwoWay}"
@ -52,7 +52,7 @@
</StackPanel>
<!-- Profile editor -->
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-20,0" />
<!-- Buttons -->
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">

View File

@ -7,14 +7,14 @@
mc:Ignorable="d"
d:DesignHeight="476.986" d:DesignWidth="538.772">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Grid Margin="15, 5, 15, 5">
<Grid Margin="15,5,5,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="80" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
@ -39,8 +39,7 @@
<StackPanel Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2" Margin="0,0,1,0">
<Label FontSize="16" Content="Dota 2 Directory" FontFamily="Segoe UI Semibold" Foreground="#535353"
Width="130" HorizontalAlignment="Left" />
<Label FontSize="20" HorizontalAlignment="Left" Content="Dota 2 Directory" />
<Grid>
<TextBox x:Name="GameDirectory" Height="23" TextWrapping="Wrap" Margin="5,0,30,0"
Text="{Binding Path=GameSettings.GameDirectory, Mode=TwoWay}"
@ -52,7 +51,7 @@
</StackPanel>
<!-- Profile editor -->
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-20,0" />
<!-- Buttons -->
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">

View File

@ -7,15 +7,15 @@
xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d"
d:DesignHeight="416.495" d:DesignWidth="553.608">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Grid Margin="15, 5, 15, 5">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid Margin="15, 5, 5, 5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="80" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
@ -37,15 +37,15 @@
</StackPanel>
</StackPanel>
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,0,1,0" VerticalAlignment="Center"
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
Foreground="{DynamicResource HighlightBrush}" MaxWidth="510" TextAlignment="Justify">
Note: For this game to work with Artemis, please open up your Division settings, navigate to 3rd Party
TextAlignment="Justify" Margin="5,0,0,0">
For this game to work with Artemis, please open up your Division settings, navigate to 3rd Party
and set LED keyboard support to Yes. (This only works if you have Artemis running before starting the game)
</TextBlock>
<!-- Profile editor -->
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-20,0" />
<!-- Buttons -->
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">

View File

@ -6,8 +6,8 @@
xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d"
d:DesignHeight="386.842" d:DesignWidth="554.887">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Grid Margin="15, 5, 15, 5">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid Margin="15, 5, 5, 5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
@ -34,11 +34,12 @@
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
</StackPanel>
</StackPanel>
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold" TextAlignment="Justify" MaxWidth="820">
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
TextAlignment="Justify" Margin="5,0,0,10">
Artemis requires the latest Witcher 3 version and mod to be installed in order to work. If you don't use any (conflicting) Witcher 3 mods, the mod can automatically be installed.
</TextBlock>
<Button Grid.Row="2" Grid.Column="0" x:Name="AutoInstall" Content="Try automatic mod install" Width="160" Style="{DynamicResource SquareButtonStyle}" HorizontalAlignment="Left" />
<Button Grid.Row="2" Grid.Column="0" Margin="5,0,0,0" x:Name="AutoInstall" Content="Try automatic mod install" Width="160" Style="{DynamicResource SquareButtonStyle}" HorizontalAlignment="Left" />
<!-- Profile editor -->
<ContentControl Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="ProfileEditor" Margin="0,0,-30,0" />

View File

@ -118,5 +118,17 @@ namespace Artemis.Settings {
this["CheckForUpdates"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Light")]
public string Theme {
get {
return ((string)(this["Theme"]));
}
set {
this["Theme"] = value;
}
}
}
}

View File

@ -1,7 +1,5 @@
<?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 />
<Settings>
<Setting Name="LastEffect" Type="System.String" Scope="User">
@ -28,5 +26,8 @@
<Setting Name="CheckForUpdates" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="Theme" Type="System.String" Scope="User">
<Value Profile="(Default)">Light</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -2,12 +2,20 @@
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices.ComTypes;
using System.Windows;
using Artemis.Utilities;
using MahApps.Metro;
namespace Artemis.Settings
{
public class GeneralSettings
{
private readonly Accent _artemisAccent = ThemeManager.GetAccent("Teal");
private readonly Accent _corsairAccent = new Accent("CorsairYellow",
new Uri("pack://application:,,,/Styles/Accents/CorsairYellow.xaml"));
private readonly AppTheme _darkTheme = ThemeManager.GetAppTheme("BaseDark");
private readonly AppTheme _lightTheme = ThemeManager.GetAppTheme("BaseLight");
public int GamestatePort
{
get { return General.Default.GamestatePort; }
@ -58,6 +66,16 @@ namespace Artemis.Settings
}
}
public string Theme
{
get { return General.Default.Theme; }
set
{
if (General.Default.Theme == value) return;
General.Default.Theme = value;
}
}
private void ApplyGamestatePort()
{
// TODO: Restart Gamestate server with new port
@ -83,9 +101,30 @@ namespace Artemis.Settings
General.Default.Save();
ApplyAutorun();
ApplyTheme();
ApplyGamestatePort();
}
// TODO: http://visionarycoder.com/2015/01/06/setting-themeaccent-with-mahapps-metro/
private void ApplyTheme()
{
switch (Theme)
{
case "Light":
ThemeManager.ChangeAppStyle(Application.Current, _artemisAccent, _lightTheme);
break;
case "Dark":
ThemeManager.ChangeAppStyle(Application.Current, _artemisAccent, _darkTheme);
break;
case "Corsair Light":
ThemeManager.ChangeAppStyle(Application.Current, _corsairAccent, _lightTheme);
break;
case "Corsair Dark":
ThemeManager.ChangeAppStyle(Application.Current, _corsairAccent, _darkTheme);
break;
}
}
public void ResetSettings()
{
GamestatePort = 51364;
@ -93,6 +132,7 @@ namespace Artemis.Settings
Autorun = true;
CheckForUpdates = true;
ShowOnStartup = true;
Theme = "Light";
SaveSettings();
}

View File

@ -7,9 +7,9 @@ using Artemis.Settings;
using Caliburn.Micro;
using MahApps.Metro.Controls;
using NLog;
using NLog.Config;
using NLog.Targets;
using ILogger = Ninject.Extensions.Logging.ILogger;
using LogManager = NLog.LogManager;
namespace Artemis.ViewModels.Flyouts
{
@ -71,6 +71,20 @@ namespace Artemis.ViewModels.Flyouts
}
}
public BindableCollection<string> Themes
=> new BindableCollection<string> {"Light", "Dark", "Corsair Light", "Corsair Dark"};
public string SelectedTheme
{
get { return GeneralSettings.Theme; }
set
{
if (value == GeneralSettings.Theme) return;
GeneralSettings.Theme = value;
NotifyOfPropertyChange(() => SelectedTheme);
}
}
public string SelectedKeyboardProvider
{
get { return _selectedKeyboardProvider; }
@ -119,7 +133,7 @@ namespace Artemis.ViewModels.Flyouts
// TODO https://github.com/ninject/Ninject.Extensions.Logging/issues/35
private void ApplyLogging()
{
var c = NLog.LogManager.Configuration;
var c = LogManager.Configuration;
var file = c.FindTargetByName("file") as FileTarget;
if (file == null)
return;
@ -133,7 +147,7 @@ namespace Artemis.ViewModels.Flyouts
else
rule.DisableLoggingForLevel(LogLevel.Debug);
NLog.LogManager.ReconfigExistingLoggers();
LogManager.ReconfigExistingLoggers();
_logger.Info("Set debug logging to: {0}", EnableDebug);
}

View File

@ -59,6 +59,8 @@ namespace Artemis.ViewModels.Profiles
public ProfileViewModel ProfileViewModel { get; set; }
public bool EditorEnabled => SelectedProfile != null && !SelectedProfile.IsDefault;
public BindableCollection<ProfileModel> Profiles
{
get { return _profiles; }
@ -204,6 +206,8 @@ namespace Artemis.ViewModels.Profiles
if (e.PropertyName != "SelectedProfile")
return;
// Update editor enabled state
NotifyOfPropertyChange(() => EditorEnabled);
// Update ProfileViewModel
ProfileViewModel.SelectedProfile = SelectedProfile;
// Update interface
@ -524,6 +528,7 @@ namespace Artemis.ViewModels.Profiles
return;
}
newProfile.IsDefault = false;
ProfileProvider.AddOrUpdate(newProfile);
LoadProfiles();
SelectedProfile = Profiles.FirstOrDefault(p => p.Name == newProfile.Name);

View File

@ -117,8 +117,11 @@ namespace Artemis.ViewModels.Profiles
layer.Draw<object>(null, drawingContext, true, false);
// Get the selection color
var color = (Color) ThemeManager.DetectAppStyle(Application.Current).Item2.Resources["AccentColor"];
var pen = new Pen(new SolidColorBrush(color), 0.4);
var accentColor = ThemeManager.DetectAppStyle(Application.Current)?.Item2?.Resources["AccentColor"];
if (accentColor == null)
return;
var pen = new Pen(new SolidColorBrush((Color) accentColor), 0.4);
// Draw the selection outline and resize indicator
if (SelectedLayer != null && SelectedLayer.MustDraw())
@ -168,7 +171,7 @@ namespace Artemis.ViewModels.Profiles
/// <param name="e"></param>
public void MouseUpKeyboardPreview(MouseButtonEventArgs e)
{
if (SelectedProfile == null)
if (SelectedProfile == null || SelectedProfile.IsDefault)
return;
var timeSinceDown = DateTime.Now - _downTime;

View File

@ -26,6 +26,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
@ -50,45 +51,51 @@
IsChecked="{Binding Path=GeneralSettings.ShowOnStartup, Mode=TwoWay}"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125" />
<!-- Keyboard selection -->
<!-- Theme selection -->
<Label Grid.Row="3" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Keyboard:" />
<ComboBox Grid.Row="3" Grid.Column="1" x:Name="KeyboardProviders" Margin="10" VerticalAlignment="Center"
Content="Theme:" />
<ComboBox Grid.Row="3" Grid.Column="1" x:Name="Themes" Margin="10" VerticalAlignment="Center"
HorizontalAlignment="Right"
Width="140" />
<!-- Keyboard selection -->
<Label Grid.Row="4" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Keyboard:" />
<ComboBox Grid.Row="4" Grid.Column="1" x:Name="KeyboardProviders" Margin="10" VerticalAlignment="Center"
HorizontalAlignment="Right"
Width="140" />
<!-- TODO: Ugly -->
<!-- Gamestate port -->
<Label Grid.Row="4" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
<Label Grid.Row="5" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Gamestate server port:" />
<controls:NumericUpDown Grid.Row="4" Grid.Column="1" Margin="10" VerticalAlignment="Center"
<controls:NumericUpDown Grid.Row="5" Grid.Column="1" Margin="10" VerticalAlignment="Center"
HorizontalAlignment="Right" Width="120"
Value="{Binding Path=GeneralSettings.GamestatePort, Mode=TwoWay}" />
<!-- Updates check -->
<Label Grid.Row="5" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
<Label Grid.Row="6" 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"
<controls:ToggleSwitch Grid.Row="6" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125"
IsChecked="{Binding Path=GeneralSettings.CheckForUpdates, Mode=TwoWay}" />
<!-- Update pointers -->
<Label Grid.Row="6" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
<Label Grid.Row="7" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Download pointers:" />
<controls:ToggleSwitch Grid.Row="6" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No"
<controls:ToggleSwitch Grid.Row="7" Grid.Column="1" Margin="5" OnLabel="Yes" OffLabel="No"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125"
IsChecked="{Binding Path=GeneralSettings.EnablePointersUpdate, Mode=TwoWay}" />
<!-- Buttons -->
<Button Grid.Row="7" Grid.Column="0" Margin="10" x:Name="ResetSettings" Content="Reset settings"
<Button Grid.Row="8" Grid.Column="0" Margin="10" x:Name="ResetSettings" Content="Reset settings"
VerticalAlignment="Center" HorizontalAlignment="Left" Width="120"
Style="{DynamicResource SquareButtonStyle}" />
<Button Grid.Row="7" Grid.Column="1" Margin="10" x:Name="SaveSettings" Content="Save changes"
<Button Grid.Row="8" Grid.Column="1" Margin="10" x:Name="SaveSettings" Content="Save changes"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="120"
Style="{DynamicResource SquareButtonStyle}" />
<!-- Version -->
<Grid Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="2" Margin="10" VerticalAlignment="Bottom">
<Grid Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="2" Margin="10" VerticalAlignment="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />

View File

@ -7,7 +7,6 @@
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:itemBehaviours="clr-namespace:Artemis.ItemBehaviours"
xmlns:utilities="clr-namespace:Artemis.Utilities"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:dragDrop="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
mc:Ignorable="d"
d:DesignHeight="510" Width="1055">
@ -25,10 +24,10 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Preview -->
<!-- Preview Background="#FF232323" -->
<Label Grid.Column="0" Grid.Row="0" FontSize="20" HorizontalAlignment="Left" Content="Preview" />
<Border Grid.Column="0" Grid.Row="1" Background="#FF232323" BorderBrush="{DynamicResource HighlightBrush}"
BorderThickness="3" Width="800" Height="400">
BorderThickness="3" Width="800" Height="400">
<Border>
<Border.Effect>
<!-- TODO: Pulse 10-20 -->
@ -44,65 +43,73 @@
Stretch="Fill" Cursor="{Binding Path=ProfileViewModel.KeyboardPreviewCursor}"
cal:Message.Attach="[Event MouseMove] = [Action MouseMoveKeyboardPreview($eventArgs)];
[Event MouseDown] = [Action MouseDownKeyboardPreview($eventArgs)];
[Event MouseUp] = [Action MouseUpKeyboardPreview($eventArgs)]" />
[Event MouseUp] = [Action MouseUpKeyboardPreview($eventArgs)]"
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"/>
</Grid>
</Border>
</Border>
<!-- Profile management -->
<StackPanel Grid.Column="0" Grid.Row="2" Orientation="Horizontal" Margin="0,5,0,0">
<Label Content="Active profile" />
<ComboBox Width="110" VerticalAlignment="Top" x:Name="Profiles" DisplayMemberPath="Name"
<StackPanel Grid.Column="0" Grid.Row="2">
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<Label Content="Active profile" />
<ComboBox Width="145" VerticalAlignment="Top" x:Name="Profiles" DisplayMemberPath="Name"
Margin="5,0,0,0" />
<Button x:Name="AddProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
<Button x:Name="AddProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Add profile">
<Button.Content>
<Rectangle
<Button.Content>
<Rectangle
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
Width="12" Height="12">
<Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_add}" Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Button.Content>
</Button>
<Button x:Name="RenameProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Rename profile">
<Button.Content>
<Rectangle
<Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_add}" Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Button.Content>
</Button>
<Button x:Name="RenameProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Rename profile"
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
<Button.Content>
<Rectangle
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
Width="12" Height="12">
<Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_edit}" Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Button.Content>
</Button>
<Button x:Name="DuplicateProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Duplicate profile">
<Button.Content>
<Rectangle
<Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_edit}" Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Button.Content>
</Button>
<Button x:Name="DuplicateProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Duplicate profile"
IsEnabled="{Binding Path=ProfileSelected, Mode=OneWay}">
<Button.Content>
<Rectangle
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
Width="12" Height="12">
<Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_clipboard_paste}" Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Button.Content>
</Button>
<Button x:Name="DeleteProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Delete profile">
<Button.Content>
<Rectangle
<Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_clipboard_paste}" Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Button.Content>
</Button>
<Button x:Name="DeleteProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
Width="26" Height="26" HorizontalAlignment="Right" Margin="10,0,0,0" ToolTip="Delete profile"
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
<Button.Content>
<Rectangle
Fill="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Button}}}"
Width="12" Height="12">
<Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_delete}" Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Button.Content>
</Button>
<Rectangle.OpacityMask>
<VisualBrush Visual="{StaticResource appbar_delete}" Stretch="Fill" />
</Rectangle.OpacityMask>
</Rectangle>
</Button.Content>
</Button>
</StackPanel>
<TextBlock VerticalAlignment="Top" Foreground="{DynamicResource HighlightBrush}" HorizontalAlignment="Left" Margin="5,5,0,0" Text="Note: To edit a default profile, duplicate it first." FontWeight="Bold"/>
</StackPanel>
<StackPanel Grid.Column="0" Grid.Row="2" Orientation="Horizontal" Margin="0,5,0,0" HorizontalAlignment="Right">
<StackPanel Grid.Column="0" Grid.Row="2" Orientation="Horizontal" Margin="0,6,0,0" HorizontalAlignment="Right">
<Button x:Name="ImportProfile" VerticalAlignment="Top" Style="{DynamicResource SquareButtonStyle}"
Height="26" HorizontalAlignment="Right" ToolTip="Import profile">
<Button.Content>
@ -143,7 +150,8 @@
dragDrop:DragDrop.IsDragSource="True"
dragDrop:DragDrop.IsDropTarget="True"
dragDrop:DragDrop.DropHandler="{Binding}"
ItemsSource="{Binding Path=Layers, Converter={StaticResource LayerOrderConverter}, ConverterParameter=Order}">
ItemsSource="{Binding Path=Layers, Converter={StaticResource LayerOrderConverter}, ConverterParameter=Order}"
IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}">
<i:Interaction.Behaviors>
<itemBehaviours:BindableSelectedItemBehavior SelectedItem="{Binding ProfileViewModel.SelectedLayer, Mode=TwoWay}" />
</i:Interaction.Behaviors>
@ -179,7 +187,7 @@
</Border>
<StackPanel Grid.Column="1" Grid.Row="2" Orientation="Horizontal" Margin="10,5,0,0" HorizontalAlignment="Right">
<Button x:Name="AddLayer" VerticalAlignment="Top"
Style="{DynamicResource SquareButtonStyle}" IsEnabled="{Binding ProfileSelected}"
Style="{DynamicResource SquareButtonStyle}" IsEnabled="{Binding Path=EditorEnabled, Mode=OneWay}"
Width="26" Height="26" ToolTip="Add layer" HorizontalAlignment="Left">
<Button.Content>
<Rectangle