-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSysMenuItem.cs
77 lines (59 loc) · 1.76 KB
/
SysMenuItem.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Interop;
using System.Windows.Markup;
using System.ComponentModel;
using System.Text;
using System.Drawing.Design;
namespace SysMenu
{
public class SysMenuItem : DependencyObject
{
private static Type _typeofThis = typeof(SysMenuItem);
private const string _category = "System menu";
[Category(_category)]
[Browsable(true)]
[Description("Type: UINT The menu item before which the new menu item is to be inserted, as determined by the uFlags parameter.")]
public int Index { get; set; }
[Category(_category)]
[Browsable(true)]
[Description("uIDNewItem[in] Type: UINT_PTR - The identifier of the new menu item or, if the uFlags parameter has the MF_POPUP flag set, a handle to the drop-down menu or submenu.")]
public int CmdId { get; set; }
[Category(_category)]
[Browsable(true)]
[Description("Text command.")]
public string CommandText { get; set; }
[Category(_category)]
[Browsable(true)]
public Win32.MenuFlags MenuFlags { get; set; }
static SysMenuItem() { }
public SysMenuItem() { }
public SysMenuItem(int index, Win32.MenuFlags flags, string commandText)
{
MenuFlags = flags;
CommandText = commandText;
Index = index;
}
#region ItemClick
public event EventHandler ItemClick;
public void OnItemClick()
{
if (ItemClick != null)
ItemClick.Invoke(this, null);
}
#endregion
}
internal static class Utils
{
internal static bool IsLegalHandler(this RoutedEvent revent, Delegate handler)
{
Type type = handler.GetType();
if (!(type == revent.HandlerType))
return type == typeof(RoutedEventHandler);
return true;
}
}
}