diff --git a/AutoTrackR2/App.xaml b/AutoTrackR2/App.xaml index 0717447..ee45830 100644 --- a/AutoTrackR2/App.xaml +++ b/AutoTrackR2/App.xaml @@ -1,625 +1,632 @@ <Application x:Class="AutoTrackR2.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:local="clr-namespace:AutoTrackR2" - StartupUri="MainWindow.xaml"> - <Application.Resources> - <FontFamily x:Key="Orbitron">/AutoTrackR2;component/Fonts/Orbitron-Bold.ttf#Orbitron</FontFamily> - <FontFamily x:Key="Roboto">/AutoTrackR2;component/Fonts/Roboto-Regular.ttf#Roboto</FontFamily> - <FontFamily x:Key="Gemunu">/AutoTrackR2;component/Fonts/GemunuLibre-VariableFont_wght.ttf#GemunuLibre</FontFamily> + xmlns:local="clr-namespace:AutoTrackR2"> + <Application.Resources> + <FontFamily x:Key="Orbitron">/AutoTrackR2;component/Fonts/Orbitron-Bold.ttf#Orbitron</FontFamily> + <FontFamily x:Key="Roboto">/AutoTrackR2;component/Fonts/Roboto-Regular.ttf#Roboto</FontFamily> + <FontFamily x:Key="Gemunu">/AutoTrackR2;component/Fonts/GemunuLibre-VariableFont_wght.ttf#GemunuLibre</FontFamily> - <!-- Default theme --> - <Color x:Key="AccentColor">#00A9E0</Color> - <Color x:Key="BackgroundDarkColor">#0F1A2B</Color> - <Color x:Key="BackgroundLightColor">#1D2D44</Color> - <Color x:Key="TextColor">#FFFFFF</Color> - <Color x:Key="AltTextColor">#A88F2C</Color> + <!-- Default theme --> + <Color x:Key="AccentColor">#00A9E0</Color> + <Color x:Key="BackgroundDarkColor">#0F1A2B</Color> + <Color x:Key="BackgroundLightColor">#1D2D44</Color> + <Color x:Key="TextColor">#FFFFFF</Color> + <Color x:Key="AltTextColor">#A88F2C</Color> - <SolidColorBrush x:Key="TextBrush" - Color="{DynamicResource TextColor}"/> - <SolidColorBrush x:Key="AccentBrush" - Color="{DynamicResource AccentColor}"/> - <SolidColorBrush x:Key="BackgroundDarkBrush" - Color="{DynamicResource BackgroundDarkColor}"/> - <SolidColorBrush x:Key="BackgroundLightBrush" - Color="{DynamicResource BackgroundLightColor}"/> - <SolidColorBrush x:Key="AltTextBrush" - Color="{DynamicResource AltTextColor}"/> + <SolidColorBrush x:Key="TextBrush" + Color="{DynamicResource TextColor}"/> + <SolidColorBrush x:Key="AccentBrush" + Color="{DynamicResource AccentColor}"/> + <SolidColorBrush x:Key="BackgroundDarkBrush" + Color="{DynamicResource BackgroundDarkColor}"/> + <SolidColorBrush x:Key="BackgroundLightBrush" + Color="{DynamicResource BackgroundLightColor}"/> + <SolidColorBrush x:Key="AltTextBrush" + Color="{DynamicResource AltTextColor}"/> - <!-- Define the Style for Window --> - <Style TargetType="Window" - x:Key="CustomWindowStyle"> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Window"> - <Border BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="2" - CornerRadius="10" - Background="{DynamicResource BackgroundLightBrush}"> - <Grid> - <ContentPresenter HorizontalAlignment="Stretch" - VerticalAlignment="Stretch"/> - </Grid> - </Border> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> + <!-- Define the Style for Window --> + <Style TargetType="Window" + x:Key="CustomWindowStyle"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Window"> + <Border BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="2" + CornerRadius="10" + Background="{DynamicResource BackgroundLightBrush}"> + <Grid> + <ContentPresenter HorizontalAlignment="Stretch" + VerticalAlignment="Stretch"/> + </Grid> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> - <!-- Tab Button Style --> - <Style x:Key="TabButtonStyle" - TargetType="Button"> - <Setter Property="Foreground" - Value="{DynamicResource TextBrush}"/> - <Setter Property="Background" - Value="{DynamicResource BackgroundDarkBrush}"/> - <Setter Property="BorderBrush" - Value="{DynamicResource AccentBrush}"/> - <Setter Property="BorderThickness" - Value="2"/> - <Setter Property="Cursor" - Value="Hand"/> - <Setter Property="Padding" - Value="10"/> - <Setter Property="Margin" - Value="5"/> - <Setter Property="FontFamily" - Value="{StaticResource Orbitron}"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Button"> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="{TemplateBinding BorderThickness}" - CornerRadius="5"> - <!-- ContentPresenter will automatically inherit Foreground from Button --> - <ContentPresenter HorizontalAlignment="Center" - VerticalAlignment="Center"/> - </Border> - </ControlTemplate> - </Setter.Value> - </Setter> - - </Style> - - - <!-- General Button Style --> - <Style x:Key="DisabledButtonStyle" - TargetType="Button"> - <Setter Property="Foreground" - Value="Gray"/> - <Setter Property="Background" - Value="{DynamicResource BackgroundDarkBrush}"/> - <Setter Property="BorderBrush" - Value="Gray"/> - <Setter Property="BorderThickness" - Value="2"/> - <Setter Property="FontWeight" - Value="Bold"/> - <Setter Property="Cursor" - Value="Hand"/> - <Setter Property="Padding" - Value="5"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Button"> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="{TemplateBinding BorderThickness}" - CornerRadius="5"> - <ContentPresenter HorizontalAlignment="Center" - VerticalAlignment="Center"/> - </Border> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - - <Style x:Key="ButtonStyle" - TargetType="Button"> - <Setter Property="Foreground" - Value="{DynamicResource TextBrush}"/> - <Setter Property="Background" - Value="{DynamicResource BackgroundDarkBrush}"/> - <Setter Property="BorderBrush" - Value="{DynamicResource AccentBrush}"/> - <Setter Property="BorderThickness" - Value="2"/> - <Setter Property="FontWeight" - Value="Bold"/> - <Setter Property="Cursor" - Value="Hand"/> - <Setter Property="Padding" - Value="5"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Button"> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="{TemplateBinding BorderThickness}" - CornerRadius="5"> - <ContentPresenter HorizontalAlignment="Center" - VerticalAlignment="Center"/> - </Border> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - - <!-- Title Bar Button Style --> - <Style x:Key="TitleButtonStyle" - TargetType="Button"> - <Setter Property="Foreground" - Value="{DynamicResource TextBrush}"/> - <Setter Property="Background" - Value="{DynamicResource BackgroundDarkBrush}"/> - <Setter Property="BorderBrush" - Value="{DynamicResource AccentBrush}"/> - <Setter Property="BorderThickness" - Value="2"/> - <Setter Property="FontWeight" - Value="Bold"/> - <Setter Property="Cursor" - Value="Hand"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Button"> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="2" - CornerRadius="5" - Margin="0,1,4,1"> - <ContentPresenter HorizontalAlignment="Center" - VerticalAlignment="Center"/> - </Border> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - - <!-- Custom style for text blocks --> - <Style x:Key="RoundedTextBlock" - TargetType="TextBlock"> - <Setter Property="Foreground" - Value="{DynamicResource TextBrush}"/> - <Setter Property="FontFamily" - Value="{StaticResource Roboto}"/> - <Setter Property="Background" - Value="Transparent"/> - <Setter Property="FontSize" - Value="14"/> - <Setter Property="Padding" - Value="10,0,10,0"/> - <Setter Property="VerticalAlignment" - Value="Center"/> - <Setter Property="HorizontalAlignment" - Value="Stretch"/> - </Style> - - <!-- Wrap TextBlock in Border to apply rounded corners --> - <Style x:Key="RoundedTextBlockWithBorder" - TargetType="Border"> - <Setter Property="Background" - Value="{DynamicResource BackgroundLightBrush}"/> - <Setter Property="BorderBrush" - Value="{DynamicResource AccentBrush}"/> - <Setter Property="BorderThickness" - Value="2"/> - <Setter Property="CornerRadius" - Value="5"/> - <Setter Property="Padding" - Value="0"/> - <Setter Property="Margin" - Value="0,10,0,0"/> - </Style> - - <!-- Custom Style for Rounded TextBox --> - <Style x:Key="RoundedTextBox" - TargetType="TextBox"> - <Setter Property="Foreground" - Value="{DynamicResource TextBrush}"/> - <Setter Property="Background" - Value="{DynamicResource BackgroundDarkBrush}"/> - <Setter Property="BorderBrush" - Value="{DynamicResource AccentBrush}"/> - <Setter Property="FontFamily" - Value="{StaticResource Roboto}"/> - <Setter Property="Height" - Value="30"/> - <Setter Property="Padding" - Value="5"/> - <Setter Property="VerticalContentAlignment" - Value="Center"/> - <Setter Property="HorizontalAlignment" - Value="Stretch"/> - <Setter Property="BorderBrush" - Value="{DynamicResource AccentBrush}"/> - <Setter Property="BorderThickness" - Value="2"/> - <!-- The actual border with rounded corners --> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="TextBox"> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="{TemplateBinding BorderThickness}" - CornerRadius="5"> - <ScrollViewer x:Name="PART_ContentHost"/> - </Border> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - - <!-- Custom Style for Rounded PasswordBox --> - <Style x:Key="RoundedPasswordBox" - TargetType="PasswordBox"> - <Setter Property="Foreground" - Value="{DynamicResource TextBrush}"/> - <Setter Property="Background" - Value="{DynamicResource BackgroundDarkBrush}"/> - <Setter Property="BorderBrush" - Value="{DynamicResource AccentBrush}"/> - <Setter Property="FontFamily" - Value="{StaticResource Roboto}"/> - <Setter Property="Height" - Value="30"/> - <Setter Property="Padding" - Value="5"/> - <Setter Property="VerticalContentAlignment" - Value="Center"/> - <Setter Property="HorizontalAlignment" - Value="Stretch"/> - <Setter Property="BorderBrush" - Value="{DynamicResource AccentBrush}"/> - <Setter Property="BorderThickness" - Value="2"/> - <!-- The actual border with rounded corners --> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="PasswordBox"> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="{TemplateBinding BorderThickness}" - CornerRadius="5"> - <ScrollViewer x:Name="PART_ContentHost"/> - </Border> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - - <!-- Custom Style for Slider --> - <Style x:Key="ThreePositionSlider" - TargetType="Slider"> - <Setter Property="Height" - Value="40"/> - <Setter Property="Width" - Value="160"/> - <Setter Property="Foreground" - Value="{DynamicResource TextBrush}"/> - <Setter Property="Background" - Value="{DynamicResource BackgroundDarkBrush}"/> - <Setter Property="BorderBrush" - Value="{DynamicResource AccentBrush}"/> - <Setter Property="BorderThickness" - Value="2"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Slider"> - <Grid Width="200" - Height="30" - HorizontalAlignment="Left" - Margin="58,-6,0,0"> - <!-- Track Background --> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="2" - CornerRadius="15" - Margin="0,0,-5,-4"/> - - <!-- Track --> - <Track x:Name="PART_Track"> - <Track.Thumb> - <Thumb x:Name="PART_Thumb" - Width="22" - Height="22" - Margin="6,4,1,0"> - <Thumb.Template> - <ControlTemplate TargetType="Thumb"> - <Ellipse Fill="{DynamicResource AccentBrush}"/> - </ControlTemplate> - </Thumb.Template> - </Thumb> - </Track.Thumb> - <Track.DecreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.DecreaseRepeatButton> - <Track.IncreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.IncreaseRepeatButton> - </Track> - </Grid> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - - <!-- Toggle Slider Style --> - <Style x:Key="ToggleSliderStyle" - TargetType="Slider"> - <Setter Property="Height" - Value="40"/> - <Setter Property="Width" - Value="160"/> - <Setter Property="Foreground" - Value="{DynamicResource TextBrush}"/> - <Setter Property="Background" - Value="{DynamicResource BackgroundDarkBrush}"/> - <Setter Property="BorderBrush" - Value="{DynamicResource AccentBrush}"/> - <Setter Property="BorderThickness" - Value="2"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Slider"> - <Grid Width="50" - Height="30" - HorizontalAlignment="Left"> - <!-- Track Background --> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="2" - CornerRadius="15" - Margin="0,0,-5,-4"/> - - <!-- Track --> - <Track x:Name="PART_Track"> - <Track.Thumb> - <Thumb x:Name="PART_Thumb" - Width="22" - Height="22" - Margin="6,4,1,0"> - <Thumb.Template> - <ControlTemplate TargetType="Thumb"> - <Ellipse Fill="{DynamicResource AccentBrush}"/> - </ControlTemplate> - </Thumb.Template> - </Thumb> - </Track.Thumb> - <Track.DecreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.DecreaseRepeatButton> - <Track.IncreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.IncreaseRepeatButton> - </Track> - </Grid> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - - <!-- False toggle theme --> - <Style x:Key="FalseToggleStyle" - TargetType="Slider"> - <Setter Property="Height" - Value="40"/> - <Setter Property="Width" - Value="160"/> - <Setter Property="Foreground" - Value="{DynamicResource TextBrush}"/> - <Setter Property="Background" - Value="{DynamicResource BackgroundDarkBrush}"/> - <Setter Property="BorderBrush" - Value="Gray"/> - <Setter Property="BorderThickness" - Value="2"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Slider"> - <Grid Width="50" - Height="30" - HorizontalAlignment="Left"> - <!-- Track Background --> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="2" - CornerRadius="15" - Margin="0,0,-5,-4"/> - - <!-- Track --> - <Track x:Name="PART_Track"> - <Track.Thumb> - <Thumb x:Name="PART_Thumb" - Width="22" - Height="22" - Margin="6,4,1,0"> - <Thumb.Template> - <ControlTemplate TargetType="Thumb"> - <Ellipse Fill="Gray"/> - </ControlTemplate> - </Thumb.Template> - </Thumb> - </Track.Thumb> - <Track.DecreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.DecreaseRepeatButton> - <Track.IncreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.IncreaseRepeatButton> - </Track> - </Grid> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - - <!-- Modern Rounded ScrollBar Style --> - <Style TargetType="ScrollBar"> - <Setter Property="Width" - Value="6"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="ScrollBar"> - <Grid> - <Track Name="PART_Track" - IsDirectionReversed="true" - Width="6" - Margin="0,0,0,0"> - <!-- Decrease Repeat Button --> - <Track.DecreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="0"> - <RepeatButton.Template> - <ControlTemplate TargetType="RepeatButton"> - <Grid x:Name="RepeatButtonGrid"> - <VisualStateManager.VisualStateGroups> - <VisualStateGroup Name="CommonStates"> - <VisualState Name="Normal"> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="Opacity" - Storyboard.TargetName="RepeatButtonGrid" - To="1" - Duration="0:0:0"/> - </Storyboard> - </VisualState> - <VisualState Name="MouseOver"> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="Opacity" - Storyboard.TargetName="RepeatButtonGrid" - To="0" - Duration="0:0:0.1"/> - </Storyboard> - </VisualState> - </VisualStateGroup> - </VisualStateManager.VisualStateGroups> - </Grid> - </ControlTemplate> - </RepeatButton.Template> - </RepeatButton> - </Track.DecreaseRepeatButton> - - - <!-- Thumb (Handle) --> - <Track.Thumb> - <Thumb> - <Thumb.Template> - <ControlTemplate TargetType="Thumb"> - <Grid> - <Border - Background="{DynamicResource AccentBrush}" + <!-- Tab Button Style --> + <Style x:Key="TabButtonStyle" + TargetType="Button"> + <Setter Property="Foreground" + Value="{DynamicResource TextBrush}"/> + <Setter Property="Background" + Value="{DynamicResource BackgroundDarkBrush}"/> + <Setter Property="BorderBrush" + Value="{DynamicResource AccentBrush}"/> + <Setter Property="BorderThickness" + Value="2"/> + <Setter Property="Cursor" + Value="Hand"/> + <Setter Property="Padding" + Value="10"/> + <Setter Property="Margin" + Value="5"/> + <Setter Property="FontFamily" + Value="{StaticResource Orbitron}"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Border Background="{DynamicResource BackgroundDarkBrush}" BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="0" - CornerRadius="3"/> + BorderThickness="{TemplateBinding BorderThickness}" + CornerRadius="5"> + <!-- ContentPresenter will automatically inherit Foreground from Button --> + <ContentPresenter HorizontalAlignment="Center" + VerticalAlignment="Center"/> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + + </Style> + + + <!-- General Button Style --> + <Style x:Key="DisabledButtonStyle" + TargetType="Button"> + <Setter Property="Foreground" + Value="Gray"/> + <Setter Property="Background" + Value="{DynamicResource BackgroundDarkBrush}"/> + <Setter Property="BorderBrush" + Value="Gray"/> + <Setter Property="BorderThickness" + Value="2"/> + <Setter Property="FontWeight" + Value="Bold"/> + <Setter Property="Cursor" + Value="Hand"/> + <Setter Property="Padding" + Value="5"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + CornerRadius="5"> + <ContentPresenter HorizontalAlignment="Center" + VerticalAlignment="Center"/> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="ButtonStyle" + TargetType="Button"> + <Setter Property="Foreground" + Value="{DynamicResource TextBrush}"/> + <Setter Property="Background" + Value="{DynamicResource BackgroundDarkBrush}"/> + <Setter Property="BorderBrush" + Value="{DynamicResource AccentBrush}"/> + <Setter Property="BorderThickness" + Value="2"/> + <Setter Property="FontWeight" + Value="Bold"/> + <Setter Property="Cursor" + Value="Hand"/> + <Setter Property="Padding" + Value="5"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + CornerRadius="5"> + <ContentPresenter HorizontalAlignment="Center" + VerticalAlignment="Center"/> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <!-- Title Bar Button Style --> + <Style x:Key="TitleButtonStyle" + TargetType="Button"> + <Setter Property="Foreground" + Value="{DynamicResource TextBrush}"/> + <Setter Property="Background" + Value="{DynamicResource BackgroundDarkBrush}"/> + <Setter Property="BorderBrush" + Value="{DynamicResource AccentBrush}"/> + <Setter Property="BorderThickness" + Value="2"/> + <Setter Property="FontWeight" + Value="Bold"/> + <Setter Property="Cursor" + Value="Hand"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Border Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + CornerRadius="5"> + <ContentPresenter HorizontalAlignment="Center" + VerticalAlignment="Center"/> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <!-- Custom style for text blocks --> + <Style x:Key="RoundedTextBlock" + TargetType="TextBlock"> + <Setter Property="Foreground" + Value="{DynamicResource TextBrush}"/> + <Setter Property="FontFamily" + Value="{StaticResource Roboto}"/> + <Setter Property="Background" + Value="Transparent"/> + <Setter Property="FontSize" + Value="14"/> + <Setter Property="Padding" + Value="10,0,10,0"/> + <Setter Property="VerticalAlignment" + Value="Center"/> + <Setter Property="HorizontalAlignment" + Value="Stretch"/> + </Style> + + <!-- Wrap TextBlock in Border to apply rounded corners --> + <Style x:Key="RoundedTextBlockWithBorder" + TargetType="Border"> + <Setter Property="Background" + Value="{DynamicResource BackgroundLightBrush}"/> + <Setter Property="BorderBrush" + Value="{DynamicResource AccentBrush}"/> + <Setter Property="BorderThickness" + Value="2"/> + <Setter Property="CornerRadius" + Value="5"/> + <Setter Property="Padding" + Value="0"/> + <Setter Property="Margin" + Value="0,10,0,0"/> + </Style> + + <!-- Custom Style for Rounded TextBox --> + <Style x:Key="RoundedTextBox" + TargetType="TextBox"> + <Setter Property="Foreground" + Value="{DynamicResource TextBrush}"/> + <Setter Property="Background" + Value="{DynamicResource BackgroundDarkBrush}"/> + <Setter Property="BorderBrush" + Value="{DynamicResource AccentBrush}"/> + <Setter Property="FontFamily" + Value="{StaticResource Roboto}"/> + <Setter Property="Height" + Value="30"/> + <Setter Property="Padding" + Value="5"/> + <Setter Property="VerticalContentAlignment" + Value="Center"/> + <Setter Property="HorizontalAlignment" + Value="Stretch"/> + <Setter Property="BorderBrush" + Value="{DynamicResource AccentBrush}"/> + <Setter Property="BorderThickness" + Value="2"/> + <!-- The actual border with rounded corners --> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="TextBox"> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + CornerRadius="5"> + <ScrollViewer x:Name="PART_ContentHost"/> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <!-- Custom Style for Rounded PasswordBox --> + <Style x:Key="RoundedPasswordBox" + TargetType="PasswordBox"> + <Setter Property="Foreground" + Value="{DynamicResource TextBrush}"/> + <Setter Property="Background" + Value="{DynamicResource BackgroundDarkBrush}"/> + <Setter Property="BorderBrush" + Value="{DynamicResource AccentBrush}"/> + <Setter Property="FontFamily" + Value="{StaticResource Roboto}"/> + <Setter Property="Height" + Value="30"/> + <Setter Property="Padding" + Value="5"/> + <Setter Property="VerticalContentAlignment" + Value="Center"/> + <Setter Property="HorizontalAlignment" + Value="Stretch"/> + <Setter Property="BorderBrush" + Value="{DynamicResource AccentBrush}"/> + <Setter Property="BorderThickness" + Value="2"/> + <!-- The actual border with rounded corners --> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="PasswordBox"> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + CornerRadius="5"> + <ScrollViewer x:Name="PART_ContentHost"/> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <!-- Custom Style for Slider --> + <Style x:Key="ThreePositionSlider" + TargetType="Slider"> + <Setter Property="Height" + Value="40"/> + <Setter Property="Width" + Value="160"/> + <Setter Property="Foreground" + Value="{DynamicResource TextBrush}"/> + <Setter Property="Background" + Value="{DynamicResource BackgroundDarkBrush}"/> + <Setter Property="BorderBrush" + Value="{DynamicResource AccentBrush}"/> + <Setter Property="BorderThickness" + Value="2"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Slider"> + <Grid Width="200" + Height="30" + HorizontalAlignment="Left" + Margin="58,-6,0,0"> + <!-- Track Background --> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="2" + CornerRadius="15" + Margin="0,0,-5,-4"/> + + <!-- Track --> + <Track x:Name="PART_Track"> + <Track.Thumb> + <Thumb x:Name="PART_Thumb" + Width="22" + Height="22" + Margin="6,4,1,0"> + <Thumb.Template> + <ControlTemplate TargetType="Thumb"> + <Ellipse Fill="{DynamicResource AccentBrush}"/> + </ControlTemplate> + </Thumb.Template> + </Thumb> + </Track.Thumb> + <Track.DecreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.DecreaseRepeatButton> + <Track.IncreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.IncreaseRepeatButton> + </Track> </Grid> - </ControlTemplate> - </Thumb.Template> - </Thumb> - </Track.Thumb> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> - <!-- Increase Repeat Button --> - <Track.IncreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="0"> - <RepeatButton.Template> - <ControlTemplate TargetType="RepeatButton"> - <Grid x:Name="RepeatButtonGrid"> - <VisualStateManager.VisualStateGroups> - <VisualStateGroup Name="CommonStates"> - <VisualState Name="Normal"> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="Opacity" - Storyboard.TargetName="RepeatButtonGrid" - To="1" - Duration="0:0:0"/> - </Storyboard> - </VisualState> - <VisualState Name="MouseOver"> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="Opacity" - Storyboard.TargetName="RepeatButtonGrid" - To="0" - Duration="0:0:0.1"/> - </Storyboard> - </VisualState> - </VisualStateGroup> - </VisualStateManager.VisualStateGroups> + <!-- Toggle Slider Style --> + <Style x:Key="ToggleSliderStyle" + TargetType="Slider"> + <Setter Property="Height" + Value="40"/> + <Setter Property="Width" + Value="160"/> + <Setter Property="Foreground" + Value="{DynamicResource TextBrush}"/> + <Setter Property="Background" + Value="{DynamicResource BackgroundDarkBrush}"/> + <Setter Property="BorderBrush" + Value="{DynamicResource AccentBrush}"/> + <Setter Property="BorderThickness" + Value="2"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Slider"> + <Grid Width="50" + Height="30" + HorizontalAlignment="Left"> + <!-- Track Background --> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="2" + CornerRadius="15" + Margin="0,0,-5,-4"/> + + <!-- Track --> + <Track x:Name="PART_Track"> + <Track.Thumb> + <Thumb x:Name="PART_Thumb" + Width="22" + Height="22" + Margin="6,4,1,0"> + <Thumb.Template> + <ControlTemplate TargetType="Thumb"> + <Ellipse Fill="{DynamicResource AccentBrush}"/> + </ControlTemplate> + </Thumb.Template> + </Thumb> + </Track.Thumb> + <Track.DecreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.DecreaseRepeatButton> + <Track.IncreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.IncreaseRepeatButton> + </Track> </Grid> - </ControlTemplate> - </RepeatButton.Template> - </RepeatButton> - </Track.IncreaseRepeatButton> - </Track> - </Grid> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> - <!-- Standard Slider Style --> - <Style x:Key="SliderStyle" TargetType="Slider"> - <Setter Property="Height" Value="40"/> - <Setter Property="Width" Value="160"/> - <Setter Property="Foreground" Value="{DynamicResource TextBrush}"/> - <Setter Property="Background" Value="{DynamicResource BackgroundDarkBrush}"/> - <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/> - <Setter Property="BorderThickness" Value="2"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Slider"> - <Grid Width="100" Height="30" HorizontalAlignment="Left"> - <!-- Track Background --> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="2" - CornerRadius="15" - Margin="0,0,-5,-4"/> + <!-- False toggle theme --> + <Style x:Key="FalseToggleStyle" + TargetType="Slider"> + <Setter Property="Height" + Value="40"/> + <Setter Property="Width" + Value="160"/> + <Setter Property="Foreground" + Value="{DynamicResource TextBrush}"/> + <Setter Property="Background" + Value="{DynamicResource BackgroundDarkBrush}"/> + <Setter Property="BorderBrush" + Value="Gray"/> + <Setter Property="BorderThickness" + Value="2"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Slider"> + <Grid Width="50" + Height="30" + HorizontalAlignment="Left"> + <!-- Track Background --> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="2" + CornerRadius="15" + Margin="0,0,-5,-4"/> - <!-- Track --> - <Track x:Name="PART_Track"> - <Track.Thumb> - <Thumb x:Name="PART_Thumb" - Width="22" - Height="22" - Margin="6,4,1,0"> - <Thumb.Template> - <ControlTemplate TargetType="Thumb"> - <Ellipse Fill="{DynamicResource AccentBrush}"/> - </ControlTemplate> - </Thumb.Template> - </Thumb> - </Track.Thumb> - <Track.DecreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.DecreaseRepeatButton> - <Track.IncreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.IncreaseRepeatButton> - </Track> - </Grid> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> + <!-- Track --> + <Track x:Name="PART_Track"> + <Track.Thumb> + <Thumb x:Name="PART_Thumb" + Width="22" + Height="22" + Margin="6,4,1,0"> + <Thumb.Template> + <ControlTemplate TargetType="Thumb"> + <Ellipse Fill="Gray"/> + </ControlTemplate> + </Thumb.Template> + </Thumb> + </Track.Thumb> + <Track.DecreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.DecreaseRepeatButton> + <Track.IncreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.IncreaseRepeatButton> + </Track> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> - </Application.Resources> + <!-- Modern Rounded ScrollBar Style --> + <Style TargetType="ScrollBar"> + <Setter Property="Width" + Value="6"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ScrollBar"> + <Grid> + <Track Name="PART_Track" + IsDirectionReversed="true" + Width="6" + Margin="0,0,0,0"> + <!-- Decrease Repeat Button --> + <Track.DecreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="0"> + <RepeatButton.Template> + <ControlTemplate TargetType="RepeatButton"> + <Grid x:Name="RepeatButtonGrid"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup Name="CommonStates"> + <VisualState Name="Normal"> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" + Storyboard.TargetName="RepeatButtonGrid" + To="1" + Duration="0:0:0"/> + </Storyboard> + </VisualState> + <VisualState Name="MouseOver"> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" + Storyboard.TargetName="RepeatButtonGrid" + To="0" + Duration="0:0:0.1"/> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + </Grid> + </ControlTemplate> + </RepeatButton.Template> + </RepeatButton> + </Track.DecreaseRepeatButton> + + + <!-- Thumb (Handle) --> + <Track.Thumb> + <Thumb> + <Thumb.Template> + <ControlTemplate TargetType="Thumb"> + <Grid> + <Border + Background="{DynamicResource AccentBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="0" + CornerRadius="3"/> + </Grid> + </ControlTemplate> + </Thumb.Template> + </Thumb> + </Track.Thumb> + + <!-- Increase Repeat Button --> + <Track.IncreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="0"> + <RepeatButton.Template> + <ControlTemplate TargetType="RepeatButton"> + <Grid x:Name="RepeatButtonGrid"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup Name="CommonStates"> + <VisualState Name="Normal"> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" + Storyboard.TargetName="RepeatButtonGrid" + To="1" + Duration="0:0:0"/> + </Storyboard> + </VisualState> + <VisualState Name="MouseOver"> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" + Storyboard.TargetName="RepeatButtonGrid" + To="0" + Duration="0:0:0.1"/> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + </Grid> + </ControlTemplate> + </RepeatButton.Template> + </RepeatButton> + </Track.IncreaseRepeatButton> + </Track> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <!-- Standard Slider Style --> + <Style x:Key="SliderStyle" + TargetType="Slider"> + <Setter Property="Height" + Value="40"/> + <Setter Property="Width" + Value="160"/> + <Setter Property="Foreground" + Value="{DynamicResource TextBrush}"/> + <Setter Property="Background" + Value="{DynamicResource BackgroundDarkBrush}"/> + <Setter Property="BorderBrush" + Value="{DynamicResource AccentBrush}"/> + <Setter Property="BorderThickness" + Value="2"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Slider"> + <Grid Width="100" + Height="30" + HorizontalAlignment="Left"> + <!-- Track Background --> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="2" + CornerRadius="15" + Margin="0,0,-5,-4"/> + + <!-- Track --> + <Track x:Name="PART_Track"> + <Track.Thumb> + <Thumb x:Name="PART_Thumb" + Width="22" + Height="22" + Margin="6,4,1,0"> + <Thumb.Template> + <ControlTemplate TargetType="Thumb"> + <Ellipse Fill="{DynamicResource AccentBrush}"/> + </ControlTemplate> + </Thumb.Template> + </Thumb> + </Track.Thumb> + <Track.DecreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.DecreaseRepeatButton> + <Track.IncreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.IncreaseRepeatButton> + </Track> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + </Application.Resources> </Application> diff --git a/AutoTrackR2/App.xaml.cs b/AutoTrackR2/App.xaml.cs index e9a45e7..55a1e85 100644 --- a/AutoTrackR2/App.xaml.cs +++ b/AutoTrackR2/App.xaml.cs @@ -23,28 +23,43 @@ namespace AutoTrackR2 protected override void OnStartup(StartupEventArgs e) { - // Ensure crash log directory exists - Directory.CreateDirectory(Path.GetDirectoryName(CrashLogPath)); - - // Set up unhandled exception handlers - AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; - DispatcherUnhandledException += App_DispatcherUnhandledException; - - const string appName = "AutoTrackR2"; - bool createdNew; - - _mutex = new Mutex(true, appName, out createdNew); - _mutexOwned = createdNew; - - if (!createdNew) + try { - // App is already running, silently exit - Current.Shutdown(); - return; - } + // Ensure crash log directory exists + Directory.CreateDirectory(Path.GetDirectoryName(CrashLogPath)); - base.OnStartup(e); - _streamlinkHandler = new StreamlinkHandler(); + // Set up unhandled exception handlers + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + DispatcherUnhandledException += App_DispatcherUnhandledException; + + const string appName = "AutoTrackR2"; + bool createdNew; + + _mutex = new Mutex(true, appName, out createdNew); + _mutexOwned = createdNew; + + if (!createdNew) + { + // App is already running, show message and exit + MessageBox.Show("AutoTrackR2 is already running.", "AutoTrackR2", MessageBoxButton.OK, MessageBoxImage.Information); + Current.Shutdown(); + return; + } + + // Initialize StreamlinkHandler before creating the main window + _streamlinkHandler = new StreamlinkHandler(); + + // Create and show the main window + var mainWindow = new MainWindow(); + mainWindow.Show(); + + base.OnStartup(e); + } + catch (Exception ex) + { + MessageBox.Show($"Failed to start AutoTrackR2: {ex.Message}", "AutoTrackR2 Error", MessageBoxButton.OK, MessageBoxImage.Error); + Current.Shutdown(); + } } private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) @@ -95,20 +110,24 @@ namespace AutoTrackR2 protected override void OnExit(ExitEventArgs e) { - if (_mutex != null && _mutexOwned) + try { - try + if (_mutex != null && _mutexOwned) { _mutex.ReleaseMutex(); + _mutex.Close(); + _mutex = null; } - catch (Exception ex) - { - // Log the mutex release error but don't throw - LogCrash(ex); - } - _mutex.Dispose(); } - base.OnExit(e); + catch (Exception ex) + { + // Log the error but don't prevent shutdown + File.AppendAllText(CrashLogPath, $"[{DateTime.Now}] Error during shutdown: {ex.Message}\n"); + } + finally + { + base.OnExit(e); + } } } } diff --git a/AutoTrackR2/LogEventHandlers/ActorDeathEvent.cs b/AutoTrackR2/LogEventHandlers/ActorDeathEvent.cs index 0e4ad4c..e515dbe 100644 --- a/AutoTrackR2/LogEventHandlers/ActorDeathEvent.cs +++ b/AutoTrackR2/LogEventHandlers/ActorDeathEvent.cs @@ -20,7 +20,7 @@ public class ActorDeathEvent : ILogEventHandler public Regex Pattern { get; } private Regex _shipManufacturerPattern; private string _lastKillShip = string.Empty; - private Regex cleanUpPattern = new Regex(@"^(.+?)(?:_\d+)*$"); + private Regex cleanUpPattern = new Regex(@"^(.+?)_\d+$"); public ActorDeathEvent() {