示例#1
0
 private void OnIdle(object sender, EventArgs e)
 {
     Application.Idle -= new EventHandler(this.OnIdle);
     if (this._state[StateReloadAtIdle])
     {
         this._state[StateReloadAtIdle] = false;
         DesignSurfaceManager service = (DesignSurfaceManager)this.GetService(typeof(DesignSurfaceManager));
         DesignSurface        objB    = (DesignSurface)this.GetService(typeof(DesignSurface));
         if (((service != null) && (objB != null)) && !object.ReferenceEquals(service.ActiveDesignSurface, objB))
         {
             this._state[StateActiveDocument] = false;
             this._state[StateDeferredReload] = true;
         }
         else
         {
             IDesignerLoaderHost loaderHost = this.LoaderHost;
             if ((loaderHost != null) && (this._state[StateForceReload] || this.IsReloadNeeded()))
             {
                 try
                 {
                     if (this._state[StateFlushReload])
                     {
                         this.Flush();
                     }
                     this.UnloadDocument();
                     loaderHost.Reload();
                 }
                 finally
                 {
                     this._state[(StateForceReload | StateModifyIfErrors) | StateFlushReload] = false;
                 }
             }
         }
     }
 }
        private void ReloadCore()
        {
            bool flush = !((_reloadOptions & ReloadOptions.NoFlush) == ReloadOptions.NoFlush);

            if (flush)
            {
                Flush();
            }
            Unload();
            _host.Reload();
            BeginLoad(_host); // calls EndLoad, which will check for ReloadOptions.ModifyOnError
            _reloadScheduled = false;
        }