private void btn_del_Click(object sender, RoutedEventArgs e) { myProcessMonInfo myProcessMonInfo1 = listViewProRules.ItemsSource as myProcessMonInfo; ProcessMonInfo ProcessMonInfo1 = listViewProRules.SelectedItem as ProcessMonInfo; if (null == ProcessMonInfo1) { return; } fnDelRelateKey(ProcessMonInfo1.ProcessName); myProcessMonInfo1.RemItem(listViewProRules.SelectedIndex); }
private unsafe void InitWindow() { GridView myGridView = new GridView(); myProcessMonInfo myProcessMonInfo1 = new myProcessMonInfo(); myGridView.AllowsColumnReorder = true; GridViewColumn gc2 = new GridViewColumn(); gc2.Header = "进程名"; gc2.DisplayMemberBinding = new Binding("ProcessName"); gc2.Width = 150; myGridView.Columns.Add(gc2); GridViewColumn gc3 = new GridViewColumn(); gc3.Header = "操作"; gc3.DisplayMemberBinding = new Binding("Oper"); gc3.Width = 80; myGridView.Columns.Add(gc3); GridViewColumn gc4 = new GridViewColumn(); gc4.Header = "路径"; gc4.DisplayMemberBinding = new Binding("ProcessPath"); gc4.Width = 200; myGridView.Columns.Add(gc4); GridViewColumn gc5 = new GridViewColumn(); gc5.Header = "SHA1 值"; gc5.DisplayMemberBinding = new Binding("SHA1"); gc5.Width = 100; myGridView.Columns.Add(gc5); GridViewColumn gc6 = new GridViewColumn(); gc6.Header = "最近修改时间"; gc6.DisplayMemberBinding = new Binding("LastTime"); gc6.Width = 150; myGridView.Columns.Add(gc6); listViewProRules.View = myGridView; listViewProRules.ItemsSource = myProcessMonInfo1; UInt32 cbSubKeys = 0; UInt32 i = 0; cbSubKeys = fnGetRegProItemCount(); if (cbSubKeys != 0) { ProMonItem proMonItem1 = new ProMonItem(); System.Text.UnicodeEncoding convert1 = new UnicodeEncoding(); for (i = 0; i < cbSubKeys; ++i) { fnGetRegProItem(i, ref proMonItem1); string oper = (proMonItem1.oper == 0) ? "拦截" : "放过"; Array.Resize(ref proMonItem1.processName, GetByteArrayValidCount(proMonItem1.processName)); Array.Resize(ref proMonItem1.processPath, GetByteArrayValidCount(proMonItem1.processPath)); Array.Resize(ref proMonItem1.lastTime, GetByteArrayValidCount(proMonItem1.lastTime)); myProcessMonInfo1.AddItem( convert1.GetString(proMonItem1.processName), oper, convert1.GetString(proMonItem1.processPath), convert1.GetString(proMonItem1.sha1), convert1.GetString(proMonItem1.lastTime) ); Array.Resize(ref proMonItem1.processName, 100); Array.Resize(ref proMonItem1.processPath, 400); Array.Resize(ref proMonItem1.lastTime, 40); } } }