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