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