forked from GtkSharp/GtkSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
74 lines (60 loc) · 2.25 KB
/
Program.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
// This is free and unencumbered software released into the public domain.
// Happy coding!!! - GtkSharp Team
using System;
using Gtk;
namespace Samples
{
class Program
{
public static Application App;
public static Window Win;
[STAThread]
public static void Main(string[] args)
{
Application.Init();
App = new Application("org.Samples.Samples", GLib.ApplicationFlags.None);
App.Register(GLib.Cancellable.Current);
Win = new MainWindow();
App.AddWindow(Win);
var menu = new GLib.Menu();
menu.AppendItem(new GLib.MenuItem("Help", "app.help"));
menu.AppendItem(new GLib.MenuItem("About", "app.about"));
menu.AppendItem(new GLib.MenuItem("Quit", "app.quit"));
App.AppMenu = menu;
var helpAction = new GLib.SimpleAction("help", null);
helpAction.Activated += HelpActivated;
App.AddAction(helpAction);
var aboutAction = new GLib.SimpleAction("about", null);
aboutAction.Activated += AboutActivated;
App.AddAction(aboutAction);
var quitAction = new GLib.SimpleAction("quit", null);
quitAction.Activated += QuitActivated;
App.AddAction(quitAction);
Win.ShowAll();
Application.Run();
}
private static void HelpActivated(object sender, EventArgs e)
{
}
private static void AboutActivated(object sender, EventArgs e)
{
var dialog = new AboutDialog
{
TransientFor = Win,
ProgramName = "GtkSharp Sample Application",
Version = "1.0.0.0",
Comments = "A sample application for the GtkSharp project.",
LogoIconName = "system-run-symbolic",
License = "This sample application is licensed under public domain.",
Website = "https://www.github.com/GtkSharp/GtkSharp",
WebsiteLabel = "GtkSharp Website"
};
dialog.Run();
dialog.Hide();
}
private static void QuitActivated(object sender, EventArgs e)
{
Application.Quit();
}
}
}