ITsiRegPathItem.cs 859 B

1234567891011121314151617181920212223242526
  1. using BluePointLilac.Methods;
  2. using System.Windows.Forms;
  3. namespace ContextMenuManager.Controls.Interfaces
  4. {
  5. interface ITsiRegPathItem
  6. {
  7. string RegPath { get; }
  8. string ValueName { get; }
  9. ContextMenuStrip ContextMenuStrip { get; set; }
  10. RegLocationMenuItem TsiRegLocation { get; set; }
  11. }
  12. sealed class RegLocationMenuItem : ToolStripMenuItem
  13. {
  14. public RegLocationMenuItem(ITsiRegPathItem item) : base(AppString.Menu.RegistryLocation)
  15. {
  16. this.Click += (sender, e) => ExternalProgram.JumpRegEdit(item.RegPath, item.ValueName, AppConfig.OpenMoreRegedit);
  17. item.ContextMenuStrip.Opening += (sender, e) =>
  18. {
  19. using(var key = RegistryEx.GetRegistryKey(item.RegPath))
  20. this.Visible = key != null;
  21. };
  22. }
  23. }
  24. }