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

Update 1.4? #27

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added .github/Images/HoldOption.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Images/ProcessSelection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Images/SettingsMenu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Images/Theme.xaml.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Images/ThemeSelector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Images/Themes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/Images/UserThemesFolder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 105 additions & 0 deletions AlphaClicker/AHKManage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<Window x:Class="AlphaClicker.AHKManage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:AlphaClicker"
mc:Ignorable="d"
ResizeMode="CanMinimize"
WindowStyle="None"
Title="Alpha Clicker Settings"
Height="246" Width="400"
Background="{x:Null}"
AllowsTransparency="True"
MouseLeftButtonDown="AHK_MouseLeftButtonDown">

<Border Margin="10"
CornerRadius="15"
Background="{DynamicResource BackgroundColor}"
BorderBrush="Gray"
BorderThickness="0.3">

<Border.Effect>
<DropShadowEffect BlurRadius="15" Direction="-90"
RenderingBias="Quality" ShadowDepth="2"/>
</Border.Effect>

<Grid HorizontalAlignment="Stretch" Height="Auto" Margin="0,0,0,0" VerticalAlignment="Stretch" Width="Auto">
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<Label x:Name="AHKManageLabel" Content="AHK Manage"
FontSize="15"
Foreground="{DynamicResource TextColor}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Margin="0,0,0,0"/>

<!-- X button -->
<Ellipse x:Name="closeButton"
Fill="{DynamicResource CloseButton}"
Style="{DynamicResource GrowOnHover}"
Grid.Row="0"
Height="20" Width="20"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Margin="0,0,10,0"
MouseLeftButtonDown="closeButton_MouseLeftButtonDown">

<Ellipse.RenderTransform>
<ScaleTransform ScaleX="1.0" ScaleY="1.0" />
</Ellipse.RenderTransform>
</Ellipse>

<Grid Grid.Row="1" HorizontalAlignment="Stretch" Height="Auto" Margin="0,0,0,0" VerticalAlignment="Stretch" Width="Auto">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="35"/>
<RowDefinition Height="107"/>
<RowDefinition/>
</Grid.RowDefinitions>

<!-- Label to show current AHK path -->
<Label x:Name="CurrentPathLabel"
Content="Current AHK Path: [Not Set]"
FontSize="12"
VerticalAlignment="Center"
HorizontalAlignment="Center" Height="26" Width="359"/>

<!-- Button to open file selection window -->
<Button x:Name="BrowseButton"
Content="Browse"
Background="{DynamicResource LowerButtons}"
Grid.Row="1"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="10,0,0,0"
Width="75"
Height="24"
Click="BrowseButton_Click"/>

<!-- Button to install AHK -->
<Button x:Name="InstallButton"
Content="Install AHK"
Background="{DynamicResource LowerButtons}"
Grid.Row="1"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="269,0,0,0"
Width="100"
Height="24"
Click="InstallButton_Click"/>
<TextBlock HorizontalAlignment="Center"
Margin="0,17,0,0"
Grid.Row="2"
TextWrapping="Wrap"
Text="To be able to use the (SelectProcess) feature AHK needs to be installed. AutoHotKey is a open source scripting language that makes this process a lot easier. You can read about it here (https://www.autohotkey.com) After installation you need to select it with the browse button."
VerticalAlignment="Top"
Height="80"
Width="359"/>
</Grid>
</Grid>
</Border>
</Window>
82 changes: 82 additions & 0 deletions AlphaClicker/AHKManage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Microsoft.Win32;


namespace AlphaClicker
{
/// <summary>
/// Interaction logic for AHKManage.xaml
/// </summary>
public partial class AHKManage : Window
{
public AHKManage()
{
InitializeComponent();
}

private void InstallButton_Click(object sender, RoutedEventArgs e)
{
string url = "https://www.autohotkey.com/download/ahk-v2.exe"; // Autohotkey download
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to keep AlphaClicker idendependent, not dependent on external software. If features from AHK is wished, implement them directly with the win32 api, not by proxing through ahk.

try
{
// Open the URL in the default web browser
System.Diagnostics.Process.Start(new ProcessStartInfo
{
FileName = url,
UseShellExecute = true // Necessary to open URLs in .NET Core and later versions
});
}
catch (Exception ex)
{
MessageBox.Show($"Unable to download: {ex.Message}"+ " " + "Please download manually from autohotkey.com");
}
}

private void BrowseButton_Click(object sender, RoutedEventArgs e)
{
// Create an instance of OpenFileDialog
OpenFileDialog openFileDialog = new OpenFileDialog();

// Set filter options for the file dialog (optional)
openFileDialog.Filter = "AutoHotkey Executables (*.exe)|*.exe|All files (*.*)|*.*";
openFileDialog.Title = "Select AutoHotkey Executable";

// Show the dialog and check if the user selected a file
bool? result = openFileDialog.ShowDialog();

if (result == true)
{
// Get the selected file path
string selectedFilePath = openFileDialog.FileName;

Properties.Settings.Default.AHKInstallPath = selectedFilePath;
Properties.Settings.Default.Save();

// Update the label or any other UI element with the selected file path
CurrentPathLabel.Content = $"Current AHK Path: {selectedFilePath}";
}
}
private void AHK_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
DragMove();
}

private void closeButton_MouseLeftButtonDown(object sender, MouseEventArgs e)
{
Close();
}
}
}
Loading