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

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

View file

@ -8,7 +8,7 @@ namespace WeeXnes.Core
{
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 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 CensorKeys = "CensorKeys";
public const string CopyOnSelect = "CopyOnSelect";
}
public static class DiscordRpcFiles
{
@ -48,6 +49,15 @@ namespace WeeXnes.Core
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 += () =>
{
SettingsView.Data.settingsFile.SetValue(

View file

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

View file

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

View file

@ -28,6 +28,7 @@ namespace WeeXnes.Views.Settings
private void LoadSettingsToGui()
{
CheckboxCensorKeys.IsChecked = KeyManagerView.Data.censorKeys.Value;
CheckboxCopyOnSelect.IsChecked = KeyManagerView.Data.copyOnSelect.Value;
}
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));
}
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>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<Version>4.2.2</Version>
<Version>4.2.3</Version>
<ProjectGuid>{4B33CEE7-C74D-43B9-B99A-8B273D5195BC}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>WeeXnes</RootNamespace>