/// <summary> /// 点击删除 /// </summary> private void OnBtnClickDelete() { DataGridView.EndEdit(); lists.Clear(); for (int i = 0; i < DataGridView.Rows.Count; i++) { DataGridViewRow row = DataGridView.Rows[i]; if (row.Cells[0].Value != null) { if (bool.Parse(row.Cells[0].Value.ToString()) == true) { //记录改行信息,并进行删除 lists.Add(row.Cells[3].Value.ToString()); DataGridView.Rows.Remove(row); i--; } } } //调用注册表删除方法 RegistryData.DeleteRegist(registryPath, lists.ToArray(), ref errMessage); //刷新一下组件 if (!string.IsNullOrEmpty(errMessage)) { MessageBox.Show(errMessage); } }
/// <summary> /// 默认获取 /// </summary> private void DefaultAcquisition() { receiveLists.Clear(); tableData.Clear(); receiveLists = RegistryData.GetUnityProjectList(registryPath, field, ref errMessage); Dictionary <string, string> .Enumerator dic = receiveLists.GetEnumerator(); while (dic.MoveNext()) { //需要截取一下 Value 的最后一个字段 int index = dic.Current.Value.LastIndexOf('/'); string fileName = dic.Current.Value.Substring(index + 1); AddDataGridViewRow(fileName, dic.Current.Value, dic.Current.Key); } DataGridView.DataSource = tableData; ViewPropertySettings(); }