diff --git a/AmatsukazeGUI/ViewModels/SummaryItemViewModel.cs b/AmatsukazeGUI/ViewModels/SummaryItemViewModel.cs index 941da78..90413b9 100644 --- a/AmatsukazeGUI/ViewModels/SummaryItemViewModel.cs +++ b/AmatsukazeGUI/ViewModels/SummaryItemViewModel.cs @@ -13,6 +13,8 @@ using Amatsukaze.Models; using System.Windows.Media; +using Amatsukaze.Server; +using System.Collections; namespace Amatsukaze.ViewModels { @@ -138,5 +140,30 @@ public void ToggleSuspend() } #endregion + #region CancelCommand + private ListenerCommand _CancelCommand; + + public ListenerCommand CancelCommand + { + get + { + if (_CancelCommand == null) + { + _CancelCommand = new ListenerCommand(Cancel); + } + return _CancelCommand; + } + } + + public async void Cancel(IEnumerable selectedItems) + { + await Model.Server?.ChangeItem(new ChangeItemData() + { + ItemId = -1, + workerId = Data.Id - 1, + ChangeType = ChangeItemType.Cancel + }); + } + #endregion } } diff --git a/AmatsukazeGUI/Views/SummaryItem.xaml b/AmatsukazeGUI/Views/SummaryItem.xaml index 4e9a43f..f157f7f 100644 --- a/AmatsukazeGUI/Views/SummaryItem.xaml +++ b/AmatsukazeGUI/Views/SummaryItem.xaml @@ -66,6 +66,11 @@ GPU:@ + + + + +