mirror of
https://github.com/DarthAffe/RGBSyncPlus
synced 2025-12-12 17:08:31 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ea97964cc | |||
| b694510853 | |||
| b783572a73 | |||
| 5ffcaab409 | |||
| d356501ea9 | |||
| 065a695e1d | |||
| 7b0778c178 | |||
| a4e72347a0 |
@ -1,2 +1,8 @@
|
||||
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.)
|
||||
|
||||
@ -55,6 +55,12 @@ 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)
|
||||
{
|
||||
|
||||
@ -39,6 +39,9 @@ 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));
|
||||
|
||||
@ -133,10 +136,26 @@ 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();
|
||||
_configurationWindow.Show();
|
||||
|
||||
if (!_configurationWindow.IsVisible)
|
||||
_configurationWindow.Show();
|
||||
|
||||
if (_configurationWindow.WindowState == WindowState.Minimized)
|
||||
_configurationWindow.WindowState = WindowState.Normal;
|
||||
}
|
||||
|
||||
private void Exit()
|
||||
|
||||
@ -17,6 +17,8 @@ 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
|
||||
|
||||
@ -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) => Hide();
|
||||
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 ...
|
||||
|
||||
if (GetTemplateChild("PART_IconButton") is Button iconButton)
|
||||
iconButton.Click += (sender, args) => IconCommand?.Execute(null);
|
||||
|
||||
@ -320,7 +320,7 @@ namespace RGBSyncPlus.Controls
|
||||
|
||||
private void HSVChanged()
|
||||
{
|
||||
Color color = Color.FromHSV(_a, _hue, _saturation, _value);
|
||||
Color color = HSVColor.Create(_a, _hue, _saturation, _value);
|
||||
UpdateSelectedColor(color);
|
||||
SetRGB(color);
|
||||
UpdateUIColors();
|
||||
@ -331,7 +331,7 @@ namespace RGBSyncPlus.Controls
|
||||
{
|
||||
_ignorePropertyChanged = true;
|
||||
|
||||
_a = color.A;
|
||||
_a = color.GetA();
|
||||
if (_sliderAlpha != null)
|
||||
_sliderAlpha.Value = _a;
|
||||
|
||||
@ -342,15 +342,15 @@ namespace RGBSyncPlus.Controls
|
||||
{
|
||||
_ignorePropertyChanged = true;
|
||||
|
||||
_r = color.R;
|
||||
_r = color.GetR();
|
||||
if (_sliderRed != null)
|
||||
_sliderRed.Value = _r;
|
||||
|
||||
_g = color.G;
|
||||
_g = color.GetG();
|
||||
if (_sliderGreen != null)
|
||||
_sliderGreen.Value = _g;
|
||||
|
||||
_b = color.B;
|
||||
_b = color.GetB();
|
||||
if (_sliderBlue != null)
|
||||
_sliderBlue.Value = _b;
|
||||
|
||||
@ -361,15 +361,14 @@ namespace RGBSyncPlus.Controls
|
||||
{
|
||||
_ignorePropertyChanged = true;
|
||||
|
||||
_hue = color.Hue;
|
||||
(_hue, _saturation, _value) = color.GetHSV();
|
||||
|
||||
if (_sliderHue != null)
|
||||
_sliderHue.Value = _hue;
|
||||
|
||||
_saturation = color.Saturation;
|
||||
if (_sliderSaturation != null)
|
||||
_sliderSaturation.Value = _saturation;
|
||||
|
||||
_value = color.Value;
|
||||
if (_sliderValue != null)
|
||||
_sliderValue.Value = _value;
|
||||
|
||||
@ -411,13 +410,13 @@ namespace RGBSyncPlus.Controls
|
||||
|
||||
private void UpdateUIColors()
|
||||
{
|
||||
Color hueColor = Color.FromHSV(_hue, 1, 1);
|
||||
Color hueColor = HSVColor.Create(_hue, 1, 1);
|
||||
|
||||
if (_previewBrush != null)
|
||||
_previewBrush.Color = WpfColor.FromArgb(_a, _r, _g, _b);
|
||||
|
||||
if (_selectorBrush != null)
|
||||
_selectorBrush.Color = WpfColor.FromRgb(hueColor.R, hueColor.G, hueColor.B);
|
||||
_selectorBrush.Color = WpfColor.FromRgb(hueColor.GetR(), hueColor.GetG(), hueColor.GetB());
|
||||
|
||||
if (_alphaBrush != null)
|
||||
{
|
||||
@ -445,36 +444,36 @@ namespace RGBSyncPlus.Controls
|
||||
|
||||
if (_hueBrush != null)
|
||||
{
|
||||
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);
|
||||
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);
|
||||
|
||||
_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);
|
||||
_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());
|
||||
}
|
||||
|
||||
if (_saturationBrush != null)
|
||||
{
|
||||
Color referenceColor = Color.FromHSV(_hue, 1, _value);
|
||||
Color referenceColor = HSVColor.Create(_hue, 1, _value);
|
||||
|
||||
_saturationBrush.GradientStops[0].Color = WpfColor.FromArgb(_a, 255, 255, 255);
|
||||
_saturationBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, referenceColor.R, referenceColor.G, referenceColor.B);
|
||||
_saturationBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, referenceColor.GetR(), referenceColor.GetG(), referenceColor.GetB());
|
||||
}
|
||||
|
||||
if (_valueBrush != null)
|
||||
{
|
||||
Color referenceColor = Color.FromHSV(_hue, _saturation, 1);
|
||||
Color referenceColor = HSVColor.Create(_hue, _saturation, 1);
|
||||
|
||||
_valueBrush.GradientStops[0].Color = WpfColor.FromArgb(_a, 0, 0, 0);
|
||||
_valueBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, referenceColor.R, referenceColor.G, referenceColor.B);
|
||||
_valueBrush.GradientStops[1].Color = WpfColor.FromArgb(_a, referenceColor.GetR(), referenceColor.GetG(), referenceColor.GetB());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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.A, startColor.R, startColor.G, startColor.B),
|
||||
Color.FromArgb(endColor.A, endColor.R, endColor.G, endColor.B),
|
||||
rect.Fill = new LinearGradientBrush(Color.FromArgb(startColor.GetA(), startColor.GetR(), startColor.GetG(), startColor.GetB()),
|
||||
Color.FromArgb(endColor.GetA(), endColor.GetR(), endColor.GetG(), endColor.GetB()),
|
||||
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.A, stop.Color.R, stop.Color.G, stop.Color.B));
|
||||
control.Background = new SolidColorBrush(Color.FromArgb(stop.Color.GetA(), stop.Color.GetR(), stop.Color.GetG(), stop.Color.GetB()));
|
||||
|
||||
Canvas.SetLeft(control, (referenceWidth * stop.Offset.Clamp(0, 1)) - (control.Width / 2.0));
|
||||
|
||||
|
||||
12
RGBSync+/NuGet.Config
Normal file
12
RGBSync+/NuGet.Config
Normal file
@ -0,0 +1,12 @@
|
||||
<?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>
|
||||
@ -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.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.0.3")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.3")]
|
||||
|
||||
@ -199,19 +199,19 @@
|
||||
<Version>1.0.8</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Newtonsoft.Json">
|
||||
<Version>11.0.2</Version>
|
||||
<Version>12.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="RGB.NET.Brushes">
|
||||
<Version>0.0.1.70</Version>
|
||||
<Version>0.1.23</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="RGB.NET.Core">
|
||||
<Version>0.0.1.70</Version>
|
||||
<Version>0.1.23</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="RGB.NET.Decorators">
|
||||
<Version>0.0.1.70</Version>
|
||||
<Version>0.1.23</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="RGB.NET.Groups">
|
||||
<Version>0.0.1.70</Version>
|
||||
<Version>0.1.23</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.ValueTuple">
|
||||
<Version>4.5.0</Version>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user