コード例 #1
0
        /// <summary>
        /// Shows the menu for storing screen shots of the current rendered matrix.
        /// </summary>
        /// <param name="strip">The strip.</param>
        /// <returns><c>true</c> if the screen shot menu could be added.</returns>
        public bool ShowScreenshotMenu(MenuStrip strip = null)
        {
            try
            {
                if (strip == null)
                {
                    strip = this.menuStripMain;
                }
                if (strip != null)
                {
                    if (strip.InvokeRequired)
                    {
                        strip.Invoke(new Action(() => { strip.Items.Add(screenShotMenuEntry); }));
                    }
                    else
                    {
                        strip.Items.Add(screenShotMenuEntry);
                    }
                    int i = 0;
                    while (!ShowMenuStrip() && i++ < 10)
                    {
                        Thread.Sleep(100);
                    }
                }

                return(true);
            }
            catch (Exception)
            {
            }

            return(false);
        }
コード例 #2
0
ファイル: FixPlugin.cs プロジェクト: 15831944/tool
 private void AddTreeControl()
 {
     if (_mainTool.InvokeRequired)
     {
         var s = new Simple(AddTreeControl);
         _mainTool.Invoke(s, null);
     }
     else
     {
         _tvFix.Dock        = DockStyle.Fill;
         _tvFix.CheckBoxes  = true;
         _tvFix.AllowDrop   = true;
         _tvFix.DragEnter  += new DragEventHandler(_tvFix_DragEnter);
         _tvFix.DragDrop   += new DragEventHandler(_tvFix_DragDrop);
         _tvFix.AfterCheck += TvDbAfterCheck;
         _tvFix.MouseClick += TvDbMouseClick;
         _explorer.Controls.Add(_tvFix);
     }
 }
コード例 #3
0
 private void AddStatus()
 {
     if (_mainTool.InvokeRequired)
     {
         var s = new Simple(AddStatus);
         _mainTool.Invoke(s, null);
     }
     else
     {
         _tspbLoadDbProgress = getObject(43, "tspbLoadDbProgress") as ToolStripProgressBar;
         _tsslMessage        = getObject(43, "tsslMessage") as ToolStripStatusLabel;
         registerObject(PluginShareHelper.TsslMessage, _tsslMessage);
         registerObject(PluginShareHelper.TspbLoadDBProgress, _tspbLoadDbProgress);
     }
 }
コード例 #4
0
ファイル: VBScriptPlugin.cs プロジェクト: wethecom/IceChat
        public override void LoadEditorForm(TabControl ScriptsTab, MenuStrip mainMenu)
        {
            ScriptsTab.TabPages.Add(AddEditorTab());
            this.editorText.KeyPress += new KeyPressEventHandler(editorText_KeyPress);

            mainMenu.Invoke((MethodInvoker) delegate()
            {
                scriptMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
                    loadScript, unloadScript, newScript, saveScript
                });


                int i = 1;

                foreach (String file in icechatVBScripts.listScripts)
                {
                    if (File.Exists(this.CurrentFolder + Path.DirectorySeparatorChar + "Scripts" + Path.DirectorySeparatorChar + file))
                    {
                        System.Diagnostics.Debug.WriteLine("loading script file into editor and add to menu: " + file);

                        ToolStripMenuItem s = new ToolStripMenuItem(file);
                        s.Name   = file;
                        s.Click += new EventHandler(loadedScript_Click);
                        s.Tag    = "saved";

                        //load the first one in the editor
                        if (i == 1)
                        {
                            s.Checked = true;

                            StreamReader sr = new StreamReader(this.CurrentFolder + Path.DirectorySeparatorChar + "Scripts" + Path.DirectorySeparatorChar + file);
                            editorText.Text = sr.ReadToEnd();
                            sr.Close();
                        }

                        loadedScripts.DropDownItems.AddRange(new ToolStripItem[] {
                            s
                        });

                        i++;
                    }
                }

                mainMenu.Items.Add(scriptMenu);
                mainMenu.Items.Add(loadedScripts);

                //System.Diagnostics.Debug.WriteLine("script items:" + loadedScripts.DropDownItems.Count);
            });
        }
コード例 #5
0
ファイル: MetaDesingerPlugin.cs プロジェクト: 15831944/tool
 private void AddTool()
 {
     if (_mainTool.InvokeRequired)
     {
         var s = new Action(AddTool);
         _mainTool.Invoke(s, null);
     }
     else
     {
         _tsbDesinger.Text         = PluginName;
         _tsbDesinger.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
         _tsbDesinger.Click       += new EventHandler(_tsbDesinger_Click);
         Application.MainTool.Items.Add(_tsbDesinger);
     }
 }
コード例 #6
0
ファイル: PluginManager.cs プロジェクト: xubingyue/ClEngine
        private static void PluginCommand(Action action, PluginContainer container, string message)
        {
            if (HandleExceptions)
            {
                if (mMenuStrip.IsDisposed)
                {
                    try
                    {
                        action();
                    }
                    catch (Exception e)
                    {
                        var version = container.Plugin.Version;

                        message = $"{container.Name} Version {version} {message}";

                        container.Fail(e, message);

                        ReceiveError(message + "\n" + e.ToString());
                    }
                }
                else
                {
                    // Do this on a UI thread
                    mMenuStrip.Invoke((MethodInvoker) delegate
                    {
                        try
                        {
                            action();
                        }
                        catch (Exception e)
                        {
                            var version = container.Plugin.Version;

                            message = $"{container.Name} Version {version} {message}";

                            container.Fail(e, message);

                            ReceiveError(message + "\n" + e.ToString());
                        }
                    });
                }
            }
            else
            {
                action();
            }
        }
コード例 #7
0
ファイル: Menu.cs プロジェクト: schifflee/bjd5
        //メニュー構築(内部テーブルの初期化) リモート用

        //Java fix パラメータisJpを追加
        //メニュー構築(内部テーブルの初期化) 通常用
        public void Initialize(bool isJp)
        {
            _isJp = isJp;

            if (_menuStrip == null)
            {
                return;
            }

            if (_menuStrip.InvokeRequired)
            {
                _menuStrip.Invoke(new MethodInvoker(() => Initialize(isJp)));
            }
            else
            {
                //全削除
                _menuStrip.Items.Clear();
                _ar.Clear();

                //「ファイル」メニュー
                var m = AddSubMenu(_menuStrip.Items, new OneMenu("File", "ファイル", "File", 'F', Keys.None));
                AddListMenu(m, FileMenu());


                //「オプション」メニュー
                m = AddSubMenu(_menuStrip.Items, new OneMenu("Option", "オプション", "Option", 'O', Keys.None));
                AddListMenu(m, _kernel.ListOption.GetListMenu());

                //「ツール」メニュー
                m = AddSubMenu(_menuStrip.Items, new OneMenu("Tool", "ツール", "Tool", 'T', Keys.None));
                AddListMenu(m, _kernel.ListTool.GetListMenu());
                //
                //「起動/停止」メニュー
                m = AddSubMenu(_menuStrip.Items, new OneMenu("StartStop", "起動/停止", "Start/Stop", 'S', Keys.None));
                AddListMenu(m, StartStopMenu());

                //「ヘルプ」メニュー
                m = AddSubMenu(_menuStrip.Items, new OneMenu("Help", "ヘルプ", "Help", 'H', Keys.None));
                AddListMenu(m, HelpMenu());

                //Java fix
                SetEnable();//状況に応じた有効無効
                // menuBar.updateUI(); //メニューバーの再描画
            }
        }
コード例 #8
0
        private void AddTool()
        {
            if (_mainTool.InvokeRequired)
            {
                var s = new Simple(AddTool);
                _mainTool.Invoke(s, null);
            }
            else
            {
                _tsmiSystem.Text                    = "系统(&S)";
                _tsmiDbSet.Text                     = _tsbDbSet.Text = "数据库配置";
                _tsmiDbConfig.DisplayStyle          = _tsbDbSet.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
                _tsbDbSet.Click                    += tsbDBSet_Click;
                _tsmiDbSet.Click                   += tsbDBSet_Click;
                _tsmiDbSet.Image                    = _tsbDbSet.Image = Resources.dbConfig;
                _tscbDbConfig.DropDownStyle         = ComboBoxStyle.DropDownList;
                _tscbDbConfig.DisplayStyle          = ToolStripItemDisplayStyle.ImageAndText;
                _tscbDbConfig.SelectedIndexChanged += TscbDbConfigSelectedIndexChanged;

                _tsmiDbConfig.Text         = _tsbDbReSet.Text = "重新加载数据库";
                _tsmiDbConfig.DisplayStyle = _tsbDbReSet.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
                _tsbDbReSet.Click         += TsbDbReSetClick;
                _tsmiDbConfig.Click       += TsbDbReSetClick;
                _tsmiDbConfig.Image        = _tsbDbReSet.Image = Resources.reload;
                _tsmiExit.Text             = "退出(&X)";
                _tsmiExit.DisplayStyle     = ToolStripItemDisplayStyle.ImageAndText;
                _tsmiExit.Image            = Resources.exit;
                _tsmiExit.Click           += new EventHandler(_tsmiExit_Click);
                _tsmiSystem.DropDownItems.Add(_tsmiDbSet);
                _tsmiSystem.DropDownItems.Add(_tsmiDbConfig);
                _tsmiSystem.DropDownItems.Add(_tsmiSeparator);
                _tsmiSystem.DropDownItems.Add(_tsmiExit);
                Application.MainMenu.Items.Insert(0, _tsmiSystem);

                Application.MainTool.Items.Insert(0, _tsbDbSet);
                Application.MainTool.Items.Insert(1, _tscbDbConfig);
                Application.MainTool.Items.Insert(2, _tsbDbReSet);
                Application.MainTool.Items.Insert(3, _toolStripSeparator);
            }
        }