예제 #1
0
        private void SaveHsmToFile()
        {
            SaveCmd cmd = new SaveCmd(_Book, _StorageFileName);

            cmd.Completed += new HsmMementoCompleted(cmd_SaveCompleted);
            _Book.EventManager.AsyncDispatch(cmd);
        }
예제 #2
0
        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);
            }
        }