forked from aadfPT/Xiaomi_gamepad
/
ContextMenus.cs
93 lines (83 loc) · 2.27 KB
/
ContextMenus.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using System;
using System.Diagnostics;
using System.Windows.Forms;
using System.Drawing;
namespace StadiaToSCP
{
/// <summary>
///
/// </summary>
class ContextMenus
{
/// <summary>
/// Is the About box displayed?
/// </summary>
bool isAboutLoaded = false;
/// <summary>
/// Creates this instance.
/// </summary>
/// <returns>ContextMenuStrip</returns>
public ContextMenuStrip Create()
{
// Add the default menu options.
var menu = new ContextMenuStrip();
ToolStripMenuItem item;
ToolStripSeparator sep;
//// Windows Explorer.
//item = new ToolStripMenuItem();
//item.Text = "Explorer";
//item.Click += new EventHandler(Explorer_Click);
////item.Image = Resources.Explorer;
//menu.Items.Add(item);
// About.
item = new ToolStripMenuItem();
item.Text = "About";
item.Click += new EventHandler(About_Click);
//item.Image = Resources.About;
menu.Items.Add(item);
// Separator.
sep = new ToolStripSeparator();
menu.Items.Add(sep);
// Exit.
item = new ToolStripMenuItem();
item.Text = "Exit";
item.Click += new System.EventHandler(Exit_Click);
//item.Image = Resources.Exit;
menu.Items.Add(item);
return menu;
}
/// <summary>
/// Handles the Click event of the Explorer control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
//void Explorer_Click(object sender, EventArgs e)
//{
// Process.Start("explorer", null);
//}
/// <summary>
/// Handles the Click event of the About control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
void About_Click(object sender, EventArgs e)
{
if (!isAboutLoaded)
{
isAboutLoaded = true;
new AboutBox().ShowDialog();
isAboutLoaded = false;
}
}
/// <summary>
/// Processes a menu item.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
void Exit_Click(object sender, EventArgs e)
{
// Quit without further ado.
Application.Exit();
}
}
}