Exemplo n.º 1
0
        private void ButtonRemove_Click(object sender, RoutedEventArgs e)
        {
            _tree.Find(TextBoxNewIdentifier.Text);
            if (_tree.WasFound)
            {
                _tree.Remove(TextBoxNewIdentifier.Text);
                TreeViewRight.Items.Clear();
                TreeViewRight.Items.Add(_tree.ToTreeViewItem());
                StatusBarTextBlock.Text = $"{TextBoxNewIdentifier.Text} - successfully removed";
            }
            else
            {
                StatusBarTextBlock.Text = $"{TextBoxNewIdentifier.Text} - no such identifier";
            }

            var identifier = TextBoxNewIdentifier.Text;

            TextBoxNewIdentifier.Clear();
            if (_tree.WasFound)
            {
                ShowRight();
            }
            StatusBarTextBlock.Text = _tree.WasFound ? $"{identifier} - successfully removed" : $"{identifier} - no such identifier";
            TextBoxNewIdentifier.Focus();
        }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            _marginTreeLeft   = TreeViewLeft.Margin.Left;
            _marginTreeTop    = TreeViewLeft.Margin.Top;
            _marginTreeRight  = TreeViewLeft.Margin.Right;
            _marginTreeBottom = TreeViewLeft.Margin.Bottom;

            HideRight();
            HidePath();
            TextBoxNewIdentifier.Focus();
        }
Exemplo n.º 3
0
        private void Badd_Click(object sender, RoutedEventArgs e)
        {
            _tree.Find(TextBoxNewIdentifier.Text);
            var identifier = TextBoxNewIdentifier.Text;

            if (!_tree.WasFound)
            {
                _tree.Add(TextBoxNewIdentifier.Text);
                TreeViewLeft.Items.Clear();
                TreeViewLeft.Items.Add(_tree.ToTreeViewItem());
            }
            TextBoxNewIdentifier.Clear();
            StatusBarTextBlock.Text = !_tree.WasFound ? $"{identifier} - successfully added" : $"{identifier} - already exist";
            TextBoxNewIdentifier.Focus();
        }
Exemplo n.º 4
0
        private void ButtonFind_Click(object sender, RoutedEventArgs e)
        {
            var path = _tree.Find(TextBoxNewIdentifier.Text);

            ListViewPath.Items.Clear();
            foreach (var t in path)
            {
                ListViewPath.Items.Add(new ListViewItem {
                    Content = t
                });
            }
            var identifier = TextBoxNewIdentifier.Text;

            TextBoxNewIdentifier.Clear();
            StatusBarTextBlock.Text = _tree.WasFound ? $"{identifier} - was found" : $"{identifier} - wasn't found";
            ShowPath();
            TextBoxNewIdentifier.Focus();
        }