示例#1
0
 public DialogDataFile(string file)
 {
     using (Stream stream = File.Open(file, FileMode.Open))
     {
         BinaryFormatter formatter = new BinaryFormatter();
         DialogDataFile  dialog    = formatter.Deserialize(stream) as DialogDataFile;
         Data  = dialog.Data;
         Nodes = dialog.Nodes;
     }
 }
示例#2
0
        private void OpenFileMenuItem_Click(object sender, EventArgs e)
        {
            if (IsFileEdited && ConfirmSaveDialog())
            {
                return;
            }
            FileDialog dialog = FileDialog(new OpenFileDialog(), ".ddat");

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                DialogDataFile file = new DialogDataFile(FilePath = dialog.FileName);
                DialogTree.Nodes.Clear();
                DialogTree.Nodes.AddRange(file.Nodes.Cast <TreeNode>().ToArray());
                TreeViewModel = file.Data;
            }
        }