1
0
mirror of https://github.com/DarthAffe/RGBSyncPlus synced 2025-12-13 09:28:31 +00:00

Compare commits

..

No commits in common. "master" and "v1.0.0.0" have entirely different histories.

10 changed files with 39 additions and 83 deletions

View File

@ -1,8 +1,2 @@
Since [RGB.NET](https://github.com/DarthAffe/RGB.NET) no longer supports reading colors from devices, syncing is no longer possible and this example no longer needed.
If you're looking for a software to control RGB-devices of different brands together consider checking out [Artemis](https://github.com/Artemis-RGB/Artemis).
# RGBSyncPlus
Tool to syncronize RGB devices
If you've issues with the configuration window not opening when clicking the Tray-Icon you can disable Tray-Minimization by changing ```"MinimizeToTray":true``` to ```"MinimizeToTray":false``` in _Settings.json_ in the installation directory. (If this entry isn't already included delete the file and start/close the program once.)

View File

@ -55,12 +55,6 @@ namespace RGBSyncPlus
ApplicationManager.Instance.Settings = settings;
ApplicationManager.Instance.Initialize();
if (!settings.MinimizeToTray) //HACK DarthAffe 02.12.2018: Workaround to create the window
{
ApplicationManager.Instance.OpenConfigurationCommand.Execute(null);
ApplicationManager.Instance.HideConfigurationCommand.Execute(null);
}
}
catch (Exception ex)
{

View File

@ -39,9 +39,6 @@ namespace RGBSyncPlus
private ActionCommand _openConfiguration;
public ActionCommand OpenConfigurationCommand => _openConfiguration ?? (_openConfiguration = new ActionCommand(OpenConfiguration));
private ActionCommand _hideConfiguration;
public ActionCommand HideConfigurationCommand => _hideConfiguration ?? (_hideConfiguration = new ActionCommand(HideConfiguration));
private ActionCommand _exitCommand;
public ActionCommand ExitCommand => _exitCommand ?? (_exitCommand = new ActionCommand(Exit));
@ -136,26 +133,10 @@ namespace RGBSyncPlus
}
}
private void HideConfiguration()
{
if (Settings.MinimizeToTray)
{
if (_configurationWindow.IsVisible)
_configurationWindow.Hide();
}
else
_configurationWindow.WindowState = WindowState.Minimized;
}
private void OpenConfiguration()
{
if (_configurationWindow == null) _configurationWindow = new ConfigurationWindow();
if (!_configurationWindow.IsVisible)
_configurationWindow.Show();
if (_configurationWindow.WindowState == WindowState.Minimized)
_configurationWindow.WindowState = WindowState.Normal;
_configurationWindow.Show();
}
private void Exit()

View File

@ -17,8 +17,6 @@ namespace RGBSyncPlus.Configuration
public double UpdateRate { get; set; } = 30.0;
public bool MinimizeToTray { get; set; } = true;
public List<SyncGroup> SyncGroups { get; set; } = new List<SyncGroup>();
#endregion

View File

@ -76,7 +76,7 @@ namespace RGBSyncPlus.Controls
closeButton.Click += (sender, args) => ApplicationManager.Instance.ExitCommand.Execute(null);
if (GetTemplateChild("PART_MinimizeButton") is Button minimizeButton)
minimizeButton.Click += (sender, args) => ApplicationManager.Instance.HideConfigurationCommand.Execute(null); //HACK DarthAffe 02.12.2018: This is a really dirty hack - hopefully this will never get more than one window ...
minimizeButton.Click += (sender, args) => Hide();
if (GetTemplateChild("PART_IconButton") is Button iconButton)
iconButton.Click += (sender, args) => IconCommand?.Execute(null);

View File

@ -320,7 +320,7 @@ namespace RGBSyncPlus.Controls
private void HSVChanged()
{
Color color = HSVColor.Create(_a, _hue, _saturation, _value);
Color color = Color.FromHSV(_a, _hue, _saturation, _value);
UpdateSelectedColor(color);
SetRGB(color);
UpdateUIColors();
@ -331,7 +331,7 @@ namespace RGBSyncPlus.Controls
{
_ignorePropertyChanged = true;
_a = color.GetA();
_a = color.A;
if (_sliderAlpha != null)
_sliderAlpha.Value = _a;
@ -342,15 +342,15 @@ namespace RGBSyncPlus.Controls
{
_ignorePropertyChanged = true;
_r = color.GetR();
_r = color.R;
if (_sliderRed != null)
_sliderRed.Value = _r;
_g = color.GetG();
_g = color.G;
if (_sliderGreen != null)
_sliderGreen.Value = _g;
_b = color.GetB();
_b = color.B;
if (_sliderBlue != null)
_sliderBlue.Value = _b;
@ -361,14 +361,15 @@ namespace RGBSyncPlus.Controls
{
_ignorePropertyChanged = true;
(_hue, _saturation, _value) = color.GetHSV();
_hue = color.Hue;
if (_sliderHue != null)
_sliderHue.Value = _hue;
_saturation = color.Saturation;
if (_sliderSaturation != null)
_sliderSaturation.Value = _saturation;
_value = color.Value;
if (_sliderValue != null)
_sliderValue.Value = _value;
@ -410,13 +411,13 @@ namespace RGBSyncPlus.Controls
private void UpdateUIColors()
{
Color hueColor = HSVColor.Create(_hue, 1, 1);
Color hueColor = Color.FromHSV(_hue, 1, 1);
if (_previewBrush != null)
_previewBrush.Color = WpfColor.FromArgb(_a, _r, _g, _b);
if (_selectorBrush != null)
_selectorBrush.Color = WpfColor.FromRgb(hueColor.GetR(), hueColor.GetG(), hueColor.GetB());
_selectorBrush.Color = WpfColor.FromRgb(hueColor.R, hueColor.G, hueColor.B);
if (_alphaBrush != null)
{
@ -444,36 +445,36 @@ namespace RGBSyncPlus.Controls
if (_hueBrush != null)
{
Color referenceColor1 = HSVColor.Create(0, _saturation, _value);
Color referenceColor2 = HSVColor.Create(60, _saturation, _value);
Color referenceColor3 = HSVColor.Create(120, _saturation, _value);
Color referenceColor4 = HSVColor.Create(180, _saturation, _value);
Color referenceColor5 = HSVColor.Create(240, _saturation, _value);
Color referenceColor6 = HSVColor.Create(300, _saturation, _value);
Color referenceColor1 = Color.FromHSV(0, _saturation, _value);
Color referenceColor2 = Color.FromHSV(60, _saturation, _value);
Color referenceColor3 = Color.FromHSV(120, _saturation, _value);
Color referenceColor4 = Color.FromHSV(180, _saturation, _value);
Color referenceColor5 = Color.FromHSV(240, _saturation, _value);
Color referenceColor6 = Color.FromHSV(300, _saturation, _value);
_hueBrush.GradientStops[0].Color = WpfColor.FromArgb(_a, referenceColor1.GetR(), referenceColor1.GetG(), referenceColor1.GetB());
_hueBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, referenceColor2.GetR(), referenceColor2.GetG(), referenceColor2.GetB());
_hueBrush.GradientStops[2].Color = WpfColor.FromArgb(_a, referenceColor3.GetR(), referenceColor3.GetG(), referenceColor3.GetB());
_hueBrush.GradientStops[3].Color = WpfColor.FromArgb(_a, referenceColor4.GetR(), referenceColor4.GetG(), referenceColor4.GetB());
_hueBrush.GradientStops[4].Color = WpfColor.FromArgb(_a, referenceColor5.GetR(), referenceColor5.GetG(), referenceColor5.GetB());
_hueBrush.GradientStops[5].Color = WpfColor.FromArgb(_a, referenceColor6.GetR(), referenceColor6.GetG(), referenceColor6.GetB());
_hueBrush.GradientStops[6].Color = WpfColor.FromArgb(_a, referenceColor1.GetR(), referenceColor1.GetG(), referenceColor1.GetB());
_hueBrush.GradientStops[0].Color = WpfColor.FromArgb(_a, referenceColor1.R, referenceColor1.G, referenceColor1.B);
_hueBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, referenceColor2.R, referenceColor2.G, referenceColor2.B);
_hueBrush.GradientStops[2].Color = WpfColor.FromArgb(_a, referenceColor3.R, referenceColor3.G, referenceColor3.B);
_hueBrush.GradientStops[3].Color = WpfColor.FromArgb(_a, referenceColor4.R, referenceColor4.G, referenceColor4.B);
_hueBrush.GradientStops[4].Color = WpfColor.FromArgb(_a, referenceColor5.R, referenceColor5.G, referenceColor5.B);
_hueBrush.GradientStops[5].Color = WpfColor.FromArgb(_a, referenceColor6.R, referenceColor6.G, referenceColor6.B);
_hueBrush.GradientStops[6].Color = WpfColor.FromArgb(_a, referenceColor1.R, referenceColor1.G, referenceColor1.B);
}
if (_saturationBrush != null)
{
Color referenceColor = HSVColor.Create(_hue, 1, _value);
Color referenceColor = Color.FromHSV(_hue, 1, _value);
_saturationBrush.GradientStops[0].Color = WpfColor.FromArgb(_a, 255, 255, 255);
_saturationBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, referenceColor.GetR(), referenceColor.GetG(), referenceColor.GetB());
_saturationBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, referenceColor.R, referenceColor.G, referenceColor.B);
}
if (_valueBrush != null)
{
Color referenceColor = HSVColor.Create(_hue, _saturation, 1);
Color referenceColor = Color.FromHSV(_hue, _saturation, 1);
_valueBrush.GradientStops[0].Color = WpfColor.FromArgb(_a, 0, 0, 0);
_valueBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, referenceColor.GetR(), referenceColor.GetG(), referenceColor.GetB());
_valueBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, referenceColor.R, referenceColor.G, referenceColor.B);
}
}

View File

@ -167,8 +167,8 @@ namespace RGBSyncPlus.Controls
private void UpdatePreviewRectangle(Rectangle rect, double referenceWidth, double referenceHeight, double from, double to,
RGB.NET.Core.Color startColor, RGB.NET.Core.Color endColor)
{
rect.Fill = new LinearGradientBrush(Color.FromArgb(startColor.GetA(), startColor.GetR(), startColor.GetG(), startColor.GetB()),
Color.FromArgb(endColor.GetA(), endColor.GetR(), endColor.GetG(), endColor.GetB()),
rect.Fill = new LinearGradientBrush(Color.FromArgb(startColor.A, startColor.R, startColor.G, startColor.B),
Color.FromArgb(endColor.A, endColor.R, endColor.G, endColor.B),
new Point(0, 0.5), new Point(1, 0.5));
//DarthAffe 09.02.2018: Forced rounding to prevent render issues on resize
@ -212,7 +212,7 @@ namespace RGBSyncPlus.Controls
private void UpdateGradientStop(ContentControl control, double referenceWidth, double referenceHeight, GradientStop stop)
{
control.Background = new SolidColorBrush(Color.FromArgb(stop.Color.GetA(), stop.Color.GetR(), stop.Color.GetG(), stop.Color.GetB()));
control.Background = new SolidColorBrush(Color.FromArgb(stop.Color.A, stop.Color.R, stop.Color.G, stop.Color.B));
Canvas.SetLeft(control, (referenceWidth * stop.Offset.Clamp(0, 1)) - (control.Width / 2.0));

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="RGB.NET" value="http://nuget.arge.be/v3/index.json" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>

View File

@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.3")]
[assembly: AssemblyFileVersion("1.0.0.3")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -199,19 +199,19 @@
<Version>1.0.8</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.1</Version>
<Version>11.0.2</Version>
</PackageReference>
<PackageReference Include="RGB.NET.Brushes">
<Version>0.1.23</Version>
<Version>0.0.1.62</Version>
</PackageReference>
<PackageReference Include="RGB.NET.Core">
<Version>0.1.23</Version>
<Version>0.0.1.62</Version>
</PackageReference>
<PackageReference Include="RGB.NET.Decorators">
<Version>0.1.23</Version>
<Version>0.0.1.62</Version>
</PackageReference>
<PackageReference Include="RGB.NET.Groups">
<Version>0.1.23</Version>
<Version>0.0.1.62</Version>
</PackageReference>
<PackageReference Include="System.ValueTuple">
<Version>4.5.0</Version>