private void OkToDeleteCustomerMessageSink(Boolean okToDeleteCustomer) { if (okToDeleteCustomer) { try { if (DataAccess.DataService.DeleteCustomer(CurrentCustomer.CustomerId.DataValue)) { //now we need to tell SearchCustomersViewModel to refresh its list of //customers as we deleted the customer that was selected CurrentCustomer = null; matchedCustomersCollectionView.MoveCurrentToPosition(-1); DoSearchCommand.Execute(null); messageBoxService.ShowInformation("Sucessfully deleted the Customer"); } else { messageBoxService.ShowError("There was a problem deleting the Customer"); } } catch { messageBoxService.ShowError("There was a problem deleting the Customer"); } } else { messageBoxService.ShowError("Can't delete Customer as it is currently being edited"); } }
internal void OnSearchHistorySelected(SearchHistory item) { SearchText.Value = item.Keyword; SelectedTarget.Value = TargetListItems.Single(x => x == item.Target); DoSearchCommand.Execute(); }
protected override void ItemSelected(BaseItem selectedItem) { try { var searchText = Text; IsOpen = false; Workspace.FocusCurrentOrFirst(); _searchCommand.Execute(searchText); } catch (Exception ex) { Workspace.NotificationHost.AddError("Error creating Item", ex); } }