mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Project cleanup
This commit is contained in:
1 parent
9ad3e04a69
commit
adac6f4f8c
30 files changed
+254
-268
No files matched your search
@@ -31,7 +31,8 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a"
|
||||
culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
@@ -55,7 +56,8 @@
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Scripting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Scripting" publicKeyToken="31bf3856ad364e35"
|
||||
culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Teal.xaml" />
|
||||
|
||||
<!-- Artemis -->
|
||||
<ResourceDictionary Source="Styles/Visualizers/RGBSurfaceVisualizer.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="Styles/Visualizers/RGBDeviceVisualizer.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="Styles/Visualizers/LedVisualizer.xaml"></ResourceDictionary>
|
||||
<ResourceDictionary Source="Styles/Visualizers/RGBSurfaceVisualizer.xaml" />
|
||||
<ResourceDictionary Source="Styles/Visualizers/RGBDeviceVisualizer.xaml" />
|
||||
<ResourceDictionary Source="Styles/Visualizers/LedVisualizer.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<!-- MahApps Brushes -->
|
||||
|
||||
@@ -11,6 +11,16 @@ namespace Artemis.UI.Controls.Visualizers
|
||||
/// </summary>
|
||||
public class LedVisualizer : Control
|
||||
{
|
||||
public void Select()
|
||||
{
|
||||
BorderBrush = new SolidColorBrush(Colors.RoyalBlue);
|
||||
}
|
||||
|
||||
public void Deselect()
|
||||
{
|
||||
BorderBrush = new SolidColorBrush(Colors.Black);
|
||||
}
|
||||
|
||||
#region DependencyProperties
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
@@ -33,15 +43,5 @@ namespace Artemis.UI.Controls.Visualizers
|
||||
// ReSharper restore InconsistentNaming
|
||||
|
||||
#endregion
|
||||
|
||||
public void Select()
|
||||
{
|
||||
BorderBrush = new SolidColorBrush(Colors.RoyalBlue);
|
||||
}
|
||||
|
||||
public void Deselect()
|
||||
{
|
||||
BorderBrush = new SolidColorBrush(Colors.Black);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace Artemis.UI.Controls.Visualizers
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Visualizes a <see cref="T:RGB.NET.Core.IRGBDevice" /> in an wpf-application.
|
||||
/// Visualizes a <see cref="T:RGB.NET.Core.IRGBDevice" /> in an wpf-application.
|
||||
/// </summary>
|
||||
[TemplatePart(Name = PART_CANVAS, Type = typeof(Canvas))]
|
||||
public class RGBDeviceVisualizer : Control
|
||||
@@ -18,7 +18,7 @@ namespace Artemis.UI.Controls.Visualizers
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
public Canvas Canvas { get; private set; }
|
||||
|
||||
#endregion
|
||||
@@ -28,13 +28,13 @@ namespace Artemis.UI.Controls.Visualizers
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
/// <summary>
|
||||
/// Backing-property for the <see cref="Device"/>-property.
|
||||
/// Backing-property for the <see cref="Device" />-property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty DeviceProperty = DependencyProperty.Register(
|
||||
"Device", typeof(IRGBDevice), typeof(RGBDeviceVisualizer), new PropertyMetadata(default(IRGBDevice), DeviceChanged));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the <see cref="IRGBDevice"/> to visualize.
|
||||
/// Gets or sets the <see cref="IRGBDevice" /> to visualize.
|
||||
/// </summary>
|
||||
public IRGBDevice Device
|
||||
{
|
||||
@@ -69,7 +69,7 @@ namespace Artemis.UI.Controls.Visualizers
|
||||
|
||||
if (Device == null) return;
|
||||
|
||||
foreach (Led led in Device)
|
||||
foreach (var led in Device)
|
||||
Canvas.Children.Add(new LedVisualizer {Led = led});
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Artemis.UI.Controls.Visualizers
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Visualizes the <see cref="T:RGB.NET.Core.RGBSurface" /> in an wpf-application.
|
||||
/// Visualizes the <see cref="T:RGB.NET.Core.RGBSurface" /> in an wpf-application.
|
||||
/// </summary>
|
||||
[TemplatePart(Name = PART_CANVAS, Type = typeof(Canvas))]
|
||||
public class RGBSurfaceVisualizer : Control
|
||||
@@ -41,12 +41,12 @@ namespace Artemis.UI.Controls.Visualizers
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.WPF.Controls.RGBSurfaceVisualizer" /> class.
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.WPF.Controls.RGBSurfaceVisualizer" /> class.
|
||||
/// </summary>
|
||||
public RGBSurfaceVisualizer()
|
||||
{
|
||||
this.Loaded += OnLoaded;
|
||||
this.Unloaded += OnUnloaded;
|
||||
Loaded += OnLoaded;
|
||||
Unloaded += OnUnloaded;
|
||||
}
|
||||
|
||||
private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
|
||||
@@ -54,7 +54,7 @@ namespace Artemis.UI.Controls.Visualizers
|
||||
_surface = RGBSurface.Instance;
|
||||
|
||||
_surface.SurfaceLayoutChanged += RGBSurfaceOnSurfaceLayoutChanged;
|
||||
foreach (IRGBDevice device in _surface.Devices)
|
||||
foreach (var device in _surface.Devices)
|
||||
_newDevices.Add(device);
|
||||
|
||||
UpdateSurface();
|
||||
@@ -70,7 +70,7 @@ namespace Artemis.UI.Controls.Visualizers
|
||||
private void RGBSurfaceOnSurfaceLayoutChanged(SurfaceLayoutChangedEventArgs args)
|
||||
{
|
||||
if (args.DeviceAdded)
|
||||
foreach (IRGBDevice device in args.Devices)
|
||||
foreach (var device in args.Devices)
|
||||
_newDevices.Add(device);
|
||||
|
||||
UpdateSurface();
|
||||
@@ -89,6 +89,7 @@ namespace Artemis.UI.Controls.Visualizers
|
||||
_canvas.MouseLeftButtonDown -= ScrollViewerOnMouseLeftButtonDown;
|
||||
_canvas.MouseLeftButtonUp -= ScrollViewerOnMouseLeftButtonUp;
|
||||
}
|
||||
|
||||
_canvas?.Children.Clear();
|
||||
_canvas = (Canvas) GetTemplateChild(PART_CANVAS);
|
||||
|
||||
@@ -151,11 +152,11 @@ namespace Artemis.UI.Controls.Visualizers
|
||||
|
||||
private void UpdateSurface()
|
||||
{
|
||||
if ((_canvas == null) || (_surface == null)) return;
|
||||
if (_canvas == null || _surface == null) return;
|
||||
|
||||
if (_newDevices.Count > 0)
|
||||
{
|
||||
foreach (IRGBDevice device in _newDevices)
|
||||
foreach (var device in _newDevices)
|
||||
_canvas.Children.Add(new RGBDeviceVisualizer {Device = device});
|
||||
_newDevices.Clear();
|
||||
}
|
||||
|
||||
@@ -2,30 +2,31 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using Color = RGB.NET.Core.Color;
|
||||
|
||||
namespace Artemis.UI.Converters
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Converts <see cref="T:RGB.NET.Core.Color" /> into <see cref="T:System.Windows.Media.SolidColorBrush" />.
|
||||
/// Converts <see cref="T:RGB.NET.Core.Color" /> into <see cref="T:System.Windows.Media.SolidColorBrush" />.
|
||||
/// </summary>
|
||||
[ValueConversion(typeof(RGB.NET.Core.Color), typeof(SolidColorBrush))]
|
||||
[ValueConversion(typeof(Color), typeof(SolidColorBrush))]
|
||||
public class ColorToSolidColorBrushConverter : IValueConverter
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return new SolidColorBrush(!(value is RGB.NET.Core.Color color)
|
||||
? Color.FromArgb(0, 0, 0, 0)
|
||||
: Color.FromArgb(color.A, color.R, color.G, color.B));
|
||||
return new SolidColorBrush(!(value is Color color)
|
||||
? System.Windows.Media.Color.FromArgb(0, 0, 0, 0)
|
||||
: System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return !(value is SolidColorBrush brush)
|
||||
? RGB.NET.Core.Color.Transparent
|
||||
: new RGB.NET.Core.Color(brush.Color.A, brush.Color.R, brush.Color.G, brush.Color.B);
|
||||
? Color.Transparent
|
||||
: new Color(brush.Color.A, brush.Color.R, brush.Color.G, brush.Color.B);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,5 @@
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public interface IArtemisUIService
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Artemis.UI.Controls.Visualizers"
|
||||
xmlns:converters="clr-namespace:Artemis.UI.Converters">
|
||||
|
||||
|
||||
<converters:ColorToSolidColorBrushConverter x:Key="ConverterColorToSolidColorBrush" />
|
||||
|
||||
<ControlTemplate x:Key="ControlTemplateLedRectangle" TargetType="{x:Type controls:LedVisualizer}">
|
||||
@@ -50,12 +50,12 @@
|
||||
<Path Opacity="0.5"
|
||||
Clip="{Binding Data, RelativeSource={RelativeSource Self}}"
|
||||
Stroke="{TemplateBinding BorderBrush}"
|
||||
StrokeThickness="2"
|
||||
StrokeThickness="2"
|
||||
Fill="{TemplateBinding Background}">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="{Binding Led.ShapeData, RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<PathGeometry.Transform>
|
||||
<ScaleTransform ScaleX="{Binding ActualWidth, ElementName=Border}"
|
||||
<ScaleTransform ScaleX="{Binding ActualWidth, ElementName=Border}"
|
||||
ScaleY="{Binding ActualHeight, ElementName=Border}" />
|
||||
</PathGeometry.Transform>
|
||||
</PathGeometry>
|
||||
@@ -67,11 +67,14 @@
|
||||
<Style x:Key="StyleLedVisualizer" TargetType="{x:Type controls:LedVisualizer}">
|
||||
<Setter Property="Width" Value="{Binding Led.LedRectangle.Size.Width, RelativeSource={RelativeSource Self}}" />
|
||||
<Setter Property="Height" Value="{Binding Led.LedRectangle.Size.Height, RelativeSource={RelativeSource Self}}" />
|
||||
<Setter Property="Canvas.Left" Value="{Binding Led.LedRectangle.Location.X, RelativeSource={RelativeSource Self}}" />
|
||||
<Setter Property="Canvas.Top" Value="{Binding Led.LedRectangle.Location.Y, RelativeSource={RelativeSource Self}}" />
|
||||
<Setter Property="Canvas.Left"
|
||||
Value="{Binding Led.LedRectangle.Location.X, RelativeSource={RelativeSource Self}}" />
|
||||
<Setter Property="Canvas.Top"
|
||||
Value="{Binding Led.LedRectangle.Location.Y, RelativeSource={RelativeSource Self}}" />
|
||||
|
||||
<Setter Property="BorderBrush" Value="#000000" />
|
||||
<Setter Property="Background" Value="{Binding Led.Color, RelativeSource={RelativeSource Self},
|
||||
<Setter Property="Background"
|
||||
Value="{Binding Led.Color, RelativeSource={RelativeSource Self},
|
||||
Converter={StaticResource ConverterColorToSolidColorBrush}}" />
|
||||
|
||||
<Setter Property="Template" Value="{StaticResource ControlTemplateLedRectangle}" />
|
||||
@@ -80,7 +83,7 @@
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="BorderBrush" Value="#FFFFFF" />
|
||||
</Trigger>
|
||||
|
||||
|
||||
<DataTrigger Binding="{Binding Led.Shape, RelativeSource={RelativeSource Self}}" Value="Circle">
|
||||
<Setter Property="Template" Value="{StaticResource ControlTemplateLedCircle}" />
|
||||
</DataTrigger>
|
||||
@@ -91,5 +94,5 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type controls:LedVisualizer}" BasedOn="{StaticResource StyleLedVisualizer}" />
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -1,7 +1,7 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Artemis.UI.Controls.Visualizers">
|
||||
|
||||
|
||||
<Style x:Key="StyleRGBDeviceVisualizer" TargetType="{x:Type controls:RGBDeviceVisualizer}">
|
||||
<Setter Property="Width" Value="{Binding Device.Size.Width, RelativeSource={RelativeSource Self}}" />
|
||||
<Setter Property="Height" Value="{Binding Device.Size.Height, RelativeSource={RelativeSource Self}}" />
|
||||
@@ -23,16 +23,16 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:RGBDeviceVisualizer}">
|
||||
<Grid VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{TemplateBinding Background}">
|
||||
<Canvas x:Name="PART_Canvas"
|
||||
<Canvas x:Name="PART_Canvas"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch" />
|
||||
|
||||
<Border VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{x:Null}" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Artemis.UI.Stylet
|
||||
DefaultConfigureIoC(Kernel);
|
||||
ConfigureIoC(Kernel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Carries out default configuration of the IoC container. Override if you don't want to do this
|
||||
|
||||
@@ -171,4 +171,4 @@
|
||||
</DockPanel>
|
||||
</materialDesign:DrawerHost>
|
||||
</materialDesign:DialogHost>
|
||||
</metro:MetroWindow>
|
||||
</metro:MetroWindow>
|
||||
@@ -8,7 +8,8 @@
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" />
|
||||
<ResourceDictionary
|
||||
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<packages>
|
||||
<package id="Castle.Core" version="4.2.1" targetFramework="net461" />
|
||||
<package id="ControlzEx" version="3.0.2.4" targetFramework="net461" />
|
||||
|
||||
Reference in new issue
Block a user