private void SaveHsmToFile() { SaveCmd cmd = new SaveCmd(_Book, _StorageFileName); cmd.Completed += new HsmMementoCompleted(cmd_SaveCompleted); _Book.EventManager.AsyncDispatch(cmd); }
private void cmd_SaveCompleted(IQSimpleCommand command, ILQHsmMemento memento) { SaveCmd cmd = (SaveCmd)command; using (StreamWriter sw = new StreamWriter(cmd.FileName)) { BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(sw.BaseStream, memento); } }