Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        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);
            }
        }
Esempio n. 8
0
        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;
            }
        }
Esempio n. 9
0
        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;
            }
        }
Esempio n. 10
0
        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;
                }
            }
        }
Esempio n. 11
0
 public void AddClassList(ClassList classList)
 {
     ClassLists.Add(classList);
 }