Back to index

libindicate  12.10.0
IndicatorMonoExample.cs
Go to the documentation of this file.
00001 using System;
00002 using Indicate;
00003 using Gtk;
00004 using GLib;
00005 
00006 namespace IndicatorExample
00007 {
00008        class MainClass
00009        {
00010               public static void Main(string[] args)
00011               {
00012                      Application.Init ();
00013                      Indicate.Server server = Indicate.Server.RefDefault();
00014                      server.SetType("message.im");
00015                      server.DesktopFile("/usr/share/applications/empathy.desktop");
00016                      server.ServerDisplay += new Indicate.ServerDisplayHandler(ServerDisplay);
00017                      server.Show();
00018 
00019                      Indicator indicator = new Indicate.Indicator();
00020                      indicator.SetProperty("subtype", "im");
00021                      indicator.SetProperty("sender", "Barney Rubble");
00022                      indicator.UserDisplay += new EventHandler(UserDisplay);
00023                      indicator.Show();
00024 
00025                      Application.Run ();
00026               }
00027               
00028               public static void ServerDisplay (object sender, Indicate.ServerDisplayArgs args)
00029               {
00030                      Console.WriteLine ("Server was displayed");
00031               }
00032               
00033               public static void UserDisplay (object sender, System.EventArgs args)
00034               {
00035                      Console.WriteLine ("Indicator was displayed");
00036                      Indicate.Indicator indicator = sender as Indicate.Indicator;
00037                      indicator.Hide();
00038               }
00039        }
00040 }