-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
401 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<mahapps:MetroWindow x:Class="CSAuto.DebugSettings" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:CSAuto" | ||
xmlns:properties="clr-namespace:CSAuto.Properties" | ||
xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" | ||
mc:Ignorable="d" | ||
TitleCharacterCasing="Normal" | ||
Title="Debug Settings" Height="450" Width="800"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="*"/> | ||
</Grid.RowDefinitions> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*"/> | ||
<ColumnDefinition Width="*"/> | ||
</Grid.ColumnDefinitions> | ||
<StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="0"> | ||
<StackPanel Orientation="Horizontal"> | ||
<TextBlock x:Name="OriginalActive" Text="Original Color:" HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
</StackPanel> | ||
<StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="0"> | ||
<TextBlock Text="Active Color:" HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
<TextBox x:Name="ActiveColorRed" PreviewTextInput="NumberValidationTextBox" Margin="15,0,0,0" Width="50" MaxLength="3"/> | ||
<TextBox x:Name="ActiveColorGreen" PreviewTextInput="NumberValidationTextBox" Margin="15,0,0,0" Width="50" MaxLength="3"/> | ||
<TextBox x:Name="ActiveColorBlue" PreviewTextInput="NumberValidationTextBox" Margin="15,0,0,0" Width="50" MaxLength="3"/> | ||
</StackPanel> | ||
</StackPanel> | ||
<StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="1"> | ||
<StackPanel Orientation="Horizontal"> | ||
<TextBlock x:Name="OriginalRegular" Text="Original Color:" HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
</StackPanel> | ||
<StackPanel Orientation="Horizontal"> | ||
<TextBlock Text="Regular Color:" HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
<TextBox x:Name="RegularColorRed" PreviewTextInput="NumberValidationTextBox" Margin="15,0,0,0" Width="50" MaxLength="3"/> | ||
<TextBox x:Name="RegularColorGreen" PreviewTextInput="NumberValidationTextBox" Margin="15,0,0,0" Width="50" MaxLength="3"/> | ||
<TextBox x:Name="RegularColorBlue" PreviewTextInput="NumberValidationTextBox" Margin="15,0,0,0" Width="50" MaxLength="3"/> | ||
</StackPanel> | ||
</StackPanel> | ||
|
||
<CheckBox Content="Press Accept Button" Grid.Row="1" Grid.Column="0" IsChecked="{Binding Source={x:Static properties:DebugSettings.Default},Path=pressAcceptButton}"/> | ||
|
||
<Button x:Name="ApplyButton" Content="Apply" Grid.RowSpan="100" Grid.ColumnSpan="100" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="ApplyButton_Click"/> | ||
</Grid> | ||
</mahapps:MetroWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using MahApps.Metro.Controls; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Drawing; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Text.RegularExpressions; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Interop; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Shapes; | ||
|
||
namespace CSAuto | ||
{ | ||
/// <summary> | ||
/// Interaction logic for DebugSettings.xaml | ||
/// </summary> | ||
public partial class DebugSettings : MetroWindow | ||
{ | ||
private MainApp main; | ||
|
||
public DebugSettings(MainApp main) | ||
{ | ||
this.main = main; | ||
|
||
InitializeComponent(); | ||
|
||
if (main.current.IsWindows11) | ||
{ | ||
IntPtr hWnd = new WindowInteropHelper(GetWindow(this)).EnsureHandle(); | ||
var attribute = NativeMethods.DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE; | ||
var preference = NativeMethods.DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND; | ||
NativeMethods.DwmSetWindowAttribute(hWnd, attribute, ref preference, sizeof(uint)); | ||
} | ||
|
||
Color regularColor = main.BUTTON_COLORS[0]; | ||
RegularColorRed.Text = regularColor.R.ToString(); | ||
RegularColorGreen.Text = regularColor.G.ToString(); | ||
RegularColorBlue.Text = regularColor.B.ToString(); | ||
OriginalRegular.Text = $"Original Color: {regularColor}"; | ||
Color activeColor = main.BUTTON_COLORS[1]; | ||
ActiveColorRed.Text = activeColor.R.ToString(); | ||
ActiveColorGreen.Text = activeColor.G.ToString(); | ||
ActiveColorBlue.Text = activeColor.B.ToString(); | ||
OriginalActive.Text = $"Original Color: {activeColor}"; | ||
} | ||
|
||
private void NumberValidationTextBox(object sender, TextCompositionEventArgs e) | ||
{ | ||
Regex regex = new Regex("[^0-9]+"); | ||
e.Handled = regex.IsMatch(e.Text); | ||
} | ||
|
||
private void ApplyButton_Click(object sender, RoutedEventArgs e) | ||
{ | ||
main.BUTTON_COLORS[0] = | ||
Color.FromArgb(int.Parse(RegularColorRed.Text), | ||
int.Parse(RegularColorGreen.Text), | ||
int.Parse(RegularColorBlue.Text)); | ||
main.BUTTON_COLORS[1] = | ||
Color.FromArgb(int.Parse(ActiveColorRed.Text), | ||
int.Parse(ActiveColorGreen.Text), | ||
int.Parse(ActiveColorBlue.Text)); | ||
main.UpdateColors(); | ||
Properties.DebugSettings.Default.Save(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.