private void btnlogout_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to log out?", "Log Out - Student Management Sytem", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK) { this.Hide(); logout = true; FormLogin lgn = new FormLogin(); lgn.ShowDialog(); } }
private void btnlogout_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to log out?", "Log Out - Student Management Sytem", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK) { this.Hide(); logout = true; var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); var settings = configFile.AppSettings.Settings; /*/ if (settings.Count == 0 | settings[key] == null) * { * settings.Add(key, value); * } * else * {/*/ settings["LastLogin"].Value = DateTime.Now.AddMinutes(-30).ToString(); configFile.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name); FormLogin lgn = new FormLogin(); lgn.ShowDialog(); } }