private async void menuitemDeviceGroupDelete_Click(object sender, RoutedEventArgs e) { var model = gridDeviceGroups.SelectedItem as DeviceGroupModel; if (model == null) { return; } var mboxResult = MessageBox.Show(this, $"Do you want to delete the device group \"{model.DeviceGroup}\"?", "Delete Device Group", MessageBoxButton.OKCancel, MessageBoxImage.Question); if (mboxResult != MessageBoxResult.OK) { return; } Cursor = Cursors.Wait; try { ModelManager modelManager = ModelManager.GetInstance(); if (await modelManager.DeleteDeviceGroup(this.CurrentTenantModel, model)) { MessageBox.Show("DeviceGroup delete is success", "OK", MessageBoxButton.OK); } else { MessageBox.Show("DeviceGroup delete is failure", "Error", MessageBoxButton.OK); } } finally { Cursor = null; } Cursor = null; }