Пример #1
0
        /// <summary>
        ///     Switches to the requested profile
        /// </summary>
        /// <param name="Id">Id of the profile to switch to</param>
        public void SwitchProfile(int Id)
        {
            var profileMemento = ActiveProfile.MakeMemento();

            ProfileCaretaker.AddOrUpdateProfile(profileMemento);

            var newProfile = ProfileCaretaker.GetProfile(Id);

            ActiveProfile.LoadMemento(newProfile);
        }
Пример #2
0
        /// <summary>
        ///     Creates a new profile and sets it as active
        /// </summary>
        public void NewProfile()
        {
            if (ActiveProfile == null)
            {
                ActiveProfile = new Profile(ProfileCaretaker.TotalProfiles);
            }
            else
            {
                ProfileCaretaker.AddOrUpdateProfile(ActiveProfile.MakeMemento());
            }

            ActiveProfile.ItemCollection.Clear();
            ActiveProfile.Id = ProfileCaretaker.TotalProfiles;
            ProfileCaretaker.AddOrUpdateProfile(ActiveProfile.MakeMemento());
        }