//At this point, the projectPath MUST HAVE BEEN INITIATED //Add/Remove a file in ChoosenDwgFiles; //Function GetData() should be called after this. public static void CheckedTreeNode(TreeNode tn, string currentNotePath) { if (string.IsNullOrEmpty(ProjectFolder)) { return; } string relativeDwgPath = GetTreeNotePath(tn); if (GoodiesPath.IsDwgPath(relativeDwgPath)) { DwgFileModel fe = new DwgFileModel(); //fe.modifieddate = GoodiesPath.GetModifiedOfFile(ProjectFolder + relativeDwgPath).Ticks; // this is to make sure later file is going to be updated. fe.modifieddate = 0; fe.isP_Notes = 0; fe.relativePath = relativeDwgPath; //string fullDwgPath = Root + relativeDwgPath; if (tn.Checked) { PlumbingDatabaseManager.projectElement.Dwgs.Add(fe); } else { PlumbingDatabaseManager.projectElement.Dwgs.Remove(fe); } } }
//Return: // 0 -- Abort/Cancel // 1 -- Retry // 2 -- Ignore private static int CheckNodePath(string nodePath) { if (!GoodiesPath.IsDwgPath(nodePath)) { string msg = string.Format("P_NOTES file ({0}) is not a .dwg file", nodePath); MessageBox.Show(msg, "Not a DWG file", MessageBoxButtons.OK); return(0); } else if (!GoodiesPath.IsNotePath(nodePath)) { string msg = string.Format("Note file {0} does not look like a P_NOTES file.", nodePath); DialogResult result = MessageBox.Show(msg, "Does not look like P_NOTES file", MessageBoxButtons.AbortRetryIgnore); if (result == DialogResult.Ignore) { return(2); } else if (result == DialogResult.Retry) { return(1); } else { return(0); } } return(2); }
private static void CheckNode(TreeNode tn) { if (GoodiesPath.IsDwgPath(tn.FullPath) && PlumbingDatabaseManager.projectElement.ContainsPath(tn.FullPath)) { tn.Checked = true; //This function start with parent folder of dwgs ExpandNode(tn.Parent); } else { if (tn.Nodes.Count >= 1) { foreach (TreeNode treeNode in tn.Nodes) { CheckNode(treeNode); } } } }