| 123456789101112131415161718192021222324 |
- using Avalonia.Controls;
- namespace SlamCross.Views;
- public partial class RenameWindow : Window
- {
- public string? NewName { get; private set; }
- public RenameWindow(string currentName)
- {
- InitializeComponent();
- if (this.FindControl<TextBox>("NameBox") is TextBox box)
- box.Text = currentName;
- }
- private void OK_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
- {
- if (this.FindControl<TextBox>("NameBox") is TextBox box && !string.IsNullOrWhiteSpace(box.Text))
- NewName = box.Text.Trim();
- Close();
- }
- private void Cancel_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e) => Close();
- }
|