/// <summary> /// Called when [document removed]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="Delta.CertXplorer.Common.DocumentModel.DocumentEventArgs"/> instance containing the event data.</param> private void OnDocumentRemoved(object sender, DocumentEventArgs e) { if (documents.ContainsKey(e.Document)) { TreeNode tn = documents[e.Document]; documents.Remove(e.Document); filesRoot.Nodes.Remove(tn); } }
/// <summary> /// Called when [document added]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="Delta.CertXplorer.Common.DocumentModel.DocumentEventArgs"/> instance containing the event data.</param> private void OnDocumentAdded(object sender, DocumentEventArgs e) { if (!documents.ContainsKey(e.Document)) { var tnRoot = filesRoot; var caption = "Document"; if (e.Document is IDocument) caption = ((IDocument)e.Document).Caption; var tn = new TreeNodeEx(caption); if (e.Document.Source is FileDocumentSource) tnRoot = filesRoot; else if (e.Document.Source is X509DocumentSource) tnRoot = certificatesRoot; tn.Tag = e.Document; tn.ImageIndex = documentIndex; tn.SelectedImageIndex = documentIndex; documents.Add(e.Document, tn); tnRoot.Nodes.Add(tn); tnRoot.Expand(); } }
/// <summary> /// Called when [document selected]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="Delta.CertXplorer.Common.DocumentModel.DocumentEventArgs"/> instance containing the event data.</param> private void OnDocumentSelected(object sender, DocumentEventArgs e) { if (documents.ContainsKey(e.Document)) tvExplorer.SelectedNode = documents[e.Document]; }