Пример #1
0
 public void Save(WindowProfile profile)
 {
     Validate.IsNotNull(profile, nameof(profile));
     if (!EnsureLocalStorageDirectoryExists())
     {
         return;
     }
     SaveProfileToLocalStorage(profile);
 }
Пример #2
0
        public WindowProfile CreateProfile(string profileName, Func <string, WindowProfile> activator)
        {
            Validate.IsNotNullAndNotEmpty(profileName, nameof(profileName));
            EnsureFileNameIndexLoaded();
            var windowProfile = activator(profileName) ?? WindowProfile.Create(profileName);

            AddProfile(windowProfile);
            return(windowProfile);
        }
Пример #3
0
 private bool TryGetProfile(string profileName, out WindowProfile profile)
 {
     profile = null;
     if (Profiles.All(x => x.Name != profileName))
     {
         return(false);
     }
     profile = Profiles.First(x => x.Name == profileName);
     return(true);
 }
Пример #4
0
 private void SaveProfileToLocalStorage(WindowProfile profile)
 {
     try
     {
         LayoutPayloadUtilities.PayloadDataToFile(GetProfileFullPath(profile.Name), profile.StatePlayload);
     }
     catch
     {
         //Ignored
     }
 }
Пример #5
0
 public void AddProfile(WindowProfile profile)
 {
     if (Profiles.Contains(profile))
     {
         OnProfileSet(profile);
     }
     else
     {
         Profiles.Add(profile);
         GetOrCreateProfileFileName(profile.Name);
         OnProfileAdded(profile);
     }
 }
Пример #6
0
 protected void OnProfileSet(WindowProfile newProfile)
 {
     ProfileSet?.Invoke(this, new WindowProfileEventArgs(newProfile));
 }
Пример #7
0
 public WindowProfileEventArgs(WindowProfile profile)
 {
     WindowProfile = profile;
 }