2017-09-23 14:38:43 +00:00
|
|
|
using System;
|
|
|
|
using Gtk;
|
|
|
|
using UI = Gtk.Builder.ObjectAttribute;
|
|
|
|
|
2017-10-26 17:49:21 +00:00
|
|
|
namespace GtkNamespace
|
2017-09-23 14:38:43 +00:00
|
|
|
{
|
|
|
|
class MainWindow : Window
|
|
|
|
{
|
2018-01-16 14:15:21 +00:00
|
|
|
[UI] private Label _label1 = null;
|
|
|
|
[UI] private Button _button1 = null;
|
2017-09-23 14:38:43 +00:00
|
|
|
|
|
|
|
private int _counter;
|
|
|
|
|
2017-10-26 17:49:21 +00:00
|
|
|
public MainWindow() : this(new Builder("MainWindow.glade")) { }
|
2017-09-23 14:38:43 +00:00
|
|
|
|
|
|
|
private MainWindow(Builder builder) : base(builder.GetObject("MainWindow").Handle)
|
|
|
|
{
|
|
|
|
builder.Autoconnect(this);
|
|
|
|
|
2017-11-02 21:13:53 +00:00
|
|
|
DeleteEvent += Window_DeleteEvent;
|
2017-09-23 14:38:43 +00:00
|
|
|
_button1.Clicked += Button1_Clicked;
|
|
|
|
}
|
|
|
|
|
2017-11-02 21:13:53 +00:00
|
|
|
private void Window_DeleteEvent(object sender, DeleteEventArgs a)
|
2017-09-23 14:38:43 +00:00
|
|
|
{
|
|
|
|
Application.Quit();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Button1_Clicked(object sender, EventArgs a)
|
|
|
|
{
|
|
|
|
_counter++;
|
|
|
|
_label1.Text = "Hello World! This button has been clicked " + _counter + " time(s).";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|