private void dgvLoginUser_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int index = e.RowIndex; string id = dgvHelper.GetCellValue(index, "UserID"); string name = dgvHelper.GetCellValue(index, "UserName"); if (String.IsNullOrEmpty(id) || String.IsNullOrEmpty(name)) { return; } string msg = null; if (control.UserCount == 1) { msg = string.Format("“{0}”是最后一个登录用户,注销后会自动关闭最后未完成的任务,你确定要注销吗?", name); } else { msg = string.Format("你确定要注销“{0}”吗?", name); } if (MsgBoxHelper.Confirm(msg, "注销确认")) { control.Logout(id); dgvLoginUser.DataSource = control.LoginUsers; if (control.UserCount < 1 && handle != null) { handle(); } } }
private void btnRemoveDocTemplate_Click(object sender, EventArgs e) { if (cbDocTemplate.SelectedIndex > -1) { if (MsgBoxHelper.Confirm("Remove this template?") == DialogResult.OK) { try { // delete tempalte file var selectedFile = Path.Combine(_configContent.DocTemplateLocation, cbDocTemplate.SelectedItem.ToString()); File.Delete(selectedFile); // remove file name in list cbDocTemplate.Items.RemoveAt(cbDocTemplate.SelectedIndex); cbDocTemplate.Text = string.Empty; } catch (Exception ex) { MsgBoxHelper.Error("Failure: " + ex.Message); } } } else { MsgBoxHelper.Warning("Please choose a template!"); } }
private void btnLogout_Click(object sender, EventArgs e) { if (MsgBoxHelper.Confirm("注销所有用户会自动关闭最后未完成的任务,你确定要注销“{0}”吗?", "注销确认")) { control.Logout(); dgvLoginUser.DataSource = control.LoginUsers; if (control.UserCount < 1 && handle != null) { handle(); } } }
private void btnRemoveConnection_Click(object sender, EventArgs e) { if (cbConnection.SelectedIndex > -1) { if (MsgBoxHelper.Confirm("Remove this connection?") == DialogResult.OK) { cbConnection.Items.RemoveAt(cbConnection.SelectedIndex); cbConnection.Text = string.Empty; txtConnStr.Text = string.Empty; } } else { MsgBoxHelper.Warning("Please choose a connection!"); } }