Exemple #1
0
        private void treeView_Tools_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            this.CurrentToolName = e.Node.Text;
            this.tabControl1.SelectedTab.Text = CurrentToolName;
            var viewPath = ToolMapping.GetViewPath(this.CurrentToolName);

            if (!(this.tabControl1.SelectedTab.Controls[0] is WebBrowser activeWebBrowser))
            {
                return;
            }
            activeWebBrowser.Url = new Uri(viewPath.ViewPath);
        }
Exemple #2
0
        public void AppendTabPageForTool(string currentToolName)
        {
            var viewPath   = ToolMapping.GetViewPath(currentToolName);
            var webBrowser = new WebBrowser
            {
                ObjectForScripting = this,
                Dock = DockStyle.Fill,
                Url  = new Uri(viewPath.ViewPath)
            };

            var tabPage = new TabPage(CurrentToolName);

            tabPage.Controls.Add(webBrowser);

            this.tabControl1.TabPages.Add(tabPage);
            this.tabControl1.SelectTab(tabPage);
        }
Exemple #3
0
        public void HandlerProcess(string handlerArgsStr, WebBrowser currentWebBrowser)
        {
            try
            {
                var requestMethodArgs = JsonConvert.DeserializeObject <RequestMethodArgs>(handlerArgsStr);

                var t       = Type.GetType(ToolMapping.GetViewPath(this.CurrentToolName).HandlerFullName);
                var handler =
                    Activator.CreateInstance(t ?? throw new InvalidOperationException($"未找到{CurrentToolName}Handler."),
                                             currentWebBrowser);
                t.GetMethod(requestMethodArgs.MethodName)?.Invoke(handler, new[] { requestMethodArgs.ArgsJsonStr });
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }