Esempio n. 1
0
        private void SaveHsmToFile()
        {
            SaveCmd cmd = new SaveCmd(_Book, _StorageFileName);

            cmd.Completed += new HsmMementoCompleted(cmd_SaveCompleted);
            _Book.EventManager.AsyncDispatch(cmd);
        }
Esempio n. 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);
            }
        }