48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
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"); }
|
|
}
|
|
} |