public void Load(RecordEntryViewModelBase recordForm, string subGridReference) { recordForm.LoadingViewModel.IsLoading = true; recordForm.DoOnAsynchThread(() => { try { var mainFormInContext = recordForm; if (recordForm is GridRowViewModel) { mainFormInContext = recordForm.ParentForm; } //okay i need to load a dialog //displaying a grid of the selectable options with a checkbox Action <IEnumerable <PicklistOption> > onSave = (selectedOptions) => { mainFormInContext.LoadingViewModel.IsLoading = true; try { AddSelectedItems(selectedOptions, recordForm, subGridReference); mainFormInContext.ClearChildForm(); } catch (Exception ex) { mainFormInContext.ApplicationController.ThrowException(ex); } finally { mainFormInContext.LoadingViewModel.IsLoading = false; } }; var picklistOptions = GetSelectionOptions(recordForm, subGridReference) .OrderBy(o => o.Value) .ToArray(); var initialSelected = GetInitialSelectedOptions(recordForm, subGridReference); var childForm = new MultiSelectDialogViewModel <PicklistOption>(picklistOptions, initialSelected, onSave, () => mainFormInContext.ClearChildForm(), mainFormInContext.ApplicationController, saveButtonLabel: "Add Selections", cancelButtonLabel: "Return"); mainFormInContext.LoadChildForm(childForm); } catch (Exception ex) { recordForm.ApplicationController.ThrowException(ex); } finally { recordForm.LoadingViewModel.IsLoading = false; } }); }
public void Load(RecordEntryViewModelBase recordForm, string subGridReference) { recordForm.DoOnMainThread(() => { try { var mainFormInContext = recordForm; if (recordForm is GridRowViewModel) { mainFormInContext = recordForm.ParentForm; } //okay i need to load a dialog //displaying a grid of the selectable options with a checkbox Action <IEnumerable <PicklistOption> > onSave = (selectedOptions) => { //copy into the mainFormInContext.LoadingViewModel.IsLoading = true; try { AddSelectedItems(selectedOptions, recordForm, subGridReference); mainFormInContext.ClearChildForm(); } catch (Exception ex) { mainFormInContext.ApplicationController.ThrowException(ex); } finally { mainFormInContext.LoadingViewModel.IsLoading = false; } }; var picklistOptions = GetSelectionOptions(recordForm, subGridReference); var childForm = new MultiSelectDialogViewModel <PicklistOption>(picklistOptions, null, onSave, () => mainFormInContext.ClearChildForm(), mainFormInContext.ApplicationController); mainFormInContext.LoadChildForm(childForm); } catch (Exception ex) { recordForm.ApplicationController.ThrowException(ex); } finally { recordForm.LoadingViewModel.IsLoading = false; } }); }