private void Save() { SaveFileDialog file = new SaveFileDialog(); Document document = _activeDocument.Document; file.FileName = document.Name; file.Filter = XpdlInfo.GetFileFilter(); if (file.ShowDialog() == DialogResult.OK) { ISerializer serializer = new XpdlSerializer(); using (var outputStream = file.OpenFile()) { serializer.Serialize(document, outputStream); } } }
private void Open() { OpenFileDialog file = new OpenFileDialog(); file.Filter = XpdlInfo.GetFileFilter(); if (file.ShowDialog() == DialogResult.OK) { ISerializer serialzier = new XpdlSerializer(); using (var inputStream = file.OpenFile()) { var document = serialzier.Deserialize(inputStream); DocumentViewModel viewModel = DocumentViewModel.FromModel(document); viewModel.SelectionChanged += Document_SelectionChanged; Documents.Add(viewModel); } } }