public void Load(RecordEntryViewModelBase recordForm, string subGridReference) { recordForm.DoOnMainThread(() => { try { var mainFormInContext = recordForm; if (recordForm is GridRowViewModel) { mainFormInContext = recordForm.ParentForm; } var closeFunction = new CustomGridFunction("RETURN", "Return", () => mainFormInContext.ClearChildForm()); var targetType = GetTargetType(recordForm, subGridReference); var selectedFunction = new CustomGridFunction("ADDSELECTED", "Add Selected", (g) => AddSelectedItems(g, recordForm, subGridReference) , visibleFunction: (g) => g.SelectedRows.Any()); var childForm = new QueryViewModel(new[] { targetType }, GetQueryLookupService(recordForm, subGridReference), recordForm.ApplicationController, allowQuery: AllowQuery, loadInitially: !AllowQuery, closeFunction: closeFunction, customFunctions: new[] { selectedFunction }); childForm.TypeAhead = TypeAhead; 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; } }); }