private bool SaveDataContextByInvisibleForm() { bool result; using (InvisibleForm invisibleForm = new InvisibleForm()) { invisibleForm.BackgroundWorker.DoWork += delegate(object sender, DoWorkEventArgs e2) { base.Context.SaveData(new WinFormsCommandInteractionHandler(base.ShellUI)); }; invisibleForm.ShowDialog(this); bool flag = !invisibleForm.ShowErrors(Strings.PropertyPageWriteError, Strings.PropertyPageWriteWarning, base.DataHandler.WorkUnits, base.ShellUI); result = flag; } return(result); }
internal void OnSetActive(bool focusOnFirstChild) { this.suppressIsDirtyChanges = true; try { this.isActivePage = true; this.InputValidationProvider.SuspendRecordingModifiedBindingMembers = true; if (base.IsHandleCreated) { if (this.Context != null && !this.InDesignMode) { using (InvisibleForm invisibleForm = new InvisibleForm()) { invisibleForm.BackgroundWorker.DoWork += delegate(object sender, DoWorkEventArgs e) { e.Result = this.Context.ReadData(new WinFormsCommandInteractionHandler(base.ShellUI), base.Name); }; invisibleForm.ShowDialog(this); if (base.IsDisposed) { return; } bool flag = invisibleForm.ShowErrors(Strings.PropertyPageReadError, Strings.PropertyPageReadWarning, new WorkUnitCollection(), base.ShellUI); if (invisibleForm.AsyncResults != null) { base.BindingSource.DataSource = invisibleForm.AsyncResults; if (!this.CheckReadOnlyAndDisablePage()) { this.VerifyCorruptedObject(); } } else { this.DisableRelatedPages(true); } if (flag) { this.OnReadDataFailed(EventArgs.Empty); } } } this.OnSetActive(EventArgs.Empty); this.EnableBulkEditingOnDemand(); EventHandler setActived = this.SetActived; if (setActived != null) { setActived(this, EventArgs.Empty); } } } finally { this.InputValidationProvider.SuspendRecordingModifiedBindingMembers = false; this.suppressIsDirtyChanges = false; if (focusOnFirstChild) { base.Focus(); base.SelectNextControl(this, true, true, true, false); } } }