public void OnToolStripEditComponentCode(object sender, EventArgs e) { try { if (!(treeView.SelectedNode.Tag is NodeTag nodeTag)) { return; } PPDataContext db = new PPDataContext(); Pic.DAL.SQLite.TreeNode treeNode = Pic.DAL.SQLite.TreeNode.GetById(db, nodeTag.TreeNode); if (null == treeNode) { return; } Document doc = treeNode.Documents(db)[0]; if (null == doc) { return; } Pic.DAL.SQLite.Component comp = doc.Components[0]; if (null == comp) { return; } // output Guid / path Guid outputGuid = Guid.NewGuid(); string outputPath = Pic.DAL.SQLite.File.GuidToPath(db, outputGuid, "dll"); // form plugin editor FormPluginEditor editorForm = new FormPluginEditor(); editorForm.PluginPath = doc.File.Path(db); editorForm.OutputPath = outputPath; if (DialogResult.OK == editorForm.ShowDialog()) { _log.Info("Component successfully modified!"); doc.File.Guid = outputGuid; db.SubmitChanges(); // clear component cache in plugin viewer ComponentLoader.ClearCache(); // update pluginviewer pluginViewCtrl.PluginPath = outputPath; } } catch (Exception ex) { _log.Error(ex.ToString()); } }
public void onToolStripEditComponentCode(object sender, EventArgs e) { try { NodeTag tag = treeView.SelectedNode.Tag as NodeTag; if (null == tag) { return; // no valid tag } if (null == tag.Document) { return; // not a document } string fileExt = tag.Document.File.Extension.ToLower(); if (!string.Equals(fileExt, "dll")) { return; // not a component } string filePath = treeDiM.FileTransfer.FileTransferUtility.DownloadFile(tag.Document.File.Guid, fileExt); // get client PLMPackServiceClient client = WCFClientSingleton.Instance.Client; // output Guid / path Guid outputGuid = Guid.NewGuid(); string outputPath = treeDiM.FileTransfer.FileTransferUtility.BuildPath(outputGuid, fileExt); // form plugin editor FormPluginEditor editorForm = new FormPluginEditor(); editorForm.PluginPath = filePath; editorForm.OutputPath = outputPath; if (DialogResult.OK == editorForm.ShowDialog()) { _log.Info("Component successfully modified!"); // clear component cache in plugin viewer ComponentLoader.ClearCache(); // update pluginviewer pluginViewCtrl.PluginPath = outputPath; } } catch (Exception ex) { _log.Error(ex.ToString()); } }
public void OnToolStripEditParameters(object sender, EventArgs e) { try { FormEditDefaultParamValues form = new FormEditDefaultParamValues( pluginViewCtrl.Dependancies); if (DialogResult.OK == form.ShowDialog()) { // also see on Ok button handler // clear plugin loader cache ComponentLoader.ClearCache(); if (pluginViewCtrl.Visible) { pluginViewCtrl.Refresh(); } } } catch (Exception ex) { _log.Error(ex.ToString()); } }