public PanelLeft(Form ParentArg) { Parent = ParentArg; This = this; Size = new Size(FileRegistry.GetLeftPanelWidth(), 0); Dock = DockStyle.Left; new FileTree(this); }
/* The FullPath property gives us something like * * C:\\Model Library\Windkessel.DES * * when the Windkessel model was the last file * selected. Note the double backslash after the * drive. We do a Replace (Old, New) to get rid * of \\ before splitting. */ private void Restore() { if (!GeneralRegistry.GetRestoreFileTree()) { return; } if (!FileRegistry.HasFileTreePath()) { return; } TreeNode CurrentNode = null; String Path = FileRegistry.GetFileTreePath(); Path = Path.Replace("\\\\", "\\"); String [] Tokens = Path.Split(new char [] { '\\' }); try { foreach (TreeNode Node in Nodes) { if (Node.Text == Tokens [0] + "\\") { CurrentNode = Node; MakeNodes(CurrentNode); CurrentNode.Expand(); } } for (int i = 1; i <= Tokens.Length - 2; i++) { ArrayList List = new ArrayList(CurrentNode.Nodes); foreach (TreeNode Node in List) { if (Node.Text == Tokens [i]) { CurrentNode = Node; MakeNodes(CurrentNode); CurrentNode.Expand(); } } } } catch { MsgBox.Show("Can't restore this path : " + Path); } }
/* FullPath works if the CurrentPick is a * selection, but it throws when current * pick is a folder. Catch. */ public void Save() { if (GeneralRegistry.GetRestoreFileTree()) { if (CurrentPick != null) { try { String Path = CurrentPick.FullPath; FileRegistry.SetFileTreePath(Path); } catch {} } } }
public static void Closing() { int Width = This.Width; FileRegistry.SetLeftPanelWidth(Width); }