private void SwitchDumperType(DumperType dumperType) { string name = dumperType.ToString(); foreach (ToolStripMenuItem item in mnuDumperType.DropDownItems) { item.Checked = item.Text == name; } _dumperType = dumperType; }
public ProcessesForm() { InitializeComponent(); Text = $"{Application.ProductName} v{Application.ProductVersion} ({(Environment.Is64BitProcess ? "x64" : "x86")}{(_isAdministrator ? _resources.GetString("StrAdministrator") : string.Empty)})"; typeof(ListView).InvokeMember("DoubleBuffered", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, null, lvwProcesses, new object[] { true }); lvwProcesses.ListViewItemSorter = new ListViewItemSorter(lvwProcesses, new List <TypeCode> { TypeCode.String, TypeCode.Int32, TypeCode.String }); for (DumperType dumperType = DumperType.Normal; dumperType <= DumperType.AntiAntiDump; dumperType++) { ToolStripMenuItem item; DumperType currentDumperType; item = new ToolStripMenuItem(dumperType.ToString()); currentDumperType = dumperType; item.Click += (object sender, EventArgs e) => SwitchDumperType(currentDumperType); mnuDumperType.DropDownItems.Add(item); } SwitchDumperType(DumperType.Normal); RefreshProcessList(); }