File: CalendarApp.cs

package info (click to toggle)
gtk-sharp3 2.99.3-4.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 25,488 kB
  • sloc: xml: 308,885; cs: 38,796; sh: 11,336; perl: 1,295; makefile: 1,099; ansic: 903
file content (51 lines) | stat: -rwxr-xr-x 1,203 bytes parent folder | download | duplicates (15)
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
// CalendarApp.cs - Gtk.Calendar class Test implementation
//
// Author: Lee Mallabone <gnome@fonicmonkey.net>
//
// (c) 2003 Lee Mallabone

namespace GtkSamples {

	using Gtk;
	using System;

	public class CalendarApp  {

		public static Calendar CreateCalendar ()
		{
			Calendar cal = new Calendar();
			cal.DisplayOptions = CalendarDisplayOptions.ShowHeading    |
					     CalendarDisplayOptions.ShowDayNames   |
					     CalendarDisplayOptions.ShowWeekNumbers;
			return cal;
		}

		public static int Main (string[] args)
		{
			Application.Init ();
			Window win = new Window ("Calendar Tester");
			win.DefaultWidth = 200;
			win.DefaultHeight = 150;
			win.DeleteEvent += new DeleteEventHandler (Window_Delete);
			Calendar cal = CreateCalendar();
			cal.DaySelected += new EventHandler (DaySelected);
			win.Add (cal);
			win.ShowAll ();
			Application.Run ();
			return 0;
		}

		static void DaySelected (object obj, EventArgs args)
		{
			Calendar activatedCalendar = (Calendar) obj;
			Console.WriteLine (activatedCalendar.GetDate ().ToString ("yyyy/MM/dd"));
		}

		static void Window_Delete (object obj, DeleteEventArgs args)
		{
			Application.Quit ();
			args.RetVal = true;
		}

	}
}