Esempio n. 1
0
 private void AddElementToTree(object obj)
 {
     try
     {
         this.SelectedTree.AddItem(Convert.ToDouble(obj));
         SelectedTree.TreeString = SelectedTree.GetString();
     }
     catch (NullReferenceException) { MessageBox.Show("You need to create tree first", "Error", MessageBoxButton.OK, MessageBoxImage.Error); }
     catch (FormatException) { MessageBox.Show("Incorect input", "Error", MessageBoxButton.OK, MessageBoxImage.Error); }
     //catch (Exception) { MessageBox.Show("Unknown error", "Error", MessageBoxButton.OK, MessageBoxImage.Error); }
 }
Esempio n. 2
0
        private void RemoveElementFromTree(object obj)
        {
            try
            {
                if (obj != null)
                {
                    this.SelectedTree.Remove(Convert.ToDouble(obj));
                }

                SelectedTree.TreeString = null;
                SelectedTree.TreeString = SelectedTree.GetString();
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("No active tree", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (Exception)
            {
                MessageBox.Show("Incorrect input", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }