2018-01-17 22:35:07 +00:00
|
|
|
using System;
|
|
|
|
using Gtk;
|
|
|
|
|
|
|
|
namespace Samples
|
|
|
|
{
|
|
|
|
class Program
|
|
|
|
{
|
2018-01-20 19:09:27 +00:00
|
|
|
public static Application App;
|
|
|
|
public static Window Win;
|
|
|
|
|
2018-01-17 22:35:07 +00:00
|
|
|
[STAThread]
|
|
|
|
public static void Main(string[] args)
|
|
|
|
{
|
|
|
|
Application.Init();
|
|
|
|
|
2018-01-20 19:09:27 +00:00
|
|
|
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);
|
2018-01-17 22:35:07 +00:00
|
|
|
|
2018-01-20 19:09:27 +00:00
|
|
|
var aboutAction = new GLib.SimpleAction("about", null);
|
|
|
|
aboutAction.Activated += AboutActivated;
|
|
|
|
App.AddAction(aboutAction);
|
2018-01-17 22:35:07 +00:00
|
|
|
|
2018-01-20 19:09:27 +00:00
|
|
|
var quitAction = new GLib.SimpleAction("quit", null);
|
|
|
|
quitAction.Activated += QuitActivated;
|
|
|
|
App.AddAction(quitAction);
|
|
|
|
|
|
|
|
Win.ShowAll();
|
2018-01-17 22:35:07 +00:00
|
|
|
Application.Run();
|
|
|
|
}
|
2018-01-20 19:09:27 +00:00
|
|
|
|
|
|
|
private static void HelpActivated(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void AboutActivated(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
var dialog = new AboutDialog();
|
|
|
|
dialog.TransientFor = Win;
|
|
|
|
dialog.ProgramName = "GtkSharp Sample Application";
|
|
|
|
dialog.Version = "1.0.0.0";
|
|
|
|
dialog.Comments = "A sample application for the GtkSharp project.";
|
|
|
|
dialog.LogoIconName = "system-run-symbolic";
|
|
|
|
dialog.License = "This sample application is licensed under public domain.";
|
|
|
|
dialog.Website = "https://www.github.com/GtkSharp/GtkSharp";
|
|
|
|
dialog.WebsiteLabel = "GtkSharp Website";
|
|
|
|
|
|
|
|
dialog.Run();
|
|
|
|
dialog.Hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void QuitActivated(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
Application.Quit();
|
|
|
|
}
|
2018-01-17 22:35:07 +00:00
|
|
|
}
|
|
|
|
}
|