예제 #1
0
        public static void BuildContentTreeGoodMatches()
        {
            ITreeIO tio = new TreeIO();
            WordSuggestor ws = tio.LoadObject(testpath + "WordSuggestions") as WordSuggestor;

            IBaseTree tree = ws.BuildTreeGoodMatches();
            tio.SaveBaseTree(tree, testpath + "AutoTree2.tree");
        }
예제 #2
0
        public void LoadInvalidFileTest()
        {
            ITreeIO   io       = new TreeIO();
            IBaseTree basetree = setUpBaseTree();
            IDataTree datatree = setUpDataTree(basetree);

            io.SaveBaseTree(basetree, location);

            Assert.IsTrue(File.Exists(location));

            IDataTree loadedDatatree = io.LoadDataTree(location);
        }
예제 #3
0
        public void SaveBaseTreeTest()
        {
            ITreeIO   io       = new TreeIO();
            IBaseTree basetree = setUpBaseTree();

            io.SaveBaseTree(basetree, location);

            Assert.IsTrue(File.Exists(location));

            IBaseTree loadedBasetree = io.LoadBaseTree(location);

            Assert.AreNotSame(basetree, loadedBasetree);
            Assert.AreEqual(basetree.Root.KeyWord, loadedBasetree.Root.KeyWord);
        }
예제 #4
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.FileName   = "Tree";                      // Default file name
            sfd.DefaultExt = ".tree";                     // Default file extension
            sfd.Filter     = "Tree Files (.tree)|*.tree"; // Filter files by extension

            // Show open file dialog box
            Nullable <bool> result = sfd.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                // Open document
                string filename = sfd.FileName;
                TreeIO io       = new TreeIO();
                io.SaveBaseTree(baseTree, filename);
            }
        }