mirror of
https://github.com/Stone-Red-Code/DesktopMagic.git
synced 2026-09-04 08:56:15 +02:00
- Code Cleanup
This commit is contained in:
@@ -94,19 +94,19 @@
|
|||||||
<Border CornerRadius="1" BorderThickness="1.5" BorderBrush="Gray" Height="23" Width="23" Margin="0,0,5,0">
|
<Border CornerRadius="1" BorderThickness="1.5" BorderBrush="Gray" Height="23" Width="23" Margin="0,0,5,0">
|
||||||
<Rectangle x:Name="primaryColorRechtangle" Fill="White" />
|
<Rectangle x:Name="primaryColorRechtangle" Fill="White" />
|
||||||
</Border>
|
</Border>
|
||||||
<Button Content="Change Primary Color" Height="23" FontSize="10" Click="ChangePrimaryColorButton_Click" />
|
<Button Content="Change Primary Color" Height="23" FontSize="12" FontWeight="Regular" Click="ChangePrimaryColorButton_Click"/>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<DockPanel Margin="0,0,0,5">
|
<DockPanel Margin="0,0,0,5">
|
||||||
<Border CornerRadius="1" BorderThickness="1.5" BorderBrush="Gray" Height="23" Width="23" Margin="0,0,5,0">
|
<Border CornerRadius="1" BorderThickness="1.5" BorderBrush="Gray" Height="23" Width="23" Margin="0,0,5,0">
|
||||||
<Rectangle x:Name="secondaryColorRechtangle" Fill="White" />
|
<Rectangle x:Name="secondaryColorRechtangle" Fill="White" />
|
||||||
</Border>
|
</Border>
|
||||||
<Button Content="Change Secondary Color" Height="23" FontSize="10" Click="ChangeSecondaryColorButton_Click" />
|
<Button Content="Change Secondary Color" Height="23" FontSize="12" FontWeight="Regular" Click="ChangeSecondaryColorButton_Click" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<DockPanel >
|
<DockPanel >
|
||||||
<Border CornerRadius="1" BorderThickness="1.5" BorderBrush="Gray" Height="23" Width="23" Margin="0,0,5,0">
|
<Border CornerRadius="1" BorderThickness="1.5" BorderBrush="Gray" Height="23" Width="23" Margin="0,0,5,0">
|
||||||
<Rectangle x:Name="backgroundColorRechtangle" Fill="White" />
|
<Rectangle x:Name="backgroundColorRechtangle" Fill="White" />
|
||||||
</Border>
|
</Border>
|
||||||
<Button Content="Change Background Color" Height="23" FontSize="10" Click="ChangeBackgroundColorButton_Click" />
|
<Button Content="Change Background Color" Height="23" FontSize="12" FontWeight="Regular" Click="ChangeBackgroundColorButton_Click" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Grid Grid.Row="1" VerticalAlignment="Bottom">
|
<Grid Grid.Row="1" VerticalAlignment="Bottom">
|
||||||
|
|||||||
@@ -362,52 +362,42 @@ namespace DesktopMagic
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(musicVisualizerColorTextBox.Text) && musicVisualizerColorTextBox.Text != "Default")
|
if (!string.IsNullOrWhiteSpace(musicVisualizerColorTextBox.Text) && musicVisualizerColorTextBox.Text != "Default")
|
||||||
{
|
{
|
||||||
try
|
if (musicVisualizerColorTextBox.Text.Length > 0)
|
||||||
{
|
{
|
||||||
if (musicVisualizerColorTextBox.Text.Length > 0)
|
if (musicVisualizerColorTextBox.Text.ToCharArray()[0] != '#')
|
||||||
{
|
{
|
||||||
if (musicVisualizerColorTextBox.Text.ToCharArray()[0] != '#')
|
musicVisualizerColorTextBox.Text = "#" + musicVisualizerColorTextBox.Text.Replace("#", "");
|
||||||
{
|
|
||||||
musicVisualizerColorTextBox.Text = "#" + musicVisualizerColorTextBox.Text.Replace("#", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
musicVisualizerColorTextBox.Text = "#";
|
|
||||||
musicVisualizerColorTextBox.Select(musicVisualizerColorTextBox.Text.Length, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (musicVisualizerColorTextBox.SelectionStart == 0)
|
|
||||||
{
|
|
||||||
if (musicVisualizerColorTextBox.Text.Length <= 2)
|
|
||||||
{
|
|
||||||
musicVisualizerColorTextBox.Select(musicVisualizerColorTextBox.Text.Length, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
musicVisualizerColorTextBox.Select(1, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
string hex = musicVisualizerColorTextBox.Text;
|
|
||||||
hex = hex.Replace("#", "");
|
|
||||||
|
|
||||||
if (hex.Length == 6)
|
|
||||||
{
|
|
||||||
System.Drawing.Color systemColor = System.Drawing.Color.FromArgb((byte)int.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber), (byte)int.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber), (byte)int.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber));
|
|
||||||
|
|
||||||
MusicVisualzerColor = systemColor;
|
|
||||||
musicVisualizerColorTextBox.Foreground = Brushes.Black;
|
|
||||||
|
|
||||||
key.SetValue("MusicVisualizerColor", musicVisualizerColorTextBox.Text);
|
|
||||||
SaveLayout();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
musicVisualizerColorTextBox.Foreground = Brushes.Red;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
else
|
||||||
|
{
|
||||||
|
musicVisualizerColorTextBox.Text = "#";
|
||||||
|
musicVisualizerColorTextBox.Select(musicVisualizerColorTextBox.Text.Length, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (musicVisualizerColorTextBox.SelectionStart == 0)
|
||||||
|
{
|
||||||
|
if (musicVisualizerColorTextBox.Text.Length <= 2)
|
||||||
|
{
|
||||||
|
musicVisualizerColorTextBox.Select(musicVisualizerColorTextBox.Text.Length, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
musicVisualizerColorTextBox.Select(1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string hex = musicVisualizerColorTextBox.Text;
|
||||||
|
|
||||||
|
if (MultiColorConverter.TryConvertToSystemColor(hex, out System.Drawing.Color systemColor))
|
||||||
|
{
|
||||||
|
MusicVisualzerColor = systemColor;
|
||||||
|
musicVisualizerColorTextBox.Foreground = Brushes.Black;
|
||||||
|
|
||||||
|
key.SetValue("MusicVisualizerColor", musicVisualizerColorTextBox.Text);
|
||||||
|
SaveLayout();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
musicVisualizerColorTextBox.Foreground = Brushes.Red;
|
musicVisualizerColorTextBox.Foreground = Brushes.Red;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user