// ------------------------------------------------ // Edit Document from Tree. Allow only Documents // ------------------------------------------------ private void EditDocument(object sender, EventArgs e) { if (!string.IsNullOrEmpty(defaultActionDoubleClick)) { if (defaultActionDoubleClick == "Select") { this.btnSelect_Click(sender, e); return; } } // // Get selected document from tree // TreeNode docSelected = tvFileList.SelectedNode; var rm = new Document(); if (docSelected == null) { return; } rm = (Document)docSelected.Tag; // Cast // Show Document Screen // UIDocumentEdit uide = new UIDocumentEdit(this, rm, docSelected); uide.ShowDialog(); docSelected.Text = rm.FileName; }
private void NewDocument_Click(object sender, EventArgs e) { // // Get selected document from tree // TreeNode docSelected = tvFileList.SelectedNode; if (docSelected == null) { return; } Document treeSelectedDoco = new Document(); treeSelectedDoco = (Document)docSelected.Tag; // Cast // If current tree selected item is a document // issue an error saying that only folder can hold // an item if (treeSelectedDoco.RecordType.Trim() != FCMConstant.RecordType.FOLDER) { MessageBox.Show("Only folders allow items inside."); return; } // New Document or Folder being added // var document = new Document(); // Set the parent uid as current tree selected // folder // document.ParentUID = treeSelectedDoco.UID; UIDocumentEdit uide = new UIDocumentEdit(this, document, docSelected); uide.ShowDialog(); if (uide.documentSavedSuccessfully) { int im = FCMConstant.Image.Document; if (document.RecordType == FCMConstant.RecordType.FOLDER) { im = FCMConstant.Image.Folder; } var treeNode = new TreeNode(document.Name, im, im); treeNode.Tag = document; treeNode.Name = document.UID.ToString(); docSelected.Nodes.Add(treeNode); } Refresh(); }