re-added the ability to enable/disable copying keys to the clipboard when selected

This commit is contained in:
WeeXnes 2023-05-02 10:48:28 +02:00
parent 01e388ff37
commit 6ce57b90ca
7 changed files with 36 additions and 2 deletions

View file

@ -57,6 +57,11 @@ namespace WeeXnes
Convert.ToBoolean(SettingsView.Data.settingsFile.GetValue( Convert.ToBoolean(SettingsView.Data.settingsFile.GetValue(
SaveSettingsHandler.Data.KeyManager.Section, SaveSettingsHandler.Data.KeyManager.Section,
SaveSettingsHandler.Data.KeyManager.CensorKeys)); SaveSettingsHandler.Data.KeyManager.CensorKeys));
KeyManagerView.Data.copyOnSelect.Value =
Convert.ToBoolean(SettingsView.Data.settingsFile.GetValue(
SaveSettingsHandler.Data.KeyManager.Section,
SaveSettingsHandler.Data.KeyManager.CopyOnSelect));
//Load paths //Load paths

View file

@ -8,7 +8,7 @@ namespace WeeXnes.Core
{ {
public class Information public class Information
{ {
public const string Version = "4.2.2"; public const string Version = "4.2.3";
public const string EncryptionHash = "8zf5#RdyQ]$4x4_"; public const string EncryptionHash = "8zf5#RdyQ]$4x4_";
public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest"; public const string ApiUrl = "https://api.github.com/repos/weexnes/weexnessuite/releases/latest";
} }

View file

@ -23,6 +23,7 @@ namespace WeeXnes.Core
{ {
public const string Section = "KEY_MANAGER"; public const string Section = "KEY_MANAGER";
public const string CensorKeys = "CensorKeys"; public const string CensorKeys = "CensorKeys";
public const string CopyOnSelect = "CopyOnSelect";
} }
public static class DiscordRpcFiles public static class DiscordRpcFiles
{ {
@ -48,6 +49,15 @@ namespace WeeXnes.Core
KeyManagerView.Data.censorKeys.Value.ToString() KeyManagerView.Data.censorKeys.Value.ToString()
); );
}; };
KeyManagerView.Data.copyOnSelect.ValueChanged += () =>
{
SettingsView.Data.settingsFile.SetValue(
Data.KeyManager.Section,
Data.KeyManager.CopyOnSelect,
KeyManagerView.Data.copyOnSelect.Value.ToString()
);
};
Global.AppDataPathRPC.ValueChanged += () => Global.AppDataPathRPC.ValueChanged += () =>
{ {
SettingsView.Data.settingsFile.SetValue( SettingsView.Data.settingsFile.SetValue(

View file

@ -14,6 +14,7 @@ namespace WeeXnes.Views.KeyManager
{ {
public static BindingList<KeyItem> KeyItemsList = new BindingList<KeyItem>(); public static BindingList<KeyItem> KeyItemsList = new BindingList<KeyItem>();
public static UpdateVar<bool> censorKeys = new UpdateVar<bool>(); public static UpdateVar<bool> censorKeys = new UpdateVar<bool>();
public static UpdateVar<bool> copyOnSelect = new UpdateVar<bool>();
} }
public KeyManagerView() public KeyManagerView()
{ {
@ -97,6 +98,9 @@ namespace WeeXnes.Views.KeyManager
KeyItem selectedItem = (KeyItem)ListviewKeys.SelectedItem; KeyItem selectedItem = (KeyItem)ListviewKeys.SelectedItem;
if(selectedItem == null) if(selectedItem == null)
return; return;
if(!Data.copyOnSelect.Value)
return;
Clipboard.SetText(selectedItem.Value); Clipboard.SetText(selectedItem.Value);
} }
} }

View file

@ -57,6 +57,10 @@
Name="CheckboxCensorKeys" Name="CheckboxCensorKeys"
Checked="CheckboxCensorKeys_OnChecked" Checked="CheckboxCensorKeys_OnChecked"
Unchecked="CheckboxCensorKeys_OnUnchecked"/> Unchecked="CheckboxCensorKeys_OnUnchecked"/>
<CheckBox Content="Copy Key to Clipboard when selected"
Name="CheckboxCopyOnSelect"
Checked="CheckboxCopyOnSelect_OnChecked"
Unchecked="CheckboxCopyOnSelect_OnUnchecked"/>
<TextBlock Text="Discord RPC" <TextBlock Text="Discord RPC"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Foreground="White"/> Foreground="White"/>

View file

@ -28,6 +28,7 @@ namespace WeeXnes.Views.Settings
private void LoadSettingsToGui() private void LoadSettingsToGui()
{ {
CheckboxCensorKeys.IsChecked = KeyManagerView.Data.censorKeys.Value; CheckboxCensorKeys.IsChecked = KeyManagerView.Data.censorKeys.Value;
CheckboxCopyOnSelect.IsChecked = KeyManagerView.Data.copyOnSelect.Value;
} }
private void CheckboxCensorKeys_OnChecked(object sender, RoutedEventArgs e) private void CheckboxCensorKeys_OnChecked(object sender, RoutedEventArgs e)
{ {
@ -109,5 +110,15 @@ namespace WeeXnes.Views.Settings
{ {
NavigationService.Navigate(new Uri("/Views/Settings/ChangePathsView.xaml",UriKind.Relative)); NavigationService.Navigate(new Uri("/Views/Settings/ChangePathsView.xaml",UriKind.Relative));
} }
private void CheckboxCopyOnSelect_OnChecked(object sender, RoutedEventArgs e)
{
KeyManagerView.Data.copyOnSelect.Value = true;
}
private void CheckboxCopyOnSelect_OnUnchecked(object sender, RoutedEventArgs e)
{
KeyManagerView.Data.copyOnSelect.Value = false;
}
} }
} }

View file

@ -4,7 +4,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<Version>4.2.2</Version> <Version>4.2.3</Version>
<ProjectGuid>{4B33CEE7-C74D-43B9-B99A-8B273D5195BC}</ProjectGuid> <ProjectGuid>{4B33CEE7-C74D-43B9-B99A-8B273D5195BC}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>WeeXnes</RootNamespace> <RootNamespace>WeeXnes</RootNamespace>