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"> <setting name="CheckForUpdates" serializeAs="String">
<value>True</value> <value>True</value>
</setting> </setting>
<setting name="Theme" serializeAs="String">
<value>Light</value>
</setting>
</Artemis.Settings.General> </Artemis.Settings.General>
</userSettings> </userSettings>
<runtime> <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/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" /> <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
<!-- Accent and AppTheme setting --> <!-- 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/Teal.xaml" />
<ResourceDictionary <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
<ResourceDictionary Source="/Resources/Icons.xaml" /> <ResourceDictionary Source="/Resources/Icons.xaml" />
<ResourceDictionary Source="Styles/ColorBox.xaml" /> <ResourceDictionary Source="Styles/ColorBox.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>

View File

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

View File

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

View File

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

View File

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

View File

@ -7,14 +7,14 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="476.986" d:DesignWidth="538.772"> d:DesignHeight="476.986" d:DesignWidth="538.772">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"> <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Grid Margin="15, 5, 15, 5"> <Grid Margin="15,5,5,5">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="80" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
@ -39,8 +39,8 @@
<StackPanel Grid.Row="1" <StackPanel Grid.Row="1"
Grid.Column="0" Grid.Column="0"
Grid.ColumnSpan="2" Margin="0,0,1,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> <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=GameSettings.GameDirectory, Mode=TwoWay}" Text="{Binding Path=GameSettings.GameDirectory, Mode=TwoWay}"
@ -52,7 +52,7 @@
</StackPanel> </StackPanel>
<!-- Profile editor --> <!-- 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 --> <!-- Buttons -->
<StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom"> <StackPanel Grid.Column="0" Grid.Row="4" Orientation="Horizontal" VerticalAlignment="Bottom">

View File

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

View File

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

View File

@ -6,8 +6,8 @@
xmlns:cal="http://www.caliburnproject.org" xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="386.842" d:DesignWidth="554.887"> d:DesignHeight="386.842" d:DesignWidth="554.887">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"> <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<Grid Margin="15, 5, 15, 5"> <Grid Margin="15, 5, 5, 5">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
@ -34,11 +34,12 @@
cal:Message.Attach="[Event Click] = [Action ToggleEffect]" /> cal:Message.Attach="[Event Click] = [Action ToggleEffect]" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8" <TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold" TextAlignment="Justify" MaxWidth="820"> 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. 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> </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 --> <!-- 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,-30,0" />

View File

@ -118,5 +118,17 @@ namespace Artemis.Settings {
this["CheckForUpdates"] = value; 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'?> <?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">
@ -28,5 +26,8 @@
<Setting Name="CheckForUpdates" Type="System.Boolean" Scope="User"> <Setting Name="CheckForUpdates" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value> <Value Profile="(Default)">True</Value>
</Setting> </Setting>
<Setting Name="Theme" Type="System.String" Scope="User">
<Value Profile="(Default)">Light</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -2,12 +2,20 @@
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices.ComTypes; using System.Runtime.InteropServices.ComTypes;
using System.Windows;
using Artemis.Utilities; using Artemis.Utilities;
using MahApps.Metro;
namespace Artemis.Settings namespace Artemis.Settings
{ {
public class GeneralSettings 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 public int GamestatePort
{ {
get { return General.Default.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() private void ApplyGamestatePort()
{ {
// TODO: Restart Gamestate server with new port // TODO: Restart Gamestate server with new port
@ -83,9 +101,30 @@ namespace Artemis.Settings
General.Default.Save(); General.Default.Save();
ApplyAutorun(); ApplyAutorun();
ApplyTheme();
ApplyGamestatePort(); 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() public void ResetSettings()
{ {
GamestatePort = 51364; GamestatePort = 51364;
@ -93,6 +132,7 @@ namespace Artemis.Settings
Autorun = true; Autorun = true;
CheckForUpdates = true; CheckForUpdates = true;
ShowOnStartup = true; ShowOnStartup = true;
Theme = "Light";
SaveSettings(); SaveSettings();
} }

View File

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

View File

@ -59,6 +59,8 @@ namespace Artemis.ViewModels.Profiles
public ProfileViewModel ProfileViewModel { get; set; } public ProfileViewModel ProfileViewModel { get; set; }
public bool EditorEnabled => SelectedProfile != null && !SelectedProfile.IsDefault;
public BindableCollection<ProfileModel> Profiles public BindableCollection<ProfileModel> Profiles
{ {
get { return _profiles; } get { return _profiles; }
@ -204,6 +206,8 @@ namespace Artemis.ViewModels.Profiles
if (e.PropertyName != "SelectedProfile") if (e.PropertyName != "SelectedProfile")
return; return;
// Update editor enabled state
NotifyOfPropertyChange(() => EditorEnabled);
// Update ProfileViewModel // Update ProfileViewModel
ProfileViewModel.SelectedProfile = SelectedProfile; ProfileViewModel.SelectedProfile = SelectedProfile;
// Update interface // Update interface
@ -524,6 +528,7 @@ namespace Artemis.ViewModels.Profiles
return; return;
} }
newProfile.IsDefault = false;
ProfileProvider.AddOrUpdate(newProfile); ProfileProvider.AddOrUpdate(newProfile);
LoadProfiles(); LoadProfiles();
SelectedProfile = Profiles.FirstOrDefault(p => p.Name == newProfile.Name); 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); layer.Draw<object>(null, drawingContext, true, false);
// Get the selection color // Get the selection color
var color = (Color) ThemeManager.DetectAppStyle(Application.Current).Item2.Resources["AccentColor"]; var accentColor = ThemeManager.DetectAppStyle(Application.Current)?.Item2?.Resources["AccentColor"];
var pen = new Pen(new SolidColorBrush(color), 0.4); if (accentColor == null)
return;
var pen = new Pen(new SolidColorBrush((Color) accentColor), 0.4);
// Draw the selection outline and resize indicator // Draw the selection outline and resize indicator
if (SelectedLayer != null && SelectedLayer.MustDraw()) if (SelectedLayer != null && SelectedLayer.MustDraw())
@ -168,7 +171,7 @@ namespace Artemis.ViewModels.Profiles
/// <param name="e"></param> /// <param name="e"></param>
public void MouseUpKeyboardPreview(MouseButtonEventArgs e) public void MouseUpKeyboardPreview(MouseButtonEventArgs e)
{ {
if (SelectedProfile == null) if (SelectedProfile == null || SelectedProfile.IsDefault)
return; return;
var timeSinceDown = DateTime.Now - _downTime; 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="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
@ -50,45 +51,51 @@
IsChecked="{Binding Path=GeneralSettings.ShowOnStartup, Mode=TwoWay}" IsChecked="{Binding Path=GeneralSettings.ShowOnStartup, Mode=TwoWay}"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="125" /> VerticalAlignment="Center" HorizontalAlignment="Right" Width="125" />
<!-- Keyboard selection --> <!-- Theme selection -->
<Label Grid.Row="3" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left" <Label Grid.Row="3" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Keyboard:" /> Content="Theme:" />
<ComboBox Grid.Row="3" Grid.Column="1" x:Name="KeyboardProviders" Margin="10" VerticalAlignment="Center" <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" HorizontalAlignment="Right"
Width="140" /> Width="140" />
<!-- TODO: Ugly -->
<!-- Gamestate port --> <!-- 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:" /> 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" HorizontalAlignment="Right" Width="120"
Value="{Binding Path=GeneralSettings.GamestatePort, Mode=TwoWay}" /> Value="{Binding Path=GeneralSettings.GamestatePort, Mode=TwoWay}" />
<!-- Updates check --> <!-- 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:" /> 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" VerticalAlignment="Center" HorizontalAlignment="Right" Width="125"
IsChecked="{Binding Path=GeneralSettings.CheckForUpdates, Mode=TwoWay}" /> IsChecked="{Binding Path=GeneralSettings.CheckForUpdates, Mode=TwoWay}" />
<!-- Update pointers --> <!-- 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:" /> 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" 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="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" VerticalAlignment="Center" HorizontalAlignment="Left" Width="120"
Style="{DynamicResource SquareButtonStyle}" /> 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" VerticalAlignment="Center" HorizontalAlignment="Right" Width="120"
Style="{DynamicResource SquareButtonStyle}" /> Style="{DynamicResource SquareButtonStyle}" />
<!-- Version --> <!-- 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> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />

View File

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