Fix the code merge mistake

This commit is contained in:
Yusyuriv 2024-04-12 18:42:45 +06:00
parent 172764d361
commit 5e87e18fd3
No known key found for this signature in database
GPG key ID: A91C52E6F73148E0
2 changed files with 22 additions and 35 deletions

View file

@ -39,10 +39,11 @@
</Popup> </Popup>
<ToggleButton <ToggleButton
IsChecked="{Binding IsEditingHotkey, Mode=TwoWay, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" x:Name="HotkeyBtn"
FontSize="13" FontSize="13"
FontWeight="Bold" FontWeight="Bold"
Foreground="{DynamicResource Color01B}"> Foreground="{DynamicResource Color01B}"
Click="OnStartRecordingClicked">
<ToggleButton.Template> <ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton"> <ControlTemplate TargetType="ToggleButton">
<Grid> <Grid>

View file

@ -40,15 +40,6 @@ namespace Flow.Launcher
public string[] KeysToDisplay => Hotkey.Split(" + "); public string[] KeysToDisplay => Hotkey.Split(" + ");
private bool _isEditingHotkey = false;
public bool IsEditingHotkey {
get => _isEditingHotkey;
set {
_isEditingHotkey = value;
OnPropertyChanged();
}
}
#nullable enable #nullable enable
public EventHandler<HotkeyEventArgs>? Action { get; set; } public EventHandler<HotkeyEventArgs>? Action { get; set; }
#nullable restore #nullable restore
@ -70,7 +61,7 @@ namespace Flow.Launcher
/*------------------ New Logic Structure Part ------------------------*/ /*------------------ New Logic Structure Part ------------------------*/
private void ToggleOn() private void OnStartRecordingClicked(object sender, RoutedEventArgs e)
{ {
if (HotkeyBtn.IsChecked == true) if (HotkeyBtn.IsChecked == true)
{ {
@ -80,7 +71,7 @@ namespace Flow.Launcher
} }
} }
private void StopRecPressed() private void OnStopRecordingClicked(object sender, RoutedEventArgs e)
{ {
/* If Stop Button Pressed*/ /* If Stop Button Pressed*/
/* 1. Save the REC Keys to settings /* 1. Save the REC Keys to settings
@ -89,6 +80,23 @@ namespace Flow.Launcher
* 4. Change ToggleBtn isChcked to false */ * 4. Change ToggleBtn isChcked to false */
} }
private void OnResetToDefaultClicked(object sender, RoutedEventArgs e)
{
HotkeyBtn.IsChecked = false;
if (!string.IsNullOrEmpty(Hotkey))
HotKeyMapper.RemoveHotkey(Hotkey);
Hotkey = DefaultHotkey;
HotKeyMapper.SetHotkey(new HotkeyModel(Hotkey), Action);
}
private void OnDeleteClicked(object sender, RoutedEventArgs e)
{
HotkeyBtn.IsChecked = false;
if (!string.IsNullOrEmpty(Hotkey))
HotKeyMapper.RemoveHotkey(Hotkey);
Hotkey = "";
}
/*------------------ New Logic Structure Part------------------------*/ /*------------------ New Logic Structure Part------------------------*/
private void HotkeyControl_LostFocus(object o, RoutedEventArgs routedEventArgs) private void HotkeyControl_LostFocus(object o, RoutedEventArgs routedEventArgs)
@ -235,27 +243,5 @@ namespace Flow.Launcher
{ {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
} }
private void OnStopRecordingClicked(object sender, RoutedEventArgs e)
{
IsEditingHotkey = false;
}
private void OnResetToDefaultClicked(object sender, RoutedEventArgs e)
{
IsEditingHotkey = false;
if (!string.IsNullOrEmpty(Hotkey))
HotKeyMapper.RemoveHotkey(Hotkey);
Hotkey = DefaultHotkey;
HotKeyMapper.SetHotkey(new HotkeyModel(Hotkey), Action);
}
private void OnDeleteClicked(object sender, RoutedEventArgs e)
{
IsEditingHotkey = false;
if (!string.IsNullOrEmpty(Hotkey))
HotKeyMapper.RemoveHotkey(Hotkey);
Hotkey = "";
}
} }
} }