/// <summary> /// method for click button back /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click(object sender, RoutedEventArgs e) { try { Dirs buf = (Dirs)this.element; buf--; this.view[this.indexView](buf.GetActionNode, null); if (buf.GetIndex() == 0) { this.ItemComputer.IsSelected = true; this.Path.Text = "My Computer"; SelectedTreeView((TreeViewItem)this.TVRoot.SelectedItem); this.btnFront.IsEnabled = true; return; } this.Path.Text = buf.GetActionNode.FullName; this.btnFront.IsEnabled = true; } catch (Exception ex) { //this.ItemComputer.IsSelected = true; //this.Path.Text = "My Computer"; //SelectedTreeView((TreeViewItem)this.TVRoot.SelectedItem); //this.btnFront.IsEnabled = true; Dirs buf = (Dirs)this.element; this.Path.Text = buf.GetActionNode.FullName; } }
/// <summary> /// method for save path /// </summary> /// <param name="root">content</param> private void AddSavePath(DirectoryInfo root, bool flag = false) { try { if (!flag) { foreach (var file in root.GetFiles()) { break; } } if (root.Parent == null) { this.element.Reset(); this.btnFront.IsEnabled = false; } var buf = this.element.GetRoot; Elemnts el = null; if (buf == null) { el = new Dirs { Parent = this.element, Root = root } } ; else { el = new Dirs { Parent = buf, Root = root } }; this.element.Add(el); if (!flag) { this.Path.Text = this.element.GetActionNode.FullName; } else { this.Path.Text = this.element.GetActionNode.Name; } } catch (Exception ex) { } }
/// <summary> /// method for recurs walk dir /// </summary> /// <param name="root"></param> public void WalkToParent(DirectoryInfo root) { //if (root == null) // return; //WalkToParent(root.Parent); var buf = this.element.GetRoot; Elemnts el = null; if (buf == null) { el = new Dirs { Parent = this.element, Root = root } } ; else { el = new Dirs { Parent = buf, Root = root } }; this.element.Add(el); }
/// <summary> /// method for click in button front /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click_1(object sender, RoutedEventArgs e) { try { Dirs buf = (Dirs)this.element; buf++; this.view[this.indexView](buf.GetActionNode, null); this.btnBack.IsEnabled = true; if (!this.element.GetActionNode.FullName.Contains("Searching results")) { this.Path.Text = buf.GetActionNode.FullName; } else { this.Path.Text = buf.GetActionNode.Name; } } catch (Exception ex) { Dirs buf = (Dirs)this.element; this.Path.Text = buf.GetActionNode.FullName; } }