Refactor: Streamline code formatting, introduce cleaner structure, and remove unused Class1. Add .editorconfig for consistent coding style.
This commit is contained in:
@@ -15,32 +15,60 @@ public partial class MainWindow : Window
|
||||
|
||||
Closed += async (_, __) =>
|
||||
{
|
||||
try { await _vm.DisposeAsync(); } catch { }
|
||||
try
|
||||
{
|
||||
await _vm.DisposeAsync();
|
||||
}
|
||||
catch { }
|
||||
};
|
||||
}
|
||||
|
||||
private async void StartChildren_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
try { await _vm.StartChildrenAsync(count: 3); }
|
||||
catch (Exception ex) { await MessageBoxAsync(ex.Message); }
|
||||
try
|
||||
{
|
||||
await _vm.StartChildrenAsync(count: 3);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await MessageBoxAsync(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private async void PingSelected_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
try { await _vm.PingSelectedAsync(); }
|
||||
catch (Exception ex) { await MessageBoxAsync(ex.Message); }
|
||||
try
|
||||
{
|
||||
await _vm.PingSelectedAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await MessageBoxAsync(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private async void StartWork_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
try { await _vm.StartWorkSelectedAsync(); }
|
||||
catch (Exception ex) { await MessageBoxAsync(ex.Message); }
|
||||
try
|
||||
{
|
||||
await _vm.StartWorkSelectedAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await MessageBoxAsync(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private async void CancelWork_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
try { await _vm.CancelWorkSelectedAsync(); }
|
||||
catch (Exception ex) { await MessageBoxAsync(ex.Message); }
|
||||
try
|
||||
{
|
||||
await _vm.CancelWorkSelectedAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await MessageBoxAsync(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task MessageBoxAsync(string message)
|
||||
@@ -61,10 +89,10 @@ public partial class MainWindow : Window
|
||||
{
|
||||
HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Right,
|
||||
Content = "OK",
|
||||
IsDefault = true
|
||||
}
|
||||
}
|
||||
}
|
||||
IsDefault = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
if (dlg.Content is StackPanel sp && sp.Children.LastOrDefault() is Button ok)
|
||||
@@ -74,4 +102,4 @@ public partial class MainWindow : Window
|
||||
|
||||
await dlg.ShowDialog(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user