private void Application_Startup(object sender, StartupEventArgs e) { Users.Initialize(); Users.deserialize(); Plants.Initialize(); Plants.deserialize(); try { Users.Admin = Users.users.First(var => (var.Login == "admin")); Users.users.Remove(Users.Admin); } catch (InvalidOperationException) { User tmp = new User(); tmp.Login = "******"; tmp.Passwd = "admin"; Users.Admin = tmp; } MainWindow wnd = new MainWindow(); wnd.Show(); }
public PasswordWindow(User user, string alert) { InitializeComponent(); this.user = user; alertBlock.Text = alert; this.success = false; }
private void addUserBtn_Click(object sender, RoutedEventArgs e) { if (loginBox.Text != "" && passwdBox.Password != "") { try { Users.users.First(var => (var.Login == loginBox.Text)); System.Windows.MessageBox.Show("Uživatel již existuje!"); } catch (InvalidOperationException) { User tmp = new User(); tmp.Login = loginBox.Text; tmp.Passwd = passwdBox.Password; tmp.Name = nameBox.Text; tmp.Sname = snameBox.Text; tmp.Email = emailBox.Text; Users.users.Add(tmp); Users.ActiveUser = tmp; mwnd.MainGrid.Children.Clear(); mwnd.MainGrid.Children.Add(new ProfileUserControl()); } } }