Initial commit
This commit is contained in:
48
ParentWpf/MainWindow.xaml.cs
Normal file
48
ParentWpf/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ParentWpf;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private readonly MainViewModel _vm;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
_vm = new MainViewModel();
|
||||
DataContext = _vm;
|
||||
}
|
||||
|
||||
protected override async void OnClosed(EventArgs e)
|
||||
{
|
||||
base.OnClosed(e);
|
||||
try { await _vm.DisposeAsync(); } catch { }
|
||||
}
|
||||
|
||||
private async void StartChildren_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try { await _vm.StartChildrenAsync(count: 3); }
|
||||
catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error"); }
|
||||
}
|
||||
|
||||
private async void PingSelected_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try { await _vm.PingSelectedAsync(); }
|
||||
catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error"); }
|
||||
}
|
||||
|
||||
private async void StartWork_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try { await _vm.StartWorkSelectedAsync(); }
|
||||
catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error"); }
|
||||
}
|
||||
|
||||
private async void CancelWork_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try { await _vm.CancelWorkSelectedAsync(); }
|
||||
catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error"); }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user