add hide/unhide for renderkey
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@ namespace UnifiedFarmLauncher.ViewModels
|
|||||||
private readonly ConfigService _configService;
|
private readonly ConfigService _configService;
|
||||||
private string _sheepItUsername = string.Empty;
|
private string _sheepItUsername = string.Empty;
|
||||||
private string _sheepItRenderKey = string.Empty;
|
private string _sheepItRenderKey = string.Empty;
|
||||||
|
private bool _isRenderKeyVisible = false;
|
||||||
|
|
||||||
public GlobalSettingsViewModel(ConfigService configService)
|
public GlobalSettingsViewModel(ConfigService configService)
|
||||||
{
|
{
|
||||||
@@ -27,6 +28,12 @@ namespace UnifiedFarmLauncher.ViewModels
|
|||||||
set => SetAndRaise(ref _sheepItRenderKey, value);
|
set => SetAndRaise(ref _sheepItRenderKey, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsRenderKeyVisible
|
||||||
|
{
|
||||||
|
get => _isRenderKeyVisible;
|
||||||
|
set => SetAndRaise(ref _isRenderKeyVisible, value);
|
||||||
|
}
|
||||||
|
|
||||||
private void LoadSettings()
|
private void LoadSettings()
|
||||||
{
|
{
|
||||||
var config = _configService.Load();
|
var config = _configService.Load();
|
||||||
|
|||||||
@@ -15,7 +15,18 @@
|
|||||||
<TextBox Name="SheepItUsernameTextBox" Text="{Binding SheepItUsername}"/>
|
<TextBox Name="SheepItUsernameTextBox" Text="{Binding SheepItUsername}"/>
|
||||||
|
|
||||||
<TextBlock Text="Render Key:" Margin="0,10,0,0"/>
|
<TextBlock Text="Render Key:" Margin="0,10,0,0"/>
|
||||||
<TextBox Name="SheepItRenderKeyTextBox" Text="{Binding SheepItRenderKey}" PasswordChar="*"/>
|
<Grid ColumnDefinitions="*,Auto">
|
||||||
|
<TextBox Name="SheepItRenderKeyTextBox"
|
||||||
|
Grid.Column="0"
|
||||||
|
Text="{Binding SheepItRenderKey}"
|
||||||
|
PasswordChar="*"
|
||||||
|
Margin="0,0,5,0"/>
|
||||||
|
<Button Name="ToggleRenderKeyButton"
|
||||||
|
Grid.Column="1"
|
||||||
|
Content="👁"
|
||||||
|
Width="40"
|
||||||
|
ToolTip.Tip="Show/Hide Render Key"/>
|
||||||
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace UnifiedFarmLauncher.Views
|
|||||||
{
|
{
|
||||||
this.FindControl<Button>("OkButton")!.Click += OkButton_Click;
|
this.FindControl<Button>("OkButton")!.Click += OkButton_Click;
|
||||||
this.FindControl<Button>("CancelButton")!.Click += CancelButton_Click;
|
this.FindControl<Button>("CancelButton")!.Click += CancelButton_Click;
|
||||||
|
this.FindControl<Button>("ToggleRenderKeyButton")!.Click += ToggleRenderKeyButton_Click;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OkButton_Click(object? sender, RoutedEventArgs e)
|
private void OkButton_Click(object? sender, RoutedEventArgs e)
|
||||||
@@ -52,6 +53,21 @@ namespace UnifiedFarmLauncher.Views
|
|||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ToggleRenderKeyButton_Click(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var textBox = this.FindControl<Avalonia.Controls.TextBox>("SheepItRenderKeyTextBox");
|
||||||
|
if (textBox != null)
|
||||||
|
{
|
||||||
|
_viewModel.IsRenderKeyVisible = !_viewModel.IsRenderKeyVisible;
|
||||||
|
textBox.PasswordChar = _viewModel.IsRenderKeyVisible ? '\0' : '*';
|
||||||
|
var button = sender as Button;
|
||||||
|
if (button != null)
|
||||||
|
{
|
||||||
|
button.Content = _viewModel.IsRenderKeyVisible ? "🙈" : "👁";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<bool> ShowDialogAsync(Window parent)
|
public async Task<bool> ShowDialogAsync(Window parent)
|
||||||
{
|
{
|
||||||
await base.ShowDialog(parent);
|
await base.ShowDialog(parent);
|
||||||
|
|||||||
Reference in New Issue
Block a user