Exemplo n.º 1
0
        private void SaveFile()
        {
            if (SaveFilaManager.Instance.IsNewFile == false)
            {
                //Console.WriteLine(CurrentContent);

                JasonManager.Export(SaveFilaManager.Instance.FilePath, treeviewItemCollection);
                return;
            }

            Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
            //dlg.FileName = "json file";
            dlg.DefaultExt = ".json";
            dlg.Filter     = "json documents (.json)|*.json";

            Nullable <bool> result = dlg.ShowDialog();

            if (result == true)
            {
                JasonManager.Export(dlg.FileName, TreeviewItemCollection);

                SaveFilaManager.Instance.FilePath  = dlg.FileName;
                SaveFilaManager.Instance.IsNewFile = false;
            }
        }
Exemplo n.º 2
0
        private void LoadFile()
        {
            Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog();

            openFileDialog.FileName   = "json file";
            openFileDialog.DefaultExt = ".json";
            openFileDialog.Filter     = "json documents (.json)|*.json";

            Nullable <bool> result = openFileDialog.ShowDialog();

            if (result == true)
            {
                string file = openFileDialog.FileName;
                Console.WriteLine(file);
                ObservableCollection <TreeNode> collection = JasonManager.Import(file);
                TreeviewItemCollection = collection;

                SaveFilaManager.Instance.FilePath  = file;
                SaveFilaManager.Instance.IsNewFile = false;
            }
        }