private void btnAdd_Click(object sender, EventArgs e) { if (txtAddress.Text == "" || txtData.Text == "") { return; } DetectRule DR = new DetectRule(); DR.address = txtAddress.Text; DR.compare = comboCompare.Text; UInt64 x; HexToUint64(txtData.Text, out x); DR.data = x; DR.group = (ushort)numGroup.Value; DR.grouplogic = comboGroupLogic.Text; DR.xml = comboXML.Text; DetectRules.Add(DR); var item = new ListViewItem(DR.address); item.SubItems.Add(DR.compare); item.SubItems.Add(DR.data.ToString("X")); item.SubItems.Add(DR.group.ToString()); item.SubItems.Add(DR.grouplogic); item.Tag = DetectRules.Count - 1; listRules.Items.Add(item); comboGroupLogic.Enabled = false; LoadXMLList(); }
private void btnDel_Click(object sender, EventArgs e) { if (listRules.SelectedItems.Count == 0) { return; } try { int i = (int)listRules.SelectedItems[0].Tag; DetectRules.RemoveAt(i); listRules.SelectedItems[0].Remove(); } catch (Exception ex) { Logger(ex.Message); } }
public void filterTables() { try { if (this.Text.Contains("Table Seek")) { List <TableSeek> compareList = new List <TableSeek>(); if (strSortOrder == SortOrder.Ascending) { compareList = tableSeeks.OrderBy(x => typeof(TableSeek).GetProperty(sortBy).GetValue(x, null)).ToList(); } else { compareList = tableSeeks.OrderByDescending(x => typeof(TableSeek).GetProperty(sortBy).GetValue(x, null)).ToList(); } bindingSource.DataSource = compareList; } else if (this.Text.Contains("Autodetect")) { List <DetectRule> compareList = new List <DetectRule>(); if (strSortOrder == SortOrder.Ascending) { compareList = DetectRules.OrderBy(x => typeof(DetectRule).GetProperty(sortBy).GetValue(x, null)).ToList(); } else { compareList = DetectRules.OrderByDescending(x => typeof(TableData).GetProperty(sortBy).GetValue(x, null)).ToList(); } bindingSource.DataSource = compareList; } else if (this.Text.Contains("stock CVN")) { List <CVN> compareList = new List <CVN>(); if (strSortOrder == SortOrder.Ascending) { compareList = StockCVN.OrderBy(x => typeof(CVN).GetProperty(sortBy).GetValue(x, null)).ToList(); } else { compareList = StockCVN.OrderByDescending(x => typeof(CVN).GetProperty(sortBy).GetValue(x, null)).ToList(); } bindingSource.DataSource = compareList; } else if (this.Text.Contains("DTC Search")) { List <DtcSearchConfig> compareList = new List <DtcSearchConfig>(); if (strSortOrder == SortOrder.Ascending) { compareList = dtcSearchConfigs.OrderBy(x => typeof(DtcSearchConfig).GetProperty(sortBy).GetValue(x, null)).ToList(); } else { compareList = dtcSearchConfigs.OrderByDescending(x => typeof(DtcSearchConfig).GetProperty(sortBy).GetValue(x, null)).ToList(); } bindingSource.DataSource = compareList; } dataGridView1.Columns[sortIndex].HeaderCell.SortGlyphDirection = strSortOrder; } catch (Exception ex) { Debug.WriteLine(ex.Message); } }