private void miDeleteClassList_Click(object sender, RoutedEventArgs e) { ContextMenu cm = this.FindResource("cmNewClass") as ContextMenu; TreeViewItem tvi = cm.Tag as TreeViewItem; ClassList classList = (ClassList)tvi.Tag; Project.Current.Config.ClassLists.Remove(classList); RebuildTree(); }
private void cmiNewClasslist_Click(object sender, RoutedEventArgs e) { ClassList classList = new ClassList("classlist"); Project.Current.Config.AddClassList(classList); var item = AddNewClasslistItem(classList); item.IsSelected = true; item.IsExpanded = true; }
private void BuildClasslistContent(ClassList classList) { SelectedClassList = classList; SelectedClass = null; tbName.Text = classList.Name; textSelector.SelectByTag(classList.ShownName); tbName.IsEnabled = true; textSelector.IsEnabled = true; gridSettings.Visibility = Visibility.Visible; spClassSettings.Visibility = Visibility.Hidden; }
private void miNewClass_Click(object sender, RoutedEventArgs e) { ContextMenu cm = this.FindResource("cmNewClass") as ContextMenu; TreeViewItem tvi = cm.Tag as TreeViewItem; ClassList classList = (ClassList)tvi.Tag; Class @class = new Class("class"); classList.AddClass(@class); var item = AddNewClassItem(tvi, @class); item.IsSelected = true; }
public UCEClassSelector(ClassList classList, ObjectVariable classVariable) { InitializeComponent(); ClassVariable = classVariable; if (classList.ShownName != null) { tbClasslistName.Text = $"{classList.ShownName.Content} ({classList.Name})"; } else { tbClasslistName.Text = classList.Name; } BuildClassSelector(classList); }
private TreeViewItem AddNewClasslistItem(ClassList classList) { TreeViewItem item = new TreeViewItem(); item.Header = classList.Name; item.Tag = classList; item.PreviewMouseRightButtonDown += tviClassList_MouseRightButtonDown; //item.MouseRightButtonDown += tviClassList_MouseRightButton; //item.PreviewMouseRightButtonUp += tviClassList_MouseRightButton; //item.MouseRightButtonUp += tviClassList_MouseRightButton; tviClasslists.Items.Add(item); return(item); }
private void tvClasslists_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { var item = (TreeViewItem)tvClasslists.SelectedItem; if (item == null || (!(item.Tag is Class) && !(item.Tag is ClassList))) { ClearInfo(); } if (item.Tag is Class) { Class @class = (Class)item.Tag; BuildClassContent(@class); } else if (item.Tag is ClassList) { ClassList classList = (ClassList)item.Tag; BuildClasslistContent(classList); } }
private void textSelector_SelectionChanged(object sender, SelectionChangedEventArgs e) { var item = (TreeViewItem)tvClasslists.SelectedItem; if (item == null) { return; } if (item.Tag is ClassList) { ClassList classList = (ClassList)item.Tag; classList.ShownName = textSelector.SelectedTag; } else if (item.Tag is Class) { Class @class = (Class)item.Tag; @class.ShownName = textSelector.SelectedTag; } }
private void tbName_TextChanged(object sender, TextChangedEventArgs e) { var item = (TreeViewItem)tvClasslists.SelectedItem; if (item == null) { return; } if (item.Tag is ClassList) { ClassList classList = (ClassList)item.Tag; classList.Name = tbName.Text; item.Header = tbName.Text; } else if (item.Tag is Class) { Class @class = (Class)item.Tag; @class.Name = tbName.Text; item.Header = tbName.Text; } }
private void BuildClassSelector(ClassList classList) { foreach (Class c in classList.Classes) { ComboBoxItem item = new ComboBoxItem(); item.Tag = c; if (c.ShownName != null) { item.Content = $"{c.ShownName.Content} ({c.Name})"; } else { item.Content = c.Name; } cbClass.Items.Add(item); if (ClassVariable.Value == c) { cbClass.SelectedItem = item; } } }
public void AddClassList(ClassList classList) { ClassLists.Add(classList); }