protected virtual IDockContent NewToolAccrodingPersistString(string[] parsedStrings) { try { if (parsedStrings.Length < 1 || parsedStrings[0] == typeof(OutPutWindow).ToString()) { return(null); } string[] args = null; if (parsedStrings.Length > 1) { args = new string[parsedStrings.Length - 1]; for (int i = 1; i <= parsedStrings.Length - 1; i++) { args[i - 1] = parsedStrings[i]; } } string className = parsedStrings[0]; var query = addinConfig.Tools.First(row => row.ClassName == className); string dllName = query != null ? query.DllFileName : ""; JForm form = CreateJDockForm(className, dllName, args == null ? null : new object[] { args }); if (form is IDB) { form.ShowStatus = true; } return(form); } catch (Exception ex) { this.ShowMessage(ex); } return(null); }
protected virtual void OpenFileAccordingToFile(string fileName) { this.ShowMessage(fileName); string extension = Path.GetExtension(fileName); Tool targetTool = null; foreach (Tool tool in addinConfig.Tools) { if (string.IsNullOrEmpty(tool.Extensions)) { continue; } string[] allowExtensions = tool.Extensions.Split(','); if (allowExtensions.Contains(extension, StringComparer.Create(CultureInfo.CurrentCulture, true))) { targetTool = tool; break; } } if (targetTool != null) { JForm form = CreateJDockForm(targetTool.ClassName, targetTool.DllFileName, new object[] { new string[] { fileName } }); if (form is IDB) { form.ShowStatus = true; } form.Show(); } }
private void viewToolStripMenuItem_DropDownOpening(object sender, EventArgs e) { outputWindowToolStripMenuItem.Checked = this.OutPutWin.Visible; if (this.ActiveMdiChild != null) { JForm form = this.ActiveMdiChild as JForm; subFormStatusBarToolStripMenuItem.Checked = form.ShowStatus; } }
public ChooseBox(JForm jForm, bool isApi, Dictionary <string, string> dict, int width, int fontSize, bool type) { this.jForm = jForm; this.isApi = isApi; this.type = type; this.dict = dict; this.width = width; this.fontSize = fontSize; InitializeComponent(); if (dict.Count > 8) { scrollPanel1.ShowScrollBar = true; } }
protected JForm CreateJDockForm(string typeStr, string dllName, params object[] constructArgs) { Type type; if (!string.IsNullOrEmpty(dllName))//单独dll存放在插件文件夹 { Assembly assembly = Assemblies.ContainsKey(dllName) ? Assemblies[dllName] : null;; type = assembly.GetType(typeStr); } else { type = Assembly.GetEntryAssembly().GetType(typeStr); //dll为Exe所在程序集 if (type == null) { type = Assembly.GetExecutingAssembly().GetType(typeStr); //dll为当前程序集 } } if (type == null) { this.ShowMessage("工具{0}找不到入口函数", typeStr); return(null); } object obj = null; try { if (constructArgs == null || constructArgs.Length == 0) { obj = Activator.CreateInstance(type); } else { obj = Activator.CreateInstance(type, constructArgs); } } catch (Exception ex) { this.ShowMessage(ex); } JForm formToShow = (JForm)obj; formToShow.MdiParent = this; return(formToShow); }
private void ActiveContent(Justin.Core.MenuItem data, string fileName = "") { string classStr = data.Class; string[] classInfo = classStr.Trim().Split(','); if (classInfo.Length != 3) { this.ShowMessage("请检查Class设置"); return; } JForm form = CreateJDockForm(classInfo[0], classInfo[2], string.IsNullOrEmpty(fileName) ? null : new object[] { new string[] { fileName } }); if (form == null) { return; } if (form is IDB) { form.ShowStatus = true; } form.Show(dockPanel); }
private void subFormStatusBarToolStripMenuItem_Click(object sender, EventArgs e) { JForm form = this.ActiveMdiChild as JForm; form.ShowStatus = !form.ShowStatus; }