Esempio n. 1
0
        private void SaveWordTree(object _)
        {
            var serializer = new TreeViewHierarchyXmlSerializer(this);

            serializer.SerializeToXml();

            DataService.DataAltered = false;
        }
Esempio n. 2
0
        public MainViewModel()
        {
            SaveWordTreeCommand      = new BasicCommand(SaveWordTree);
            SortAllCategoriesCommand = new BasicCommand(SortAllCategories);
            FindWordCommand          = new BasicCommand(FindWord);
            ViewClosingActionCommand = new BasicCommand(WindowClosingAction);

            DataService = new TreeViewDataService <IWordTreeViewItem>();
            DataService.SelectedItemChanged += (o, e) => CurrentWord = DataService.SelectedItem.Text;

            MainCategory = new WordCategoryViewModel("Main", null, DataService, false);

            var serializer = new TreeViewHierarchyXmlSerializer(this);

            MainCategory.Children = new ObservableCollection <IWordTreeViewItem>(serializer.DeserializeXml());

            MainCategory.IsExpanded = true;
            MainCategory.StartRenameCommand.Enabled = false;

            TreeViewItems = CollectionViewSource.GetDefaultView(new ObservableCollection <IWordTreeViewItem> {
                MainCategory
            });
        }