private void savePlayList(ObservableCollection <PlayListCollection> playListCollections) { if (this.profile.HasValue) { List <Profile> profiles = ManagementSave.loadProfilesJSON(); int index = profiles.FindIndex(p => p.name == this.profile?.name && p.password == this.profile?.password); if (index == -1) { return; } profiles[index] = new Profile(this.profile?.name, this.profile?.password, playListCollections); ManagementSave.saveProfilesJSON(profiles); } }
private void RegistrationControl_OnRegistration(string login, string password) { int index = this.profiles.FindIndex(p => p.name == login); if (index == -1) { this.profiles.Add(new Profile { name = login, password = password, playLists = this.CreateStandartPlayList() }); this.EndAuth?.Invoke(this.profiles.Last()); ManagementSave.saveProfilesJSON(this.profiles); } else { RegistrationControl.showError("Данный пользователь уже существует"); } }
public AuthPage() { InitializeComponent(); this.profiles = ManagementSave.loadProfilesJSON(); }