ITsiRegPathItem.cs 825 B

123456789101112131415161718192021222324252627
  1. using BulePointLilac.Methods;
  2. using System.Windows.Forms;
  3. using static BulePointLilac.Methods.ObjectPath;
  4. namespace ContextMenuManager.Controls
  5. {
  6. interface ITsiRegPathItem
  7. {
  8. string RegPath { get; set; }
  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) => ShowPath(item.RegPath, PathType.Registry);
  17. item.ContextMenuStrip.Opening += (sender, e) =>
  18. {
  19. using(var key = RegistryEx.GetRegistryKey(item.RegPath))
  20. this.Visible = key != null;
  21. };
  22. }
  23. }
  24. }