示例#1
0
        /// <summary>
        /// Get an object that represents the current states and
        /// can be persisted (to standard XML serialization).
        /// </summary>
        /// <returns></returns>
        public ProfilePersistable GetObjectForPersistence()
        {
            var ret = new ProfilePersistable();

            ret.MRU                  = this.MRU.GetObjectForPersistence();
            ret.MainWindowPosSz      = this.MainWindowPosSz;
            ret.LastActiveSolution   = this.LastActiveSolution;
            ret.LastActiveSourceFile = this.LastActiveSolution;
            ret.LastActiveSourceFile = this.LastActiveSolution;
            ret.LastActiveTargetFile = this.LastActiveTargetFile;

            return(ret);
        }
示例#2
0
        /// <summary>
        /// Set current object states from an object that represents
        /// the persisted values (from standard XML serialization).
        /// </summary>
        /// <returns></returns>
        public void SetObjectFromPersistence(ProfilePersistable persist)
        {
            if (persist == null)
            {
                return;
            }

            this.MRU.SetObjectFromPersistence(persist.MRU);
            this.MainWindowPosSz      = persist.MainWindowPosSz;
            this.LastActiveSolution   = persist.LastActiveSolution;
            this.LastActiveSolution   = persist.LastActiveSolution;
            this.LastActiveSolution   = persist.LastActiveSolution;
            this.LastActiveTargetFile = persist.LastActiveTargetFile;
        }
示例#3
0
        /// <summary>
        /// Save program options into persistence.
        /// See <seealso cref="LoadOptions"/> to load program options on program start.
        /// </summary>
        /// <param name="sessionDataFileName"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool SaveSessionData(string sessionDataFileName, IProfile model)
        {
            var persistable = model.GetObjectForPersistence();

            return(ProfilePersistable.SaveObjectToPersistence(sessionDataFileName, persistable));
        }
示例#4
0
 /// <summary>
 /// Save program options into persistence.
 /// See <seealso cref="SaveOptions"/> to save program options on program end.
 /// </summary>
 /// <param name="sessionDataFileName"></param>
 /// <returns></returns>
 public void LoadSessionData(string sessionDataFileName)
 {
     // Just get the defaults if serilization wasn't working here...
     SessionData = new Profile();
     SessionData.SetObjectFromPersistence(ProfilePersistable.GetObjectFromPersistence(sessionDataFileName));
 }