Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add settings page #51

Merged
merged 88 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
0c491ed
Add settings control
RyanLua Dec 11, 2024
b243c5d
Add settings button
RyanLua Dec 11, 2024
f3412f3
Add empty settings page
RyanLua Dec 11, 2024
1d0a3f6
Add navigation
RyanLua Dec 11, 2024
2eb85d2
Cleanup
RyanLua Dec 11, 2024
93f0f33
Cache main page
RyanLua Dec 11, 2024
923fa77
Move styles to main page
RyanLua Dec 11, 2024
26c00bf
Fix warnings caused by settings control
RyanLua Dec 11, 2024
9385f1a
Add early settings
RyanLua Dec 11, 2024
756a5d7
Cleanup
RyanLua Dec 11, 2024
aaaefaa
Polish settings page
RyanLua Dec 12, 2024
8a14416
Merge branch 'main' into settings-page
RyanLua Jan 9, 2025
a1df690
Fix missing settings button event
RyanLua Jan 11, 2025
1c6c857
Fix indentation
RyanLua Jan 11, 2025
bc5a6b4
Improve formatting
RyanLua Jan 11, 2025
5d26ca0
Fix issues with hotkey registration
RyanLua Jan 15, 2025
5d982a5
Use WinUIEx Window Message Monitor instead of manual interop.
RyanLua Jan 15, 2025
9f1d4b1
Remove id const
RyanLua Jan 15, 2025
06f8d30
Add theme switcher
RyanLua Jan 16, 2025
8763999
Add system backdrop setting
RyanLua Jan 16, 2025
04799bc
Update WinUIEx
RyanLua Jan 16, 2025
a0b688f
Fix naming
RyanLua Jan 16, 2025
d45aab7
Add Mica Alt
RyanLua Jan 16, 2025
c95eccd
Remove hotkey setting
RyanLua Jan 16, 2025
1865b5d
Use FontIconSourceExtension
RyanLua Jan 21, 2025
cb5ec88
Fix button sizing
RyanLua Jan 21, 2025
a0a1e85
Add always on top control
RyanLua Jan 21, 2025
faa76ea
Add always on top toggle
RyanLua Jan 22, 2025
fbeae0f
Adjust section header spacing
RyanLua Jan 22, 2025
9cf7e45
Improve readability
RyanLua Jan 22, 2025
456f575
Fix alignment
RyanLua Jan 22, 2025
6cc8a13
Refactor and cleanup code
RyanLua Jan 22, 2025
564c6b3
Improve mouse variable name
RyanLua Feb 3, 2025
dfa945e
Update FluentAutoClicker/MainPage.xaml.cs
RyanLua Feb 3, 2025
ff3680e
Merge branch 'settings-page' of https://github.com/RyanLua/FluentAuto…
RyanLua Feb 3, 2025
5ad872f
Update CsWin32
RyanLua Feb 3, 2025
d8dc634
Update Windows App SDK
RyanLua Feb 3, 2025
4063c35
Localize setting cards
RyanLua Feb 6, 2025
bb99bf5
Localize publisher display name
RyanLua Feb 6, 2025
8322930
Update titlebar
RyanLua Feb 6, 2025
3891d00
Merge branch 'main' into settings-page
RyanLua Feb 7, 2025
55d02bd
Localize hyperlink buttons
RyanLua Feb 8, 2025
edc4928
Add notification badge logic
RyanLua Feb 10, 2025
31fd5ba
Update feedback button
RyanLua Feb 10, 2025
f4e7f07
Use experimental BadgeNotificationManager
RyanLua Feb 10, 2025
fcfe590
Remove unnecessary usings
RyanLua Feb 10, 2025
e7ec1c9
Mark as non-static
RyanLua Feb 10, 2025
1014d70
Update source code link name
RyanLua Feb 10, 2025
ad426b5
Add basic system information
RyanLua Feb 10, 2025
6d7d804
Add functional feedback button
RyanLua Feb 11, 2025
631c8ce
Update copyright date
RyanLua Feb 11, 2025
8a175d6
Merge branch 'notification-badge' into settings-page
RyanLua Feb 11, 2025
99c9c1f
Add missing badge logic
RyanLua Feb 11, 2025
a201950
Add notification badge settings
RyanLua Feb 11, 2025
d3d9fcb
Localize notification badge
RyanLua Feb 11, 2025
49e771d
Use binding for backdrop material
RyanLua Feb 11, 2025
b964489
Add doc comments
RyanLua Feb 11, 2025
6c12445
Remove style comments for consistency
RyanLua Feb 12, 2025
40db1d4
Don't warn about evaluation purposes only
RyanLua Feb 12, 2025
c65b7db
Use binding for repeat and offset checkbox
RyanLua Feb 12, 2025
7c5d17f
Remove hard coding disabled color
RyanLua Feb 12, 2025
526983e
Fix links
RyanLua Feb 12, 2025
e3b8c07
Fix Discord link
RyanLua Feb 12, 2025
a1db8dc
Use titlebar control
RyanLua Feb 12, 2025
eb05ec0
Simplify titlebar logic
RyanLua Feb 12, 2025
68e5cca
Allow dragging with dialog
RyanLua Feb 12, 2025
0ec0f8d
Move back to WinUIEx titlebar
RyanLua Feb 12, 2025
30e6dca
Use icons for start button
RyanLua Feb 13, 2025
886eb22
Add settings tooltip
RyanLua Feb 13, 2025
ef049f0
Add notification badge settings logic
RyanLua Feb 13, 2025
c38e4e5
Fix default values
RyanLua Feb 13, 2025
e0b2397
Remove CN
RyanLua Feb 18, 2025
b75980b
Add Discord link
RyanLua Feb 18, 2025
3f49c1b
Add setting saving
RyanLua Feb 18, 2025
9516ff0
Remove extra method
RyanLua Feb 18, 2025
ced0093
Fix tooltip
RyanLua Feb 18, 2025
14d2246
Don't set always on top
RyanLua Feb 18, 2025
6c65754
Always on top by default
RyanLua Feb 18, 2025
1902364
Add IsEnabledTextBlock control
RyanLua Feb 19, 2025
06bb843
Fix checkbox binding
RyanLua Feb 20, 2025
9e3b63a
Add delay before starting
RyanLua Feb 21, 2025
c03546c
Use WASDK titlebar
RyanLua Feb 21, 2025
608875b
Fix crash related to back button
RyanLua Feb 21, 2025
954d25c
Cleanup code
RyanLua Feb 21, 2025
047e655
Update package versions
RyanLua Feb 21, 2025
139e818
Add doc comments
RyanLua Feb 21, 2025
4e6a0e2
Add missing doc comments to other files
RyanLua Feb 21, 2025
ad45b0d
Organize code
RyanLua Feb 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions FluentAutoClicker/App.xaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>

<Application
x:Class="FluentAutoClicker.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FluentAutoClicker">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand All @@ -14,4 +14,4 @@
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>
</Application>
7 changes: 5 additions & 2 deletions FluentAutoClicker/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ namespace FluentAutoClicker;
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : Application
public partial class App
{
/// <summary>
/// The main window of the application.
/// </summary>
public static readonly MainWindow MainWindow = new();

/// <summary>
Expand All @@ -42,7 +45,7 @@ public App()
/// Invoked when the application is launched.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
MainWindow.Activate();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Copyright (C) 2025 Ryan Luu
//
// This file is part of Fluent Auto Clicker.
//
// Fluent Auto Clicker is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Fluent Auto Clicker is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Fluent Auto Clicker. If not, see <https://www.gnu.org/licenses/>.

using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System.ComponentModel;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace FluentAutoClicker.Controls;

/// <summary>
/// A custom control that displays text and changes its visual state based on its enabled state.
/// </summary>
[TemplateVisualState(Name = "Normal", GroupName = "CommonStates")]
[TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")]
public partial class IsEnabledTextBlock : Control
{
/// <summary>
/// Identifies the <see cref="Text" /> dependency property.
/// </summary>
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
"Text",
typeof(string),
typeof(IsEnabledTextBlock),
null);

/// <summary>
/// Initializes a new instance of the <see cref="IsEnabledTextBlock" /> class.
/// </summary>
public IsEnabledTextBlock()
{
DefaultStyleKey = typeof(IsEnabledTextBlock);
}

/// <summary>
/// Gets or sets the text content of the control.
/// </summary>
[Localizable(true)]
public string Text
{
get => (string)GetValue(TextProperty);
set => SetValue(TextProperty, value);
}

/// <summary>
/// Applies the control template and sets up the initial visual state.
/// </summary>
protected override void OnApplyTemplate()
{
IsEnabledChanged -= IsEnabledTextBlock_IsEnabledChanged;
SetEnabledState();
IsEnabledChanged += IsEnabledTextBlock_IsEnabledChanged;
base.OnApplyTemplate();
}

/// <summary>
/// Handles the IsEnabledChanged event and updates the visual state.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The event data.</param>
private void IsEnabledTextBlock_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
{
SetEnabledState();
}

/// <summary>
/// Sets the visual state of the control based on its enabled state.
/// </summary>
private void SetEnabledState()
{
_ = VisualStateManager.GoToState(this, IsEnabled ? "Normal" : "Disabled", true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FluentAutoClicker.Controls">

<Style TargetType="local:IsEnabledTextBlock">
<Setter Property="Foreground" Value="{ThemeResource DefaultTextForegroundThemeBrush}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:IsEnabledTextBlock">
<Grid>
<TextBlock
x:Name="Label"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
Text="{TemplateBinding Text}"
TextWrapping="WrapWholeWords" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<VisualState.Setters>
<Setter Target="Label.Foreground" Value="{ThemeResource TextFillColorDisabledBrush}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
13 changes: 5 additions & 8 deletions FluentAutoClicker/FluentAutoClicker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<NoWarn>8305</NoWarn>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down Expand Up @@ -38,13 +39,14 @@
<ProjectCapability Include="Msix" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.106">
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.183">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.2.241112-preview1" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.241114003" />
<PackageReference Include="WinUIEx" Version="2.5.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250208002-preview1" />
<PackageReference Include="WinUIEx" Version="2.5.1" />
</ItemGroup>

<!--
Expand All @@ -56,11 +58,6 @@
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>

<!-- Disable CsWinRTProjection to stop native AOT warnings -->
<PropertyGroup Label="Globals">
<WebView2EnableCsWinRTProjection>False</WebView2EnableCsWinRTProjection>
</PropertyGroup>

<!-- Publish Properties -->
<PropertyGroup>
<PublishAot Condition="'$(Configuration)' == 'Debug'">False</PublishAot>
Expand Down
37 changes: 20 additions & 17 deletions FluentAutoClicker/Helpers/AutoClicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static class AutoClicker
/// <param name="millisecondsDelay">The number of milliseconds to wait before clicks.</param>
/// <param name="clickAmount">The number of clicks before stopping the auto clicker thread.</param>
/// <param name="mouseButtonType">The mouse button used to click.</param>
/// <param name="clickDelayOffset">The amount of time in milliseconds to add randomly to the millisecond delay between clicks.</param>
/// <param name="clickDelayOffset">Milliseconds to add randomly to delay between clicks.</param>
public static void Start(int millisecondsDelay = 100, int clickAmount = 0,
int mouseButtonType = 0, int clickDelayOffset = 0)
{
Expand Down Expand Up @@ -82,23 +82,26 @@ private static async void AutoClickerThread(int clickInterval, int repeatAmount,
/// <summary>
/// Clicks the mouse button.
/// </summary>
/// <param name="button">The mouse button to click.</param>
private static void ClickMouse(int button)
/// <param name="mouseButton">The mouse button to click.</param>
private static void ClickMouse(int mouseButton)
{
if (button == 0) // Left mouse button
switch (mouseButton)
{
SendMouseInput(MOUSE_EVENT_FLAGS.MOUSEEVENTF_LEFTDOWN);
SendMouseInput(MOUSE_EVENT_FLAGS.MOUSEEVENTF_LEFTUP);
}
else if (button == 1) // Middle mouse button
{
SendMouseInput(MOUSE_EVENT_FLAGS.MOUSEEVENTF_MIDDLEDOWN);
SendMouseInput(MOUSE_EVENT_FLAGS.MOUSEEVENTF_MIDDLEUP);
}
else if (button == 2) // Right mouse button
{
SendMouseInput(MOUSE_EVENT_FLAGS.MOUSEEVENTF_RIGHTDOWN);
SendMouseInput(MOUSE_EVENT_FLAGS.MOUSEEVENTF_RIGHTUP);
// Left mouse button
case 0:
SendMouseInput(MOUSE_EVENT_FLAGS.MOUSEEVENTF_LEFTDOWN);
SendMouseInput(MOUSE_EVENT_FLAGS.MOUSEEVENTF_LEFTUP);
break;
// Middle mouse button
case 1:
SendMouseInput(MOUSE_EVENT_FLAGS.MOUSEEVENTF_MIDDLEDOWN);
SendMouseInput(MOUSE_EVENT_FLAGS.MOUSEEVENTF_MIDDLEUP);
break;
// Right mouse button
case 2:
SendMouseInput(MOUSE_EVENT_FLAGS.MOUSEEVENTF_RIGHTDOWN);
SendMouseInput(MOUSE_EVENT_FLAGS.MOUSEEVENTF_RIGHTUP);
break;
}
}

Expand All @@ -119,4 +122,4 @@ private static void SendMouseInput(MOUSE_EVENT_FLAGS dwFlags)

_ = PInvoke.SendInput(inputs, Marshal.SizeOf<INPUT>());
}
}
}
72 changes: 55 additions & 17 deletions FluentAutoClicker/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>

<Page
x:Class="FluentAutoClicker.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
xmlns:controls="using:FluentAutoClicker.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="using:CommunityToolkit.WinUI"
NavigationCacheMode="Enabled"
mc:Ignorable="d">

<Grid RowSpacing="{StaticResource GridRowSpacing}">
<Page.Resources>
<x:Double x:Key="NumberBoxColumnSpacing">4</x:Double>
<x:Double x:Key="ButtonColumnSpacing">8</x:Double>
<x:Double x:Key="GridRowSpacing">8</x:Double>
<x:Double x:Key="StackPanelSpacing">8</x:Double>
</Page.Resources>

<Grid Margin="{StaticResource ContentMargin}" RowSpacing="{StaticResource GridRowSpacing}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
Expand All @@ -20,9 +32,9 @@
</Grid.ColumnDefinitions>

<!-- Click Interval -->
<StackPanel Grid.ColumnSpan="2" Spacing="{StaticResource StackPanelRowSpacing}">
<TextBlock x:Name="ClickIntervalTextBlock" x:Uid="TextBlockClickInterval" />
<Grid ColumnSpacing="{StaticResource RadioButtonsColumnSpacing}">
<StackPanel Grid.ColumnSpan="2" Spacing="{StaticResource StackPanelSpacing}">
<controls:IsEnabledTextBlock x:Name="ClickIntervalTextBlock" x:Uid="TextBlockClickInterval" />
<Grid ColumnSpacing="{StaticResource NumberBoxColumnSpacing}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
Expand Down Expand Up @@ -82,19 +94,20 @@
x:Name="MouseButtonTypeComboBox"
x:Uid="ComboBoxMouseButton"
Grid.Row="1"
Grid.Column="0"
SelectedIndex="0">
<ComboBoxItem x:Uid="ComboBoxItemLeft" />
<ComboBoxItem x:Uid="ComboBoxItemMiddle" />
<ComboBoxItem x:Uid="ComboBoxItemRight" />
</ComboBox>

<!-- Hotkey -->
<StackPanel Grid.Row="2" Spacing="{StaticResource StackPanelRowSpacing}">
<TextBlock x:Name="HotkeyTextBlock" x:Uid="TextBlockHotkey" />
<Button
x:Name="HotkeyButton"
Content="F6"
IsEnabled="False" />
<StackPanel
Grid.Row="2"
Grid.Column="0"
Spacing="{StaticResource StackPanelSpacing}">
<controls:IsEnabledTextBlock x:Name="HotkeyTextBlock" x:Uid="TextBlockHotkey" />
<Button Content="F6" IsEnabled="False" />
</StackPanel>

<!-- Click Repeat -->
Expand Down Expand Up @@ -135,15 +148,40 @@
Value="10" />
</StackPanel>

<!-- Start Auto Clicker -->
<ToggleButton
x:Name="StartToggleButton"
x:Uid="ToggleButtonStart"
<Grid
Grid.Row="3"
Grid.Column="0"
Grid.ColumnSpan="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Bottom"
Checked="StartToggleButton_OnChecked"
Unchecked="StartToggleButton_OnUnchecked" />
ColumnSpacing="{StaticResource ButtonColumnSpacing}">

<!-- Start Auto Clicker -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ToggleButton
x:Name="ToggleButtonStart"
x:Uid="ToggleButtonStart"
Height="32"
HorizontalAlignment="Stretch"
Checked="ToggleButtonStart_OnChecked"
Unchecked="ToggleButtonStart_OnUnchecked">
<FontIcon x:Name="FontIconStart" Glyph="&#xEE4A;" />
</ToggleButton>

<!-- Open Settings -->
<Button
x:Uid="ButtonSettings"
Grid.Column="1"
Height="32"
Click="SettingsButton_Click">
<AnimatedIcon FallbackIconSource="{ui:FontIconSource Glyph=&#xE713;}">
<AnimatedIcon.Source>
<animatedvisuals:AnimatedSettingsVisualSource />
</AnimatedIcon.Source>
</AnimatedIcon>
</Button>
</Grid>
</Grid>
</Page>
Loading