private void UserSettings_Click(object sender, RoutedEventArgs e) { if (!Vars.IsAdmin) { SettingsUser userSettings = new SettingsUser(); userSettings.ShowDialog(); } }
void RememberPassword() { Action Remember = () => { var us = users.Where(u => u.UserName == this.UserName); if (this.IsRemember) { if (us.Count() > 0) { SettingsUser user = us.FirstOrDefault(); if (user.Password == this.Password) { return; } users.Remove(user); users.Add(new SettingsUser(this.UserName, this.Password)); } else { users.Add(new SettingsUser(this.UserName, this.Password)); } } else if (us.Count() > 0) { users.Remove(us.FirstOrDefault()); } SettingsUsers urs = new SettingsUsers(users); Settings.Default.Users = urs; Settings.Default.Save(); }; Remember.BeginInvoke(ar => { Remember.EndInvoke(ar as IAsyncResult); }, Remember); }
public Form1() { InitializeComponent(); _settingsUser = SettingsUser.GetSettingsUser(); _initControlls(); }