/// <summary> /// 初始化界面数据 /// </summary> private void InitData() { // 检索条件部分 this.search_id_numericUpDown.Text = ""; // 资源组信息 this.search_group_comboBox.Items.Add(""); string[] groups = MainForm.ReadGroup(); if (groups != null) { foreach (var item in groups) { this.search_group_comboBox.Items.Add(item); } this.search_group_comboBox.Text = TFSRecordForm.m_strGroupName; } // 提交和Review名称提供记忆功能 string strCoder = IniInterface.GetValue("Search", "Checkin").Trim(); this.search_code_textBox.Text = strCoder; string strReviewer = IniInterface.GetValue("Search", "Reviewer").Trim(); this.search_review_textBox.Text = strReviewer; // 清空List this.record_listView.Items.Clear(); // 清空统计信息 UpdateStatuesBar(0, 0, 0, 0); }
/// <summary> /// 读取问题指定级别对应的类型信息 /// </summary> /// <returns></returns> public static List <string> ReadQuestionType(string strLevel) { List <string> retList = new List <string>(); int iCount = int.Parse(IniInterface.GetValue("Question", "Count")); for (int iIdx = 1; iIdx <= iCount; ++iIdx) { string strKey = string.Format("Level_{0}", iIdx); string strValue = IniInterface.GetValue("Question", strKey); if (strValue == strLevel) { strKey = string.Format("Type_{0}", iIdx); strValue = IniInterface.GetValue("Question", strKey); string[] types = Regex.Split(strValue, ",", RegexOptions.IgnoreCase); foreach (var item in types) { retList.Add(item); } break; } } return(retList); }
/// <summary> /// 保存检索条件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TFSRecordForm_FormClosed(object sender, FormClosedEventArgs e) { // 提交和Review名称提供记忆功能 string strCoder = this.search_code_textBox.Text.Trim(); IniInterface.SetValue("Search", "Checkin", strCoder); string strReviewer = this.search_review_textBox.Text.Trim(); IniInterface.SetValue("Search", "Reviewer", strReviewer); }
/// <summary> /// 读取问题的级别信息 /// </summary> /// <returns></returns> public static List <string> ReadQuestionLevel() { List <string> retList = new List <string>(); int iCount = int.Parse(IniInterface.GetValue("Question", "Count")); for (int iIdx = 1; iIdx <= iCount; ++iIdx) { string strKey = string.Format("Level_{0}", iIdx); string strValue = IniInterface.GetValue("Question", strKey); retList.Add(strValue); } return(retList); }
/// <summary> /// 初始化界面数据 /// </summary> private void InitData() { try { // 加载数据库信息 string strServer = IniInterface.GetValue("Database", "Server").Trim(); this.db_ip_textBox.Text = strServer; // 加载资源组信息 string strGroups = IniInterface.GetValue("Group", "Names").Trim(); string[] groups = Regex.Split(strGroups, ","); group_name_comboBox.Items.Clear(); foreach (var item in groups) { group_name_comboBox.Items.Add(item); } // 当前资源组 string strGroup = IniInterface.GetValue("Group", "Name").Trim(); if (strGroup != "") { group_name_comboBox.Text = strGroup; } else { group_name_comboBox.SelectedIndex = 0; } // 读取快捷键信息 string strCheckinKey = IniInterface.GetValue("HotKey", "Checkin").Trim(); key_checkin_textBox.Text = strCheckinKey; MainForm.m_strCheckinHotKey = strCheckinKey; string strReviewKey = IniInterface.GetValue("HotKey", "Review").Trim(); key_review_textBox.Text = strReviewKey; MainForm.m_strReviewHotKey = strReviewKey; } catch (System.Exception ex) { this.db_ip_textBox.Text = ""; } }
/// <summary> /// 窗口关闭时卸载钩子 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { try { // 保存配置文件 IniInterface.SetValue("Database", "Server", this.db_ip_textBox.Text.Trim()); IniInterface.SetValue("Group", "Name", this.group_name_comboBox.Text.Trim()); IniInterface.SetValue("HotKey", "Checkin", this.key_checkin_textBox.Text.Trim()); IniInterface.SetValue("HotKey", "Review", this.key_review_textBox.Text.Trim()); } catch (System.Exception ex) { } // 卸载钩子 if (m_hHook != 0) { WinAPI.UnhookWindowsHookEx(m_hHook); m_hHook = 0; } }
/// <summary> /// 读取配置文件的组信息 /// </summary> /// <returns></returns> public static string[] ReadGroup() { string strGroups = IniInterface.GetValue("Group", "Names"); return(Regex.Split(strGroups, ",", RegexOptions.IgnoreCase)); }