Пример #1
0
        void Event_PluginViewInfo(object sender, EventArgs e)
        {
            PluginForm dlg = new PluginForm();

            dlg.PluginContext = PluginManager.ActivePlugin;
            dlg.ShowDialog(this);
        }
Пример #2
0
        public static void CreateWindow(Plugin pl)
        {
            pl.Checked = true;
            PluginForm f = new PluginForm(pl);

            if (!FormList.Contains(pl))
            {
                FormList.Add(pl, f);
                f.Show();
            }
        }
Пример #3
0
        private void OpenPlugins(object?sender, EventArgs e)
        {
            Debug.Assert(_application.Uploaders.Loaded);

            var pluginsModel = new PluginFormModel(
                _application.Uploaders.GetMetadata(),
                _application.Uploaders.Plugins.PluginDirectory
                );

            var form = new PluginForm(pluginsModel);

            form.Show();
        }
        /// <summary>
        /// Add a tabbed form to the tabbed window (if the plugin type is
        /// PLUGIN_TYPE.DOCKED_TAB
        /// or
        /// PLUGIN_TYPE.BOTH_DOCKED_AND_MENU
        /// </summary>
        /// <param name="pPPLMain"></param>
        public void AddForm(PPL_Lib.PPLMain pPPLMain)
        {
            cPPLMain = pPPLMain;
            cForm    = new PluginForm();
            Guid guid = new Guid(0x123eb510, 0xadcc, 0x4338, 0xa8, 0x12, 0x67, 0x6f, 0x32, 0xdb, 0x1e, 0x1e);



            cForm.cGuid = guid;
            cPPLMain.cDockedPanels.Add(cForm.cGuid.ToString(), cForm);
            foreach (Control ctrl in cPPLMain.Controls)
            {
                if (ctrl is WeifenLuo.WinFormsUI.Docking.DockPanel)
                {
                    cForm.Show(ctrl as WeifenLuo.WinFormsUI.Docking.DockPanel, WeifenLuo.WinFormsUI.Docking.DockState.Document);
                }
            }



            cForm.Show();
        }
Пример #5
0
 public void NotifyPluginFormCreated(PluginForm form)
 {
     lock (this._statusLocker)
     {
         if ((this._currentPluginForm == null) && this.InMessageLoop)
         {
             this._currentPluginForm = form;
         }
     }
 }
Пример #6
0
 public void EndMessageLoop()
 {
     if (this.InMessageLoop)
     {
         try
         {
             if (this._currentPluginForm != null)
             {
                 this._currentPluginForm.InvokeCloseWithShutdown();
                 if (this.MessageLoopStartedWithoutForm)
                 {
                     Application.Exit();
                 }
             }
             else
             {
                 if (IsWpfLoaded())
                 {
                     WpfBridge.ShutdownCurrentDispatcher();
                 }
                 Application.Exit();
             }
             this._currentPluginForm = null;
         }
         catch
         {
         }
     }
 }
Пример #7
0
 private void RunMessageLoop(PluginForm pluginForm, bool queryCompleteOnReady)
 {
     if (pluginForm != null)
     {
         ThreadPool.QueueUserWorkItem(delegate (object _) {
             try
             {
                 if (this._currentPluginForm.Ready.WaitOne(0x4e20, false))
                 {
                     if (this._client != null)
                     {
                         this._client.OnPluginsReady();
                     }
                     if (queryCompleteOnReady)
                     {
                         this.QueryCompletionCountdown.Decrement();
                     }
                 }
             }
             catch
             {
             }
         });
     }
     Application.ThreadException += new ThreadExceptionEventHandler(this.Application_ThreadException);
     Application.Idle += new EventHandler(this.Application_Idle);
     try
     {
         if (this.MessageLoopStartedWithoutForm)
         {
             Application.Run();
         }
         else
         {
             Application.Run(pluginForm);
         }
     }
     catch (ThreadAbortException)
     {
     }
     catch (Exception exception)
     {
         this.PostStatus(this.GetStatusArgs(exception, true, true));
         this._messageLoopFailed = true;
     }
     finally
     {
         this.InMessageLoop = false;
         this.MessageLoopEnded = true;
         this._currentPluginForm = null;
         Application.ThreadException -= new ThreadExceptionEventHandler(this.Application_ThreadException);
         Application.Idle -= new EventHandler(this.Application_Idle);
         if (!this._cancelRequest)
         {
             this.PerformFinalCleanup();
         }
     }
 }
Пример #8
0
 private PluginForm PrepareMessageLoop()
 {
     Action[] actionArray;
     this._uiThread = Thread.CurrentThread;
     if ((SynchronizationContext.Current == null) || (SynchronizationContext.Current.GetType() == typeof(SynchronizationContext)))
     {
         Util.CreateSynchronizationContext(false, false);
     }
     this.SyncContext = SynchronizationContext.Current;
     lock (this._messageLoopActions)
     {
         actionArray = this._messageLoopActions.ToArray();
     }
     foreach (Action action in actionArray)
     {
         action();
     }
     PluginForm form = (this.PluginWindowManager == null) ? null : this.PluginWindowManager.Form;
     lock (this._statusLocker)
     {
         this._currentPluginForm = form;
         this.MessageLoopStartedWithoutForm = form == null;
         this.InMessageLoop = true;
     }
     return form;
 }
 internal void RequestRelocation(PluginForm pluginForm)
 {
     this._queryControl.RequestWinManagerRelocation();
 }
 internal void OnPluginFormClosed(PluginForm pluginForm)
 {
     if ((this._queryControl != null) && !this._queryControl.IsDisposed)
     {
         Action method = delegate {
             if (pluginForm == this.Form)
             {
                 this.Stop();
                 this.Form = null;
                 this._activeControl = null;
                 this._queryControl.OnAllPluginsRemoved();
             }
         };
         if (this._queryControl.InvokeRequired)
         {
             this._queryControl.BeginInvoke(method);
         }
         else
         {
             method();
         }
     }
 }
Пример #11
0
 public static void ShowDialogForm(PluginForm currentForm, string destinationForm)
 {
     ShowDialogFormEventHandler?.Invoke(currentForm, destinationForm);
 }
Пример #12
0
 public static void ChangeForms(PluginForm currentForm, string destinationForm)
 {
     BeforeFormTransitionEventHandler?.Invoke(currentForm, ref destinationForm);
     ChangeFormsEventHandler?.Invoke(currentForm, destinationForm);
     AfterFormTransitionEventHandler?.Invoke(currentForm, ref destinationForm);
 }
Пример #13
0
 /// <summary>
 ///     Terminates this instance.
 /// </summary>
 /// <remarks></remarks>
 public void Terminate()
 {
     PluginForm.Close();
     Host.UnloadPlugin(Id);
     Host = null;
 }