public MainWindow() { nextMode = Program.WindowMode.Terminate; settingsOpen = false; InitializeComponent(); this.pnl_Settings.Enabled = false; this.pnl_Settings.Visible = false; this.Width = normalWindowWidth; this.Invalidate(); alertDisplay = new List <Label>(); removeAlertCheckBxs = new List <CheckBox>(); removeSaveButton(); removeAlertAddControls(); if (WeatherLookup.update()) { updateDisplay(); } else { openSettingsPane(); } }
private void btn_SwitchUsers_Click(object sender, EventArgs e) { nextMode = Program.WindowMode.Select; disableAlert(); User.determineAvailableUsers(); this.Close(); }
public UserWindow(Program.WindowMode mode) { nextMode = Program.WindowMode.Terminate; if (mode == Program.WindowMode.Create) { initializeCreateMode(); } else { initializeSelectMode(); } }
private void btn_CreateUser_Click(object sender, EventArgs e) { bool usrValid = User.validateUsername(txtbx_Username.Text) && User.userIsNew(txtbx_Username.Text); bool locValid = User.validateLocation(txtbx_Location.Text); bool emailValid = true; if (txtbx_EmailAddr.Text != "") { emailValid = User.validateEmailAddr(txtbx_EmailAddr.Text); txtbx_EmailAddr.BackColor = (emailValid) ? Color.White : Color.Goldenrod; } txtbx_Username.BackColor = (usrValid) ? Color.White : Color.Goldenrod; txtbx_Location.BackColor = (locValid) ? Color.White : Color.Goldenrod; if (usrValid && locValid && emailValid) { User.CurrentUser = txtbx_Username.Text; User.UserLocation = txtbx_Location.Text; User.UserEmailAddr = txtbx_EmailAddr.Text; if (User.UserEmailAddr != "") { User.AlertPreference = UserPreference.Both; } else { User.AlertPreference = UserPreference.Desktop; } User.resetAlerts(); if (!User.saveUser()) { return; } if (User.readUserFile()) { nextMode = Program.WindowMode.Main; this.Close(); } else { MessageBox.Show("User file read error.", "Message", MessageBoxButtons.OK); } } }
private void btn_SelectUser_Click(object sender, EventArgs e) { if (lstBx_Users.SelectedIndex >= 0 && lstBx_Users.SelectedIndex < User.NumOfUsers) { User.CurrentUser = User.UserList[lstBx_Users.SelectedIndex]; if (User.readUserFile()) { nextMode = Program.WindowMode.Main; this.Close(); } else { while (!User.readUserFile()) { if (DialogResult.No == MessageBox.Show("User file read error. Select yes if you want to try again?", "Message", MessageBoxButtons.YesNo)) { break; } } } } }