Example #1
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);
            }
        }
        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);
            }
        }