private void LoadColumnEdit() { DoOnMainThread(() => { //okay lets spawn a dialog for editing the columns in the grid var currentColumns = DynamicGridViewModel.FieldMetadata .OrderBy(f => f.Order) .Select(f => new KeyValuePair <string, double>(f.FieldName, f.WidthPart)) .ToArray(); Action <IEnumerable <ColumnEditDialogViewModel.SelectableColumn> > letsLoadTheColumns = (newColumnSet) => { DoOnMainThread(() => { ExplicitlySelectedColumns = new List <GridFieldMetadata>(); for (var i = 1; i <= newColumnSet.Count(); i++) { var thisOne = newColumnSet.ElementAt(i - 1); ExplicitlySelectedColumns.Add(new GridFieldMetadata(new ViewField(thisOne.FieldName, i, Convert.ToInt32(thisOne.Width)))); } ClearChildForm(); RecreateGrid(); QuickFind(); }); }; var columnEditDialog = new ColumnEditDialogViewModel(RecordType, currentColumns, RecordService, letsLoadTheColumns, ClearChildForm, ApplicationController); LoadChildForm(columnEditDialog); }); }
private void LoadColumnEdit() { LoadingViewModel.IsLoading = true; DoOnMainThread(() => { try { //okay lets spawn a dialog for editing the columns in the grid var currentColumns = DynamicGridViewModel.FieldMetadata .ToArray(); Action <IEnumerable <GridFieldMetadata> > letsLoadTheColumns = (newColumnSet) => { LoadingViewModel.IsLoading = true; DoOnMainThread(() => { try { ExplicitlySelectedColumns = newColumnSet.ToList(); ClearChildForm(); RecreateGrid(); QuickFind(); } catch (Exception ex) { ApplicationController.ThrowException(ex); } finally { LoadingViewModel.IsLoading = false; } }); }; var columnEditDialog = new ColumnEditDialogViewModel(RecordType, currentColumns, RecordService, letsLoadTheColumns, ClearChildForm, ApplicationController, allowLinkedFields: true); LoadChildForm(columnEditDialog); } catch (Exception ex) { ApplicationController.ThrowException(ex); } finally { ApplicationController.DoOnAsyncThread(() => LoadingViewModel.IsLoading = false); } }); }