public PluginControl AddControl(Control c, string heading)
        {
            PluginControl control = this.Form.AddControl(c, heading);

            this._queryControl.OnPluginAdded(control);
            return(control);
        }
        public void Reset(bool delayClose)
        {
            Action close;

            this.Stop();
            PluginForm form = this.Form;

            if (form != null)
            {
                this.Form           = null;
                this._activeControl = null;
                close = delegate {
                    try
                    {
                        form.InvokeCloseWithShutdown();
                    }
                    catch
                    {
                    }
                };
                if (delayClose)
                {
                    ThreadPool.QueueUserWorkItem(delegate(object _) {
                        Thread.Sleep(0x3e8);
                        close();
                    });
                }
                else
                {
                    close();
                }
            }
        }
示例#3
0
        internal void InvokeShow(PluginControl plugin, IntPtr parentHandle, IntPtr mainFormHandle, bool focus, bool clickTransparencySupported)
        {
            this._clickTransparencySupported = clickTransparencySupported && !LocalUserOptions.Instance.PluginsOnTop;
            Action a = delegate {
                if (!this.Visible)
                {
                    this.ShowNoActivate();
                }
                this._shouldBeVisible = true;
                this.SetZOrder(parentHandle, mainFormHandle);
                Control[] controlArray = (from c in this.Controls.Cast <Control>()
                                          where (c != plugin.Control) && c.Visible
                                          select c).ToArray <Control>();
                plugin.Control.Visible = true;
                foreach (Control control in controlArray)
                {
                    control.Hide();
                }
                if (focus)
                {
                    this.Activate();
                    plugin.Control.Focus();
                }
            };

            if (this._shown)
            {
                this.BeginInvoke(a);
            }
            else
            {
                Server.CurrentServer.RunOnMessageLoopThread(a);
            }
        }
 public void DisposeControl(PluginControl c)
 {
     PluginForm form = this.Form;
     if (form != null)
     {
         form.InvokeDisposeControl(c);
     }
 }
        public void DisposeControl(PluginControl c)
        {
            PluginForm form = this.Form;

            if (form != null)
            {
                form.InvokeDisposeControl(c);
            }
        }
示例#6
0
 protected override void OnControlRemoved(ControlEventArgs e)
 {
     if (this._controls.Contains(e.Control))
     {
         PluginControl item = this._controls[e.Control];
         this._controls.Remove(item);
         this._manager.OnPluginRemoved(item);
     }
     base.OnControlRemoved(e);
 }
        internal void Hide()
        {
            PluginForm form = this.Form;

            if (form != null)
            {
                this.Stop();
                this._activeControl = null;
                form.InvokeHide();
            }
        }
 internal void OnInfoMessageChanged(PluginControl pic, string value)
 {
     try
     {
         if ((this._queryControl != null) && !this._queryControl.IsDisposed)
         {
             this._queryControl.OnInfoMessageChanged(pic, value);
         }
     }
     catch
     {
     }
 }
示例#9
0
        public PluginControl AddControl(Control c, string heading)
        {
            PluginControl item = new PluginControl(c, heading);

            this._controls.Add(item);
            c.Dock    = DockStyle.Fill;
            c.Visible = false;
            if (base.InvokeRequired)
            {
                this.BeginInvoke(delegate {
                    this.Controls.Add(c);
                });
                return(item);
            }
            base.Controls.Add(c);
            return(item);
        }
        internal void Show(PluginControl control, bool focus)
        {
            bool clickTransparencySupported = (Program.TransparencyKey.R == Program.TransparencyKey.G) && (Program.TransparencyKey.R == Program.TransparencyKey.B);

            if ((Environment.OSVersion.Version.Major == 5) && (Screen.PrimaryScreen.BitsPerPixel == 0x20))
            {
                clickTransparencySupported = false;
            }
            this.RequestRelocation(this.Form);
            PluginForm form = this.Form;

            if (form != null)
            {
                this._activeControl = control;
                this.Start();
                form.InvokeShow(this._activeControl, this.ApplicationFormHandle, MainForm.Instance.HandleThreadsafe, focus, clickTransparencySupported);
            }
        }
示例#11
0
        public static PluginControl AddControl(Control c, string heading)
        {
            Server currentServer = Server.CurrentServer;

            if (currentServer == null)
            {
                return(null);
            }
            PluginWindowManager pluginWindowManager = currentServer.PluginWindowManager;

            if (pluginWindowManager == null)
            {
                return(null);
            }
            bool flag = false;

            if (pluginWindowManager.Form == null)
            {
                flag = true;
                pluginWindowManager.Form = new PluginForm(pluginWindowManager);
            }
            if (string.IsNullOrEmpty(heading))
            {
                heading = "Custom" + ((CustomCount == 1) ? "" : (" " + CustomCount));
                if (CustomCount == 1)
                {
                    heading = "&" + heading;
                }
                CustomCount++;
            }
            PluginControl plugin = pluginWindowManager.Form.AddControl(c, heading);

            if (flag)
            {
                currentServer.NotifyPluginFormCreated(pluginWindowManager.Form);
            }
            pluginWindowManager.PluginJustAdded(plugin);
            return(plugin);
        }
 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();
         }
     }
 }
 internal void RequestShow(PluginControl control)
 {
     this._queryControl.RequestPlugInShow(control);
 }
 internal void Show(PluginControl control, bool focus)
 {
     bool clickTransparencySupported = (Program.TransparencyKey.R == Program.TransparencyKey.G) && (Program.TransparencyKey.R == Program.TransparencyKey.B);
     if ((Environment.OSVersion.Version.Major == 5) && (Screen.PrimaryScreen.BitsPerPixel == 0x20))
     {
         clickTransparencySupported = false;
     }
     this.RequestRelocation(this.Form);
     PluginForm form = this.Form;
     if (form != null)
     {
         this._activeControl = control;
         this.Start();
         form.InvokeShow(this._activeControl, this.ApplicationFormHandle, MainForm.Instance.HandleThreadsafe, focus, clickTransparencySupported);
     }
 }
 public void Reset(bool delayClose)
 {
     Action close;
     this.Stop();
     PluginForm form = this.Form;
     if (form != null)
     {
         this.Form = null;
         this._activeControl = null;
         close = delegate {
             try
             {
                 form.InvokeCloseWithShutdown();
             }
             catch
             {
             }
         };
         if (delayClose)
         {
             ThreadPool.QueueUserWorkItem(delegate (object _) {
                 Thread.Sleep(0x3e8);
                 close();
             });
         }
         else
         {
             close();
         }
     }
 }
 internal void RequestShow(PluginControl control)
 {
     this._queryControl.RequestPlugInShow(control);
 }
 internal void PluginJustAdded(PluginControl plugin)
 {
     this._queryControl.OnPluginAdded(plugin);
 }
示例#18
0
 internal OutputPanel(PluginControl c)
 {
     this._pic = c;
 }
示例#19
0
 internal void OnInfoMessageChanged(PluginControl pic, string value)
 {
     this._manager.OnInfoMessageChanged(pic, value);
 }
 internal void PluginJustAdded(PluginControl plugin)
 {
     this._queryControl.OnPluginAdded(plugin);
 }
 internal void Hide()
 {
     PluginForm form = this.Form;
     if (form != null)
     {
         this.Stop();
         this._activeControl = null;
         form.InvokeHide();
     }
 }
示例#22
0
 internal void RequestPlugInShow(PluginControl c)
 {
     Action a = delegate {
         if ((!this.IsDisposed && (MainForm.Instance != null)) && (MainForm.Instance.CurrentQueryControl == this))
         {
             ToolStripButton selectedButton = this._pluginWinButtons.FirstOrDefault<ToolStripButton>(b => b.Tag == c);
             if (selectedButton != null)
             {
                 this.SelectOutputPanel(selectedButton, false);
             }
         }
     };
     if (base.InvokeRequired)
     {
         this.BeginInvoke(a);
     }
     else
     {
         a();
     }
 }
示例#23
0
 internal void OnPluginRemoved(PluginControl plugin)
 {
     this.RemovePluginWinButton(plugin);
 }
示例#24
0
 internal void OnPluginAdded(PluginControl c)
 {
     if (this._gotPluginsReadyMessage || this._query.MessageLoopStartedWithoutForm)
     {
         this.CreatePluginWinButton(c, true, true);
         this.UpdateOutputToolStripLayout();
     }
 }
示例#25
0
 internal void OnInfoMessageChanged(PluginControl pic, string value)
 {
     if (this.GetSelectedPluginControl() == pic)
     {
         this.lblMiscStatus.Text = value;
     }
 }
示例#26
0
 private void CreatePluginWinButton(PluginControl c, bool activate, bool afterCurrent)
 {
     Action a = delegate {
         if (!this._pluginWinButtons.Any<ToolStripButton>(b => (b.Tag == c)))
         {
             bool flag = !MainForm.Instance.IsActive && !MainForm.Instance.ResultsDockForm.IsActive;
             ToolStripButton button = new ToolStripButton(c.Heading) {
                 DisplayStyle = ToolStripItemDisplayStyle.Text,
                 Margin = new Padding(0, 0, 0, 1),
                 Tag = c,
                 ToolTipText = c.ToolTipText
             };
             button.Click += delegate (object sender, EventArgs e) {
                 if (Control.ModifierKeys == Keys.Control)
                 {
                     this.CloseVisualizer(c);
                 }
                 else
                 {
                     this.SelectOutputPanel(button, true);
                 }
             };
             button.MouseEnter += delegate (object sender, EventArgs e) {
                 this.tsOutput.Cursor = Cursors.Default;
                 try
                 {
                     button.ToolTipText = c.ToolTipText;
                     bool isActive = MainForm.Instance.IsActive;
                     if (!(string.IsNullOrEmpty(button.ToolTipText) || isActive))
                     {
                         this._pluginWinManager.ShowToolTip(button.ToolTipText);
                     }
                 }
                 catch
                 {
                 }
             };
             button.MouseLeave += delegate (object sender, EventArgs e) {
                 if (!(string.IsNullOrEmpty(c.ToolTipText) || MainForm.Instance.IsActive))
                 {
                     this._pluginWinManager.ShowToolTip(null);
                 }
             };
             button.MouseDown += delegate (object sender, MouseEventArgs e) {
                 if (e.Button == MouseButtons.Middle)
                 {
                     this.CloseVisualizer(c);
                 }
                 else if (e.Button == MouseButtons.Right)
                 {
                     this.SelectOutputPanel(button, false);
                     Point p = this.tsOutput.PointToScreen(e.Location);
                     p.Offset(button.Bounds.Location);
                     Program.RunOnWinFormsTimer(delegate {
                         this.FocusQueryExplicit();
                         this._pluginWinButtonMenu.Show(p);
                     }, 50);
                 }
             };
             if ((afterCurrent && this.IsPluginSelected()) && flag)
             {
                 int index = this._pluginWinButtons.IndexOf(this.GetSelectedPanelButton());
                 this._pluginWinButtons.Insert(index + 1, button);
                 this.tsOutput.Items.Insert(index + 3, button);
             }
             else
             {
                 this._pluginWinButtons.Add(button);
                 this.tsOutput.Items.Insert(this.tsOutput.Items.IndexOf(this.btnLambda), button);
             }
             if (activate)
             {
                 this.SelectOutputPanel(button, false);
             }
         }
     };
     if (base.InvokeRequired)
     {
         this.BeginInvoke(a);
     }
     else
     {
         a();
     }
 }
示例#27
0
 internal void CloseVisualizer(PluginControl c)
 {
     if (c != null)
     {
         ToolStripButton button = (this.GetSelectedPluginControl() == c) ? this._pluginWinButtons.FirstOrDefault<ToolStripButton>(b => (b.Tag == c)) : null;
         int num = (button == null) ? -1 : this.tsOutput.Items.IndexOf(button);
         ToolStripButton selectedButton = (num < 1) ? null : (this.tsOutput.Items[num - 1] as ToolStripButton);
         try
         {
             this._pluginWinManager.DisposeControl(c);
             if (selectedButton != null)
             {
                 this.SelectOutputPanel(selectedButton, false);
             }
         }
         catch
         {
         }
     }
 }
示例#28
0
 internal void InvokeDisposeControl(PluginControl c)
 {
     this.BeginInvoke(() => c.Control.Dispose());
 }
 internal void OnInfoMessageChanged(PluginControl pic, string value)
 {
     try
     {
         if ((this._queryControl != null) && !this._queryControl.IsDisposed)
         {
             this._queryControl.OnInfoMessageChanged(pic, value);
         }
     }
     catch
     {
     }
 }
 internal void OnPluginRemoved(PluginControl pic)
 {
     this._queryControl.OnPluginRemoved(pic);
 }
 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();
         }
     }
 }
示例#32
0
 private void RemovePluginWinButton(PluginControl pluginControl)
 {
     Action a = delegate {
         ToolStripButton button = this._pluginWinButtons.FirstOrDefault<ToolStripButton>(b => b.Tag == pluginControl);
         if (button != null)
         {
             bool flag = button.Checked;
             this.tsOutput.Items.Remove(button);
             this._pluginWinButtons.Remove(button);
             if (flag)
             {
                 this.SelectResultsPanel(false);
             }
         }
     };
     if (base.InvokeRequired)
     {
         this.BeginInvoke(a);
     }
     else
     {
         a();
     }
 }
 internal void OnPluginRemoved(PluginControl pic)
 {
     this._queryControl.OnPluginRemoved(pic);
 }