Ejemplo n.º 1
0
 public static void InvokeAsync(MethodInvoker callback, IWin32Window owner)
 {
     using (InvisibleForm invisibleForm = new InvisibleForm())
     {
         invisibleForm.BackgroundWorker.DoWork += delegate(object sender, DoWorkEventArgs e2)
         {
             callback();
         };
         invisibleForm.ShowDialog(owner);
     }
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 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);
         }
     }
 }