Exemplo n.º 1
0
 public string GetFilePathFromGuid(Guid guid)
 {
     using (Pic.Data.File file = ParametricComponent.getFileByComponentGuid(guid))
     {
         if (null != file && file.Valid)
         {
             return(file.FullPath);
         }
     }
     throw new PluginException(string.Format("Failed to load Component with Guid = {0}", guid.ToString()));
 }
Exemplo n.º 2
0
        private void  insertNewDocumentLabel_Click(object sender, EventArgs e)
        {
            try
            {
                // get current tree node
                TreeNode          tnNode      = GetCurrentTreeNode();
                DocTreeNodeBranch docTreeNode = tnNode.Tag as DocTreeNodeBranch;
                if (null == docTreeNode)
                {
                    return;
                }

                // show dialog
                FormCreateDocument dlg = new FormCreateDocument();
                if (DialogResult.OK == dlg.ShowDialog())
                {
                    // create new document
                    Document doc = ParametricComponent.create(
                        dlg.DocumentName
                        , dlg.DocumentDescription
                        , dlg.FilePath
                        , dlg.ComponentGuid);
                    // create associated majorations
                    MajorationList.create(doc, dlg.Profile, dlg.Majorations);

                    // add child document node
                    docTreeNode.AddChildDocument(doc);

                    // Refresh tree
                    RefreshTree();
                    SelectedNode = GetCurrentTreeNode();
                }
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.ToString());
                Logger.Write(ex.ToString(), Category.General, Priority.Highest);
            }
        }