private void RaiseItemSelection() { // Here we have a custom implementation of INotification which allows us to pass custom data in the // parameter of the interaction request. In this case, we are passing a list of items. ItemSelectionNotification notification = new ItemSelectionNotification(); notification.Items.Add("Item1"); notification.Items.Add("Item2"); notification.Items.Add("Item3"); notification.Items.Add("Item4"); notification.Items.Add("Item5"); notification.Items.Add("Item6"); notification.Title = "Items"; // The custom popup view in this case has its own view model which implements the IInteractionRequestAware interface // therefore, its Notification property will be automatically populated with this notification by the PopupWindowAction. // Like this that view model is able to recieve data from this one without knowing each other. this.InteractionResultMessage = ""; this.ItemSelectionRequest.Raise(notification, returned => { if (returned != null && returned.Confirmed && returned.SelectedItem != null) { this.InteractionResultMessage = "The user selected: " + returned.SelectedItem; } else { this.InteractionResultMessage = "The user cancelled the operation or didn't select an item."; } }); }
private void FindAccount() { var notification = new ItemSelectionNotification(); notification.Title = ApplicationStrings.NotificationFindAccount; FindAccountRequest.Raise(notification, r => { if (r != null && r.Confirmed && r.SelectedItem != null) { if (r.SelectedItem is Client.Entities.Account found_account) { GetAccount(found_account.AccountCode); } } }); }
private void NewInvoiceFromOrders() { ItemSelectionNotification notification = new ItemSelectionNotification(ApplicationStrings.FindOrderForInvoicingPayload); notification.Title = ApplicationStrings.NotificationFindOrder; FindOrderRequest.Raise(notification, r => { if (r != null && r.Confirmed && r.SelectedItem != null) { List <Order> orders = r.SelectedItem as List <Order>; if (orders != null) { GenerateInvoiceFromOrderItems(orders); } } }); }
private void RaiseItemSelection() { // Here we have a custom implementation of INotification which allows us to pass custom data in the // parameter of the interaction request. In this case, we are passing a list of items. IEnumerable sourceList = DataSource as IEnumerable; ItemSelectionNotification notification = new ItemSelectionNotification(sourceList); notification.Title = Title; notification.AssistProperites = AssistProperties; // The custom popup view in this case has its own view model which implements the IInteractionRequestAware interface // therefore, its Notification property will be automatically populated with this notification by the PopupWindowAction. // Like this that view model is able to recieve data from this one without knowing each other. // this.InteractionResultMessage = ""; this.ItemSelectionRequest.Raise(notification, returned => { if (returned != null && returned.Confirmed && returned.SelectedItem != null) { this.InteractionResultMessage = returned.SelectedItem; if (OnSelectedItem != null) { OnSelectedItem.Invoke(SelectionState.OK, returned.SelectedItem); } } else { if (OnSelectedItem != null) { OnSelectedItem.Invoke(SelectionState.Cancel, returned.SelectedItem); } } }); }