Beispiel #1
0
        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());
            }
        }
Beispiel #2
0
        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());
            }
        }