Exemplo n.º 1
0
        public void LoadBook(VocabularyBook book)
        {
            var controller = new VocabularyBookController(book)
            {
                Parent = this
            };

            SplitContainer.Panel2.Controls.Add(controller.ListView);
            controller.ListView.PerformLayout();
            controller.ListView.BringToFront();

            CurrentBook       = book;
            CurrentController = controller;

            VocabularyBookLoaded(true);

            FileTreeView.SelectedPath = book.FilePath;

            Settings.Default.LastFile = book.FilePath;
            Settings.Default.Save();
        }
Exemplo n.º 2
0
        public void UnloadBook(bool fullUnload)
        {
            using (var controller = CurrentController)
            {
                CurrentBook       = null;
                CurrentController = null;
                SplitContainer.Panel2.Controls.Remove(controller.ListView);
            }

            if (fullUnload)
            {
                VocabularyBookLoaded(false);
                VocabularyWordSelected(false);
                VocabularyBookHasContent(false);
                VocabularyBookPracticable(false);
                VocabularyBookHasFilePath(false);
                VocabularyBookUnsavedChanges(false);
                VocabularyBookName(null);

                // Accidentially overriding this value when the user already has chosen another file results in a stack overflow
                FileTreeView.SelectedPath = "";
            }
        }