private void bnEditProfiles_Click(object sender, EventArgs e) { // show form to edit profiles FormEditProfiles form = new FormEditProfiles(); form.ShowDialog(); // refill combo box has some profile might have been added FillProfileComboBox(_profile.Name); }
private void toolStripMenuItemNewDocument(object sender, EventArgs e) { try { // get data context Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext(); // get current branch node Pic.DAL.SQLite.TreeNode treeNode = Pic.DAL.SQLite.TreeNode.GetById(db, _treeNodeId); // force creation of a profile if no profile exist Pic.DAL.SQLite.CardboardProfile[] cardboardProfiles = Pic.DAL.SQLite.CardboardProfile.GetAll(db); if (cardboardProfiles.Length == 0) { FormEditProfiles dlgProfile = new FormEditProfiles(); dlgProfile.ShowDialog(); } cardboardProfiles = Pic.DAL.SQLite.CardboardProfile.GetAll(db); if (cardboardProfiles.Length == 0) { return; // no profile -> exit } // show document creation dialog FormCreateDocument dlg = new FormCreateDocument(); // initialize dialog dlg.TreeNode = new NodeTag(NodeTag.NodeType.NT_TREENODE, _treeNodeId); if (DialogResult.OK == dlg.ShowDialog()) { // redraw current branch ShowBranch(_treeNodeId); // get current document Id int documentId = dlg.DocumentID; // get TreeNode from documentID List <Pic.DAL.SQLite.TreeNode> listTreeNodeNew = Pic.DAL.SQLite.TreeNode.GetByDocumentId(db, dlg.DocumentID); if (listTreeNodeNew.Count == 0) { _log.Error(string.Format("Failed to retrieve treeNode from document ID : {0}", dlg.DocumentID)); return; // -> failed to retrieve node } if (null != TreeNodeCreated) { TreeNodeCreated(this, new NodeEventArgs(listTreeNodeNew[0].ID, NodeTag.NodeType.NT_TREENODE)); } } } catch (System.Exception ex) { _log.Error(ex.ToString()); } }
private void toolStripMenuItemNewDocument(object sender, EventArgs e) { try { // get data context Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext(); // get current branch node Pic.DAL.SQLite.TreeNode treeNode = Pic.DAL.SQLite.TreeNode.GetById(db, _treeNodeId); // force creation of a profile if no profile exist Pic.DAL.SQLite.CardboardProfile[] cardboardProfiles = Pic.DAL.SQLite.CardboardProfile.GetAll(db); if (cardboardProfiles.Length == 0) { FormEditProfiles dlgProfile = new FormEditProfiles(); dlgProfile.ShowDialog(); } cardboardProfiles = Pic.DAL.SQLite.CardboardProfile.GetAll(db); if (cardboardProfiles.Length == 0) return; // no profile -> exit // show document creation dialog FormCreateDocument dlg = new FormCreateDocument(); // initialize dialog dlg.TreeNode = new NodeTag(NodeTag.NodeType.NT_TREENODE, _treeNodeId); if (DialogResult.OK == dlg.ShowDialog()) { // redraw current branch ShowBranch(_treeNodeId); // get current document Id int documentId = dlg.DocumentID; // get TreeNode from documentID List<Pic.DAL.SQLite.TreeNode> listTreeNodeNew = Pic.DAL.SQLite.TreeNode.GetByDocumentId(db, dlg.DocumentID); if (listTreeNodeNew.Count == 0) { _log.Error(string.Format("Failed to retrieve treeNode from document ID : {0}", dlg.DocumentID)); return; // -> failed to retrieve node } if (null != TreeNodeCreated) TreeNodeCreated(this, new NodeEventArgs(listTreeNodeNew[0].ID, NodeTag.NodeType.NT_TREENODE)); } } catch (System.Exception ex) { _log.Error(ex.ToString()); } }
private void insertNewDocumentLabel_Click(object sender, EventArgs e) { try { Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext(); NodeTag tag = GetCurrentTag(); if (null == tag || tag.IsDocument) throw new Exception("Invalid TreeNode tag"); Pic.DAL.SQLite.TreeNode treeNode = Pic.DAL.SQLite.TreeNode.GetById(db, tag.TreeNode); // force creation of a profile if no profile exist Pic.DAL.SQLite.CardboardProfile[] cardboardProfiles = Pic.DAL.SQLite.CardboardProfile.GetAll(db); if (cardboardProfiles.Length == 0) { FormEditProfiles dlgProfile = new FormEditProfiles(); dlgProfile.ShowDialog(); } cardboardProfiles = Pic.DAL.SQLite.CardboardProfile.GetAll(db); if (cardboardProfiles.Length == 0) return; // show dialog FormCreateDocument dlg = new FormCreateDocument(); dlg.TreeNode = tag; if (DialogResult.OK == dlg.ShowDialog()) { // insert document in treeview List<Pic.DAL.SQLite.TreeNode> tnodes = Pic.DAL.SQLite.TreeNode.GetByDocumentId(db, dlg.DocumentID); // (re)populate parent node PopulateChildren(SelectedNode); if (dlg.OpenInsertedDocument) { // select current node NodeTag newDocTag = new NodeTag(NodeTag.NodeType.NT_DOCUMENT, tnodes[0].ID); SelectedNode = FindNode(null, newDocTag); // <- for some reasons, this does not work // however, we can force document opening with the following line SelectionChanged(this, new NodeEventArgs(newDocTag.TreeNode, newDocTag.Type), newDocTag.Name); } } } catch (System.Exception ex) { Debug.Fail(ex.ToString()); _log.Error(ex.ToString()); } }
private void toolStripMenuItemEditProfiles_Click(object sender, EventArgs e) { FormEditProfiles form = new FormEditProfiles(); form.ShowDialog(); }
private void OnEditProfiles(object sender, EventArgs e) { FormEditProfiles form = new FormEditProfiles(); form.ShowDialog(); }