Example #1
0
 public void Save(WindowProfile profile)
 {
     Validate.IsNotNull(profile, nameof(profile));
     if (!EnsureLocalStorageDirectoryExists())
     {
         return;
     }
     SaveProfileToLocalStorage(profile);
 }
Example #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);
        }
Example #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);
 }
Example #4
0
 private void SaveProfileToLocalStorage(WindowProfile profile)
 {
     try
     {
         LayoutPayloadUtilities.PayloadDataToFile(GetProfileFullPath(profile.Name), profile.StatePlayload);
     }
     catch
     {
         //Ignored
     }
 }
Example #5
0
 public void AddProfile(WindowProfile profile)
 {
     if (Profiles.Contains(profile))
     {
         OnProfileSet(profile);
     }
     else
     {
         Profiles.Add(profile);
         GetOrCreateProfileFileName(profile.Name);
         OnProfileAdded(profile);
     }
 }
Example #6
0
 protected void OnProfileSet(WindowProfile newProfile)
 {
     ProfileSet?.Invoke(this, new WindowProfileEventArgs(newProfile));
 }
Example #7
0
 public WindowProfileEventArgs(WindowProfile profile)
 {
     WindowProfile = profile;
 }