diff --git a/AutoTrackR2.sln b/AutoTrackR2.sln new file mode 100644 index 0000000..c4b5916 --- /dev/null +++ b/AutoTrackR2.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35521.163 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoTrackR2", "AutoTrackR2\AutoTrackR2.csproj", "{31093634-8FBB-4BC6-BEA4-DAD6C11404F3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {31093634-8FBB-4BC6-BEA4-DAD6C11404F3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/AutoTrackR2/App.xaml b/AutoTrackR2/App.xaml new file mode 100644 index 0000000..455b71a --- /dev/null +++ b/AutoTrackR2/App.xaml @@ -0,0 +1,277 @@ +<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="DynamicFont">"{}"</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> + + <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}" /> + + <!-- 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 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 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="90" 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> + </Application.Resources> +</Application> diff --git a/AutoTrackR2/App.xaml.cs b/AutoTrackR2/App.xaml.cs new file mode 100644 index 0000000..85786d2 --- /dev/null +++ b/AutoTrackR2/App.xaml.cs @@ -0,0 +1,14 @@ +using System.Configuration; +using System.Data; +using System.Windows; + +namespace AutoTrackR2 +{ + /// <summary> + /// Interaction logic for App.xaml + /// </summary> + public partial class App : Application + { + } + +} diff --git a/AutoTrackR2/AssemblyInfo.cs b/AutoTrackR2/AssemblyInfo.cs new file mode 100644 index 0000000..b0ec827 --- /dev/null +++ b/AutoTrackR2/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/AutoTrackR2/Assets/AutoTrackR.png b/AutoTrackR2/Assets/AutoTrackR.png new file mode 100644 index 0000000..db26bab Binary files /dev/null and b/AutoTrackR2/Assets/AutoTrackR.png differ diff --git a/AutoTrackR2/Assets/D3VL.png b/AutoTrackR2/Assets/D3VL.png new file mode 100644 index 0000000..9fe0e1b Binary files /dev/null and b/AutoTrackR2/Assets/D3VL.png differ diff --git a/AutoTrackR2/Assets/EMP.png b/AutoTrackR2/Assets/EMP.png new file mode 100644 index 0000000..580ad66 Binary files /dev/null and b/AutoTrackR2/Assets/EMP.png differ diff --git a/AutoTrackR2/Assets/GN.png b/AutoTrackR2/Assets/GN.png new file mode 100644 index 0000000..0d89604 Binary files /dev/null and b/AutoTrackR2/Assets/GN.png differ diff --git a/AutoTrackR2/Assets/NW.png b/AutoTrackR2/Assets/NW.png new file mode 100644 index 0000000..ac4586e Binary files /dev/null and b/AutoTrackR2/Assets/NW.png differ diff --git a/AutoTrackR2/Assets/VOX.png b/AutoTrackR2/Assets/VOX.png new file mode 100644 index 0000000..d22d6df Binary files /dev/null and b/AutoTrackR2/Assets/VOX.png differ diff --git a/AutoTrackR2/AutoTrackR2.csproj b/AutoTrackR2/AutoTrackR2.csproj new file mode 100644 index 0000000..5a92e6e --- /dev/null +++ b/AutoTrackR2/AutoTrackR2.csproj @@ -0,0 +1,45 @@ +<Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>WinExe</OutputType> + <TargetFramework>net9.0-windows</TargetFramework> + <Nullable>enable</Nullable> + <ImplicitUsings>enable</ImplicitUsings> + <UseWPF>true</UseWPF> + </PropertyGroup> + + <ItemGroup> + <None Remove="Assets\D3VL.png" /> + <None Remove="Assets\EMP.png" /> + <None Remove="Assets\NW.png" /> + <None Remove="Assets\VOX.png" /> + <None Remove="Fonts\Orbitron-Bold.ttf" /> + <None Remove="Fonts\Roboto-Regular.ttf" /> + </ItemGroup> + + <ItemGroup> + <Resource Include="Assets\D3VL.png"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Resource> + <Resource Include="Assets\EMP.png" /> + <Resource Include="Assets\GN.png"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Resource> + <Resource Include="Assets\AutoTrackR.png"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Resource> + <Resource Include="Assets\NW.png"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Resource> + <Resource Include="Assets\VOX.png"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Resource> + <Resource Include="Fonts\Orbitron-Bold.ttf"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Resource> + <Resource Include="Fonts\Roboto-Regular.ttf"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Resource> + </ItemGroup> + +</Project> diff --git a/AutoTrackR2/ConfigPage.xaml b/AutoTrackR2/ConfigPage.xaml new file mode 100644 index 0000000..25adc33 --- /dev/null +++ b/AutoTrackR2/ConfigPage.xaml @@ -0,0 +1,97 @@ +<UserControl x:Class="AutoTrackR2.ConfigPage" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + Height="396" Width="626"> + + <Grid Background="{DynamicResource BackgroundLightBrush}"> + <!-- Main Layout Grid --> + <Grid Margin="0,0,5,7"> + <Grid.RowDefinitions> + <!-- One row for the content, the other for buttons --> + <RowDefinition Height="*" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Grid.ColumnDefinitions> + <!-- Left column for the main content area --> + <ColumnDefinition Width="*" /> + <!-- Right column for the buttons --> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + + <!-- Section for Config Fields --> + <StackPanel Grid.Column="0" VerticalAlignment="Center" Height="389"> + <!-- Log File --> + <StackPanel Margin="0,10,0,15" Orientation="Horizontal"> + <TextBlock Text="Log File:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,5,0,5" FontFamily="{StaticResource Roboto}"/> + <StackPanel Orientation="Horizontal" Margin="30,0,0,0"> + <TextBox Name="LogFilePath" Width="340" Height="30" Style="{StaticResource RoundedTextBox}"/> + <Button Content="Browse" Width="75" Height="30" FontFamily="{StaticResource Orbitron}" Margin="5,0" Style="{StaticResource ButtonStyle}" Click="LogFileBrowseButton_Click"/> + </StackPanel> + </StackPanel> + + <!-- API URL --> + <StackPanel Margin="0,0,0,15" Orientation="Horizontal"> + <TextBlock Text="API URL:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,5,0,5"/> + <StackPanel Orientation="Horizontal" Margin="30,0,0,0"> + <TextBox Name="ApiUrl" Width="340" Height="30" Style="{StaticResource RoundedTextBox}"/> + <Button Content="Test" Width="75" Height="30" FontFamily="{StaticResource Orbitron}" Margin="5,0" Style="{StaticResource ButtonStyle}"/> + </StackPanel> + </StackPanel> + + <!-- API Key --> + <StackPanel Margin="0,0,0,15" Orientation="Horizontal"> + <TextBlock Text="API Key:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,5,0,5"/> + <TextBox Name="ApiKey" Width="340" Height="30" Margin="33,0,0,0" Style="{StaticResource RoundedTextBox}"/> + </StackPanel> + + <!-- Video Path --> + <StackPanel Margin="0,0,0,15" Orientation="Horizontal"> + <TextBlock Text="Video Path:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,5,0,5"/> + <StackPanel Orientation="Horizontal"> + <TextBox Name="VideoPath" Width="340" Height="30" Margin="10,0,0,0" Style="{StaticResource RoundedTextBox}"/> + <Button Content="Browse" Width="75" Height="30" FontFamily="{StaticResource Orbitron}" Margin="5,0" Style="{StaticResource ButtonStyle}" Click="VideoPathBrowseButton_Click"/> + </StackPanel> + </StackPanel> + + <!-- Visor Wipe Toggle Slider --> + <StackPanel Margin="0,0,0,15" Orientation="Horizontal"> + <TextBlock Text="Visor Wipe:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,7,0,5"/> + <Slider Name="VisorWipeSlider" Minimum="0" Maximum="1" TickFrequency="1" IsSnapToTickEnabled="True" Value="0" Style="{StaticResource ToggleSliderStyle}" Margin="27,-4,0,0" ValueChanged="VisorWipeSlider_ValueChanged"/> + </StackPanel> + + <!-- Video Record Toggle Slider --> + <StackPanel Margin="0,0,0,15" Orientation="Horizontal"> + <TextBlock Text="Video Record:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,7,0,5"/> + <Slider Name="VideoRecordSlider" Minimum="0" Maximum="1" TickFrequency="1" IsSnapToTickEnabled="True" Value="0" Style="{StaticResource ToggleSliderStyle}" Margin="10,-4,0,0" ValueChanged="VideoRecordSlider_ValueChanged"/> + </StackPanel> + + <!-- Offline Mode Toggle Slider --> + <StackPanel Margin="0,0,0,15" Orientation="Horizontal"> + <TextBlock Text="Offline Mode:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,7,0,5"/> + <Slider Name="OfflineModeSlider" Minimum="0" Maximum="1" TickFrequency="1" IsSnapToTickEnabled="True" Value="0" Style="{StaticResource ToggleSliderStyle}" Margin="12,-4,0,0" ValueChanged="OfflineModeSlider_ValueChanged"/> + </StackPanel> + + <!-- 3-Position Toggle Slider --> + <StackPanel Margin="0,0,0,15" Orientation="Horizontal"> + <TextBlock Text="Theme:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,7,0,5"/> + <Slider x:Name="ThemeSlider" + Minimum="0" + Maximum="8" + Value="0" + TickFrequency="1" + IsSnapToTickEnabled="True" + ValueChanged="ThemeSlider_ValueChanged" Width="180" + Style="{StaticResource ThreePositionSlider}" + /> + </StackPanel> + + </StackPanel> + + <!-- Save Button --> + <StackPanel Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0"> + <Button x:Name="SaveButton" Content="Save" Width="100" Height="40" Style="{StaticResource ButtonStyle}" FontFamily="{StaticResource Orbitron}" Click="SaveButton_Click"/> + </StackPanel> + </Grid> + </Grid> +</UserControl> diff --git a/AutoTrackR2/ConfigPage.xaml.cs b/AutoTrackR2/ConfigPage.xaml.cs new file mode 100644 index 0000000..bf2a1e0 --- /dev/null +++ b/AutoTrackR2/ConfigPage.xaml.cs @@ -0,0 +1,387 @@ +using System.IO; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Media.Effects; +using System.Windows.Media.Imaging; +using System.Windows.Media.Media3D; +using System.Windows.Threading; +using Microsoft.Win32; + +namespace AutoTrackR2 +{ + public partial class ConfigPage : UserControl + { + // Store the current slider value + private double savedSliderValue = 0; + + private MainWindow mainWindow; + + public ConfigPage(MainWindow mainWindow) + { + InitializeComponent(); + this.mainWindow = mainWindow; + + LogFilePath.Text = ConfigManager.LogFile; + ApiUrl.Text = ConfigManager.ApiUrl; + ApiKey.Text = ConfigManager.ApiKey; + VideoPath.Text = ConfigManager.VideoPath; + VisorWipeSlider.Value = ConfigManager.VisorWipe; + VideoRecordSlider.Value = ConfigManager.VideoRecord; + OfflineModeSlider.Value = ConfigManager.OfflineMode; + ThemeSlider.Value = ConfigManager.Theme; + + ApplyToggleModeStyle(OfflineModeSlider.Value, VisorWipeSlider.Value, VideoRecordSlider.Value); + } + + // Method to change the logo image in MainWindow + public void ChangeLogo(string imagePath, Color? glowColor = null) + { + // Update the logo from ConfigPage + mainWindow.ChangeLogoImage(imagePath); + + if (glowColor.HasValue) + { + // Add the glow effect to the logo in MainWindow + DropShadowEffect glowEffect = new DropShadowEffect + { + Color = glowColor.Value, // Glow color + ShadowDepth = 0, // Centered glow + BlurRadius = 20, // Glow spread + Opacity = 0.8 // Intensity + }; + + // Apply the effect to the logo + mainWindow.Logo.Effect = glowEffect; + } + else + { + mainWindow.Logo.Effect = null; + } + } + + // This method will set the loaded config values to the UI controls + public void SetConfigValues(string logFile, string apiUrl, string apiKey, string videoPath, + int visorWipe, int videoRecord, int offlineMode, int theme) + { + // Set the textboxes with the loaded values + LogFilePath.Text = logFile; + ApiUrl.Text = apiUrl; + ApiKey.Text = apiKey; + VideoPath.Text = videoPath; + + // Set the sliders with the loaded values + VideoRecordSlider.Value = videoRecord; + VisorWipeSlider.Value = visorWipe; + OfflineModeSlider.Value = offlineMode; + + // Handle themes + if (theme >= 0 && theme <= 3) + { + ThemeSlider.Value = theme; // Set slider only for visible themes + } + else + { + ApplyTheme(theme); // Apply hidden themes directly + } + } + + private void ApplyToggleModeStyle(double offlineModeValue, double visorWipeValue, double videoRecordValue) + { + // Get the slider + Slider offlineModeSlider = OfflineModeSlider; + Slider visorWipeSlider = VisorWipeSlider; + Slider videoRecordSlider = VideoRecordSlider; + + // Set the appropriate style based on the offlineMode value (0 or 1) + if (offlineModeValue == 0) + { + offlineModeSlider.Style = (Style)Application.Current.FindResource("FalseToggleStyle"); + } + + if (visorWipeValue == 0) + { + visorWipeSlider.Style = (Style)Application.Current.FindResource("FalseToggleStyle"); + } + + if (videoRecordValue == 0) + { + videoRecordSlider.Style = (Style)Application.Current.FindResource("FalseToggleStyle"); + } + } + + private void ThemeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) + { + // Save the current slider value when it changes + savedSliderValue = e.NewValue; + + // Get the slider value (0, 1, or 2) + int themeIndex = (int)savedSliderValue; + + // Apply the selected theme + ApplyTheme(themeIndex); + + mainWindow.UpdateTabVisuals(); + } + + private void ApplyTheme(int themeIndex) + { + switch (themeIndex) + { + case 0: // Default Blue Theme + UpdateThemeColors( + (Color)ColorConverter.ConvertFromString("#00A9E0"), // Accent/Border + (Color)ColorConverter.ConvertFromString("#0F1A2B"), // Button + (Color)ColorConverter.ConvertFromString("#1D2D44"), // Background + (Color)ColorConverter.ConvertFromString("#FFFFFF") // Text + ); + ChangeLogo("/Assets/AutoTrackR.png"); + break; + case 1: // Green Theme + UpdateThemeColors( + (Color)ColorConverter.ConvertFromString("#1D9F00"), // Accent/Border + (Color)ColorConverter.ConvertFromString("#262424"), // Button + (Color)ColorConverter.ConvertFromString("#072501"), // Background + (Color)ColorConverter.ConvertFromString("#D7AF3C") // Text + ); + ChangeLogo("/Assets/AutoTrackR.png"); + break; + case 2: // Red Theme + UpdateThemeColors( + (Color)ColorConverter.ConvertFromString("#D32F2F"), // Accent/Border + (Color)ColorConverter.ConvertFromString("#424242"), // Button + (Color)ColorConverter.ConvertFromString("#212121"), // Light Background + (Color)ColorConverter.ConvertFromString("#E0E0E0") // Text + ); + ChangeLogo("/Assets/AutoTrackR.png"); + break; + case 3: // Purple Theme + UpdateThemeColors( + (Color)ColorConverter.ConvertFromString("#32CD32"), // Accent/Border + (Color)ColorConverter.ConvertFromString("#33065F"), // Button + (Color)ColorConverter.ConvertFromString("#43065F"), // Background + (Color)ColorConverter.ConvertFromString("#00FF00") // Text + ); + ChangeLogo("/Assets/AutoTrackR.png"); + break; + case 4: // GN Theme + UpdateThemeColors( + (Color)ColorConverter.ConvertFromString("#FF0000"), // Accent/Border + (Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button + (Color)ColorConverter.ConvertFromString("#000000"), // Background + (Color)ColorConverter.ConvertFromString("#FBC603") // Text + ); + ChangeLogo("/Assets/GN.png", (Color)ColorConverter.ConvertFromString("#FF0000")); + break; + case 5: // NW Theme + UpdateThemeColors( + (Color)ColorConverter.ConvertFromString("#B92D2D"), // Accent/Border + (Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button + (Color)ColorConverter.ConvertFromString("#262424"), // Background + (Color)ColorConverter.ConvertFromString("#01DDDA") // Text + ); + ChangeLogo("/Assets/NW.png", (Color)ColorConverter.ConvertFromString("#01DDDA")); + break; + case 6: // D3VL Theme + UpdateThemeColors( + (Color)ColorConverter.ConvertFromString("#000000"), // Accent/Border (Bright Red) + (Color)ColorConverter.ConvertFromString("#3E3E3E"), // Button + (Color)ColorConverter.ConvertFromString("#4C1C1C"), // Background + (Color)ColorConverter.ConvertFromString("#FF0000") // Text + ); + ChangeLogo("/Assets/D3VL.png", (Color)ColorConverter.ConvertFromString("#000000")); + break; + case 7: // VOX Theme + UpdateThemeColors( + (Color)ColorConverter.ConvertFromString("#C0C0C0"), // Accent/Border + (Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button + (Color)ColorConverter.ConvertFromString("#424242"), // Background + (Color)ColorConverter.ConvertFromString("#FFD700") // Text + ); + ChangeLogo("/Assets/VOX.png", (Color)ColorConverter.ConvertFromString("#FFD700")); + break; + case 8: // EMP Theme + UpdateThemeColors( + (Color)ColorConverter.ConvertFromString("#F5721C"), // Accent/Border + (Color)ColorConverter.ConvertFromString("#535353"), // Button + (Color)ColorConverter.ConvertFromString("#080000"), // Background + (Color)ColorConverter.ConvertFromString("#FFFFFF") // Text + ); + ChangeLogo("/Assets/EMP.png", (Color)ColorConverter.ConvertFromString("#F3BD9B")); + break; + } + } + + // Helper method to update both Color and Brush resources + private void UpdateThemeColors(Color accent, Color backgroundDark, Color backgroundLight, Color text) + { + // Update color resources + Application.Current.Resources["AccentColor"] = accent; + Application.Current.Resources["BackgroundDarkColor"] = backgroundDark; + Application.Current.Resources["BackgroundLightColor"] = backgroundLight; + Application.Current.Resources["TextColor"] = text; + + // Update SolidColorBrush resources + Application.Current.Resources["AccentBrush"] = new SolidColorBrush(accent); + Application.Current.Resources["BackgroundDarkBrush"] = new SolidColorBrush(backgroundDark); + Application.Current.Resources["BackgroundLightBrush"] = new SolidColorBrush(backgroundLight); + Application.Current.Resources["TextBrush"] = new SolidColorBrush(text); + } + + // This method will be called when switching tabs to restore the saved slider position. + public void RestoreSliderValue() + { + // Set the slider back to the previously saved value + ThemeSlider.Value = savedSliderValue; + } + + // Log File Browse Button Handler + private void LogFileBrowseButton_Click(object sender, RoutedEventArgs e) + { + var dialog = new Microsoft.Win32.OpenFileDialog(); + dialog.Filter = "Log files (*.log)|*.log|All files (*.*)|*.*"; // Adjust as needed + + if (dialog.ShowDialog() == true) + { + LogFilePath.Text = dialog.FileName; // Set the selected file path to the TextBox + } + } + + // Video Path Browse Button Handler + private void VideoPathBrowseButton_Click(object sender, RoutedEventArgs e) + { + var dialog = new OpenFileDialog(); + dialog.CheckFileExists = false; + dialog.ValidateNames = false; + dialog.Filter = "All files|*.*"; + + if (dialog.ShowDialog() == true) + { + // Extract only the directory path from the file + string selectedFolder = Path.GetDirectoryName(dialog.FileName); + VideoPath.Text = selectedFolder; // Set the folder path + } + } + + private void VisorWipeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) + { + Slider slider = (Slider)sender; + ConfigManager.VisorWipe = (int)slider.Value; // 0 or 1 + + // Check if the value is 0 or 1 and apply the corresponding style + if (ConfigManager.VisorWipe == 0) + { + slider.Style = (Style)Application.Current.FindResource("FalseToggleStyle"); // Apply FalseToggleStyle + } + else + { + slider.Style = (Style)Application.Current.FindResource("ToggleSliderStyle"); // Apply ToggleSliderStyle + } + } + + private void VideoRecordSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) + { + Slider slider = (Slider)sender; + ConfigManager.VideoRecord = (int)slider.Value; // 0 or 1 + + // Check if the value is 0 or 1 and apply the corresponding style + if (ConfigManager.VideoRecord == 0) + { + slider.Style = (Style)Application.Current.FindResource("FalseToggleStyle"); // Apply FalseToggleStyle + } + else + { + slider.Style = (Style)Application.Current.FindResource("ToggleSliderStyle"); // Apply ToggleSliderStyle + } + } + + private void OfflineModeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) + { + Slider slider = (Slider)sender; + ConfigManager.OfflineMode = (int)slider.Value; // 0 or 1 + + // Check if the value is 0 or 1 and apply the corresponding style + if (ConfigManager.OfflineMode == 0) + { + slider.Style = (Style)Application.Current.FindResource("FalseToggleStyle"); // Apply FalseToggleStyle + } + else + { + slider.Style = (Style)Application.Current.FindResource("ToggleSliderStyle"); // Apply ToggleSliderStyle + } + } + + + private void SaveButton_Click(object sender, RoutedEventArgs e) + { + // Get the directory of the running executable + string exeDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); + + // Combine the executable directory with the config file name + string configFilePath = Path.Combine(exeDirectory, "config.ini"); + + using (StreamWriter writer = new StreamWriter(configFilePath)) + { + writer.WriteLine($"LogFile=\"{LogFilePath.Text}\""); + writer.WriteLine($"ApiUrl=\"{ApiUrl.Text}\""); + writer.WriteLine($"ApiKey=\"{ApiKey.Text}\""); + writer.WriteLine($"VideoPath=\"{VideoPath.Text}\""); + writer.WriteLine($"VisorWipe=\"{(int)VisorWipeSlider.Value}\""); + writer.WriteLine($"VideoRecord=\"{(int)VideoRecordSlider.Value}\""); + writer.WriteLine($"OfflineMode=\"{(int)OfflineModeSlider.Value}\""); + writer.WriteLine($"Theme=\"{(int)ThemeSlider.Value}\""); // Assumes you are saving the theme slider value (0, 1, or 2) + } + + // Start the flashing effect + FlashSaveButton(); + ConfigManager.LoadConfig(); + } + + private void FlashSaveButton() + { + string originalText = SaveButton.Content.ToString(); + SaveButton.Content = "Saved"; + + // Save button color change effect + var originalColor = SaveButton.Background; + var accentColor = (Color)Application.Current.Resources["AccentColor"]; + SaveButton.Background = new SolidColorBrush(accentColor); // Change color to accent color + + // Apply glow effect + SaveButton.Effect = new DropShadowEffect + { + Color = accentColor, + BlurRadius = 15, // Add subtle blur + ShadowDepth = 0, // Set shadow depth to 0 for a pure glow effect + Opacity = 0.8, // Set opacity for glow visibility + Direction = 0 // Direction doesn't matter for glow + }; + + // Create a DispatcherTimer to reset everything after the effect + DispatcherTimer timer = new DispatcherTimer + { + Interval = TimeSpan.FromMilliseconds(600) // Interval for flash effect + }; + + int flashCount = 0; + timer.Tick += (sender, e) => + { + if (flashCount < 2) // Flash effect (flash 2 times) + { + flashCount++; + } + else + { + // Stop the timer and restore the original button state + timer.Stop(); + SaveButton.Content = originalText; + SaveButton.Background = originalColor; // Restore the original button color + SaveButton.Effect = null; // Remove the glow effect + } + }; + + // Start the timer + timer.Start(); + } + } +} diff --git a/AutoTrackR2/Fonts/Orbitron-Bold.ttf b/AutoTrackR2/Fonts/Orbitron-Bold.ttf new file mode 100644 index 0000000..9c8643c Binary files /dev/null and b/AutoTrackR2/Fonts/Orbitron-Bold.ttf differ diff --git a/AutoTrackR2/Fonts/Roboto-Regular.ttf b/AutoTrackR2/Fonts/Roboto-Regular.ttf new file mode 100644 index 0000000..2d116d9 Binary files /dev/null and b/AutoTrackR2/Fonts/Roboto-Regular.ttf differ diff --git a/AutoTrackR2/HomePage.xaml b/AutoTrackR2/HomePage.xaml new file mode 100644 index 0000000..b501825 --- /dev/null +++ b/AutoTrackR2/HomePage.xaml @@ -0,0 +1,33 @@ +<UserControl x:Class="AutoTrackR2.HomePage" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + Height="396" Width="626"> + <Grid Background="{DynamicResource BackgroundLightBrush}"> + <!-- Main Layout Grid --> + <Grid Margin="0,0,5,7"> + <Grid.RowDefinitions> + <!-- One row for the content, the other for buttons --> + <RowDefinition Height="*" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Grid.ColumnDefinitions> + <!-- Left column for the main content area --> + <ColumnDefinition Width="*" /> + <!-- Right column for the buttons --> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + + <!-- Border for the kill feed section --> + <Border Grid.Row="0" Grid.Column="0" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="2" CornerRadius="10" Padding="10" Background="{DynamicResource BackgroundDarkBrush}" Margin="0,0,20,0"> + <TextBlock Text="Kill Feed Goes Here..." FontSize="18" Foreground="{DynamicResource TextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center" /> + </Border> + + <!-- StackPanel for Start and Stop buttons --> + <StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,0,0,0"> + <Button Name="StartButton" Content="Start" Width="100" Height="40" Style="{StaticResource ButtonStyle}" FontFamily="{StaticResource Orbitron}" Margin="0,20"/> + <Button Name="StopButton" Content="Stop" Width="100" Height="40" Style="{StaticResource DisabledButtonStyle}" FontFamily="{StaticResource Orbitron}" IsEnabled="False"/> + </StackPanel> + </Grid> + </Grid> +</UserControl> diff --git a/AutoTrackR2/HomePage.xaml.cs b/AutoTrackR2/HomePage.xaml.cs new file mode 100644 index 0000000..723ea91 --- /dev/null +++ b/AutoTrackR2/HomePage.xaml.cs @@ -0,0 +1,57 @@ +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Media.Effects; + +namespace AutoTrackR2 +{ + public partial class HomePage : UserControl + { + public HomePage() + { + InitializeComponent(); + } + + // Update Start/Stop button states based on the isRunning flag + public void UpdateButtonState(bool isRunning) + { + var accentColor = (Color)Application.Current.Resources["AccentColor"]; + + if (isRunning) + { + // Set Start button to "Running..." and apply glow effect + StartButton.Content = "Running..."; + StartButton.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#00A9E0")); + StartButton.IsEnabled = false; // Disable Start button + StartButton.Style = (Style)FindResource("DisabledButtonStyle"); + + // Add glow effect to the Start button + StartButton.Effect = new DropShadowEffect + { + Color = accentColor, + BlurRadius = 20, // Adjust blur radius for desired glow intensity + ShadowDepth = 0, // Set shadow depth to 0 for a pure glow effect + Opacity = 1, // Set opacity for glow visibility + Direction = 0 // Direction doesn't matter for glow + }; + + StopButton.Style = (Style)FindResource("ButtonStyle"); + StopButton.IsEnabled = true; // Enable Stop button + } + else + { + // Reset Start button back to its original state + StartButton.Content = "Start"; + StartButton.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0F1A2B")); + StartButton.IsEnabled = true; // Enable Start button + + // Remove the glow effect from Start button + StartButton.Effect = null; + + StopButton.Style = (Style)FindResource("DisabledButtonStyle"); + StartButton.Style = (Style)FindResource("ButtonStyle"); + StopButton.IsEnabled = false; // Disable Stop button + } + } + } +} diff --git a/AutoTrackR2/MainWindow.xaml b/AutoTrackR2/MainWindow.xaml new file mode 100644 index 0000000..53ef1e2 --- /dev/null +++ b/AutoTrackR2/MainWindow.xaml @@ -0,0 +1,39 @@ +<Window x:Class="AutoTrackR2.MainWindow" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + Title="AutoTrackR" Height="450" Width="800" + WindowStyle="None" ResizeMode="NoResize" + AllowsTransparency="True" + Style="{StaticResource CustomWindowStyle}"> + + <Grid> + <!-- Custom Title Bar --> + <DockPanel Height="30" VerticalAlignment="Top" MouseDown="TitleBar_MouseDown" Margin="5" Background="Transparent"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> + <Button Content="_" Width="30" Height="25" Click="MinimizeWindow" Style="{StaticResource TitleButtonStyle}" FontFamily="{StaticResource Orbitron}"/> + <Button Content="X" Width="30" Height="25" Click="CloseWindow" Style="{StaticResource TitleButtonStyle}" FontFamily="{StaticResource Orbitron}"/> + </StackPanel> + </DockPanel> + <!-- Main Content Area --> + <Grid Margin="0,30,0,0"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="150"/> + <ColumnDefinition Width="*"/> + </Grid.ColumnDefinitions> + + <!-- Left Tab Panel --> + <StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="5,0,0,0"> + <Image x:Name="Logo" Height="138" Source="/Assets/AutoTrackR.png" Stretch="Fill" Width="141" RenderOptions.BitmapScalingMode="Fant"/> + <Button Content="Home" Name="HomeTab" Margin="10,40,10,10" Height="40" Style="{StaticResource TabButtonStyle}" Click="TabButton_Click"/> + <Button Content="Stats" Name="StatsTab" Margin="10" Height="40" Style="{StaticResource TabButtonStyle}" Click="TabButton_Click"/> + <Button Content="Update" Name="UpdateTab" Margin="10" Height="40" Style="{StaticResource TabButtonStyle}" Click="TabButton_Click"/> + <Button Content="Config" Name="ConfigTab" Margin="10" Height="40" Style="{StaticResource TabButtonStyle}" Click="TabButton_Click"/> + </StackPanel> + + <!-- Content Area --> + <ContentControl Grid.Column="1" Name="ContentControl" Margin="10"> + <!-- Default content can be set here --> + </ContentControl> + </Grid> + </Grid> +</Window> \ No newline at end of file diff --git a/AutoTrackR2/MainWindow.xaml.cs b/AutoTrackR2/MainWindow.xaml.cs new file mode 100644 index 0000000..dfe6832 --- /dev/null +++ b/AutoTrackR2/MainWindow.xaml.cs @@ -0,0 +1,236 @@ +using System.Collections.Generic; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Media; +using System.IO; +using System.Windows.Media.Effects; +using System.Windows.Media.Imaging; +using System.Windows.Media.Animation; +using System.Windows.Threading; +using System; + +namespace AutoTrackR2 +{ + public partial class MainWindow : Window + { + private Dictionary<string, bool> tabStates = new Dictionary<string, bool> + { + { "HomeTab", true }, // HomeTab is selected by default + { "StatsTab", false }, + { "UpdateTab", false }, + { "ConfigTab", false } + }; + + private HomePage homePage; // Persistent HomePage instance + private bool isRunning = false; // Single source of truth for the running state + + // Ensure this method is not static + public void ChangeLogoImage(string imagePath) + { + Logo.Source = new BitmapImage(new Uri(imagePath, UriKind.RelativeOrAbsolute)); + } + + public MainWindow() + { + InitializeComponent(); + + // Load configuration settings before setting them in any page + ConfigManager.LoadConfig(); + + homePage = new HomePage(); // Create a single instance of HomePage + ContentControl.Content = homePage; // Default to HomePage + + // Attach event handlers for the HomePage buttons + homePage.StartButton.Click += StartButton_Click; + homePage.StopButton.Click += StopButton_Click; + + // Create ConfigPage and pass the MainWindow reference to it + var configPage = new ConfigPage(this); + + // Set config values after loading them + InitializeConfigPage(); + + UpdateTabVisuals(); + } + + private void CloseWindow(object sender, RoutedEventArgs e) => this.Close(); + + private void MinimizeWindow(object sender, RoutedEventArgs e) => this.WindowState = WindowState.Minimized; + + private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + { + this.DragMove(); + } + } + + private void TabButton_Click(object sender, RoutedEventArgs e) + { + Button clickedButton = (Button)sender; + string clickedTabName = clickedButton.Name; + + if (clickedTabName == "HomeTab") + { + // Reuse the existing HomePage instance + ContentControl.Content = homePage; + + // Update the button state on the HomePage + homePage.UpdateButtonState(isRunning); + } + else if (clickedTabName == "StatsTab") + { + ContentControl.Content = new StatsPage(); + } + else if (clickedTabName == "UpdateTab") + { + ContentControl.Content = new UpdatePage(); + } + else if (clickedTabName == "ConfigTab") + { + ContentControl.Content = new ConfigPage(this); + } + + // Update tab selection states + UpdateTabStates(clickedTabName); + + // Update the visual appearance of all tabs + UpdateTabVisuals(); + } + + private void UpdateTabStates(string activeTab) + { + foreach (var key in tabStates.Keys) + { + tabStates[key] = key == activeTab; + } + } + + public void UpdateTabVisuals() + { + var accentColor = (Color)Application.Current.Resources["AccentColor"]; + var backgroundDarkColor = (Color)Application.Current.Resources["BackgroundDarkColor"]; + var textColor = (Color)Application.Current.Resources["TextColor"]; + + foreach (var tabState in tabStates) + { + Button tabButton = (Button)this.FindName(tabState.Key); + if (tabButton != null) + { + tabButton.Effect = null; + + if (tabState.Value) // Active tab + { + tabButton.Background = new SolidColorBrush(accentColor); // Highlight color from theme + + // Add glow effect + tabButton.Effect = new DropShadowEffect + { + Color = accentColor, + BlurRadius = 20, // Adjust blur radius for desired glow intensity + ShadowDepth = 0, // Set shadow depth to 0 for a pure glow effect + Opacity = 1, // Set opacity for glow visibility + Direction = 0 // Direction doesn't matter for glow + }; + } + else // Inactive tab + { + tabButton.Background = new SolidColorBrush(backgroundDarkColor); // Default background from theme + } + } + } + } + + private void StartButton_Click(object sender, RoutedEventArgs e) + { + isRunning = true; // Update the running state + homePage.UpdateButtonState(isRunning); // Update HomePage button visuals + // Start your logic here + } + + private void StopButton_Click(object sender, RoutedEventArgs e) + { + isRunning = false; // Update the running state + homePage.UpdateButtonState(isRunning); // Update HomePage button visuals + // Stop your logic here + } + + private void InitializeConfigPage() + { + // Set the values from the loaded config + ConfigPage configPage = new ConfigPage(this); + + // Set the fields in ConfigPage.xaml.cs based on the loaded config + configPage.SetConfigValues( + ConfigManager.LogFile, + ConfigManager.ApiUrl, + ConfigManager.ApiKey, + ConfigManager.VideoPath, + ConfigManager.VisorWipe, + ConfigManager.VideoRecord, + ConfigManager.OfflineMode, + ConfigManager.Theme + ); + } + } + + public static class ConfigManager + { + public static string LogFile { get; set; } + public static string ApiUrl { get; set; } + public static string ApiKey { get; set; } + public static string VideoPath { get; set; } + public static int VisorWipe { get; set; } + public static int VideoRecord { get; set; } + public static int OfflineMode { get; set; } + public static int Theme { get; set; } + + public static void LoadConfig() + { + string exeDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); + string configFilePath = Path.Combine(exeDirectory, "config.ini"); + + if (File.Exists(configFilePath)) + { + foreach (var line in File.ReadLines(configFilePath)) + { + if (line.StartsWith("LogFile=")) + LogFile = line.Substring("LogFile=\"".Length).Trim('\"'); + else if (line.StartsWith("ApiUrl=")) + ApiUrl = line.Substring("ApiUrl=\"".Length).Trim('\"'); + else if (line.StartsWith("ApiKey=")) + ApiKey = line.Substring("ApiKey=\"".Length).Trim('\"'); + else if (line.StartsWith("VideoPath=")) + VideoPath = line.Substring("VideoPath=\"".Length).Trim('\"'); + else if (line.StartsWith("VisorWipe=")) + VisorWipe = int.Parse(line.Substring("VisorWipe=\"".Length).Trim('\"')); + else if (line.StartsWith("VideoRecord=")) + VideoRecord = int.Parse(line.Substring("VideoRecord=\"".Length).Trim('\"')); + else if (line.StartsWith("OfflineMode=")) + OfflineMode = int.Parse(line.Substring("OfflineMode=\"".Length).Trim('\"')); + else if (line.StartsWith("Theme=")) + Theme = int.Parse(line.Substring("Theme=\"".Length).Trim('\"')); + } + } + } + + public static void SaveConfig() + { + string exeDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); + string configFilePath = Path.Combine(exeDirectory, "config.ini"); + + using (StreamWriter writer = new StreamWriter(configFilePath)) + { + writer.WriteLine($"LogFile=\"{LogFile}\""); + writer.WriteLine($"ApiUrl=\"{ApiUrl}\""); + writer.WriteLine($"ApiKey=\"{ApiKey}\""); + writer.WriteLine($"VideoPath=\"{VideoPath}\""); + writer.WriteLine($"VisorWipe=\"{VisorWipe}\""); + writer.WriteLine($"VideoRecord=\"{VideoRecord}\""); + writer.WriteLine($"OfflineMode=\"{OfflineMode}\""); + writer.WriteLine($"Theme=\"{Theme}\""); + } + } + } +} diff --git a/AutoTrackR2/StatsPage.xaml b/AutoTrackR2/StatsPage.xaml new file mode 100644 index 0000000..8ba7626 --- /dev/null +++ b/AutoTrackR2/StatsPage.xaml @@ -0,0 +1,8 @@ +<UserControl x:Class="AutoTrackR2.StatsPage" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + Height="396" Width="626"> + <Grid Background="{DynamicResource BackgroundLightBrush}"> + <TextBlock Text="Welcome to the Stats Tab!" FontSize="24" Foreground="{DynamicResource TextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center"/> + </Grid> +</UserControl> diff --git a/AutoTrackR2/StatsPage.xaml.cs b/AutoTrackR2/StatsPage.xaml.cs new file mode 100644 index 0000000..6ae05d3 --- /dev/null +++ b/AutoTrackR2/StatsPage.xaml.cs @@ -0,0 +1,12 @@ +using System.Windows.Controls; + +namespace AutoTrackR2 +{ + public partial class StatsPage : UserControl + { + public StatsPage() + { + InitializeComponent(); + } + } +} diff --git a/AutoTrackR2/UpdatePage.xaml b/AutoTrackR2/UpdatePage.xaml new file mode 100644 index 0000000..6f16fe9 --- /dev/null +++ b/AutoTrackR2/UpdatePage.xaml @@ -0,0 +1,8 @@ +<UserControl x:Class="AutoTrackR2.UpdatePage" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + Height="396" Width="626"> + <Grid Background="{DynamicResource BackgroundLightBrush}"> + <TextBlock Text="Welcome to the Update Tab!" FontSize="24" Foreground="{DynamicResource TextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center"/> + </Grid> +</UserControl> diff --git a/AutoTrackR2/UpdatePage.xaml.cs b/AutoTrackR2/UpdatePage.xaml.cs new file mode 100644 index 0000000..e8b4302 --- /dev/null +++ b/AutoTrackR2/UpdatePage.xaml.cs @@ -0,0 +1,12 @@ +using System.Windows.Controls; + +namespace AutoTrackR2 +{ + public partial class UpdatePage : UserControl + { + public UpdatePage() + { + InitializeComponent(); + } + } +}