using System;
using GLib;
using Gtk;
using Hildon;
namespace HildonSamples {
public class BannerExample : Hildon.Window
{
private static Hildon.Banner banner = null;
private static int banner_type = 1;
public BannerExample() :base ()
{
this.Destroyed += delegate {Application.Quit ();};
this.Title = "BannerExample";
this.BorderWidth = 6;
Gtk.VBox vbox_main = new VBox (false,0);
Gtk.Button btn = new Button ("Show Info");
btn.Clicked += new EventHandler (show_banner);
vbox_main.PackStart (btn);
this.Add (vbox_main);
this.ShowAll();
}
protected void show_banner(object source,EventArgs e)
{
switch (banner_type) {
case 1:
/* Show normal information banner and this automatically goes away */
Banner.ShowInformation(this, null, "Hi there!");
break;
case 2:
/* Informaton banner with animation icon. This banner does not automatically disapear. */
banner = (Hildon.Banner) Banner.ShowAnimation(this, null, "This is animation icon");
break;
case 3:
/* Remove current information banner */
banner.Destroy();
break;
case 4:
/* Information banner with progressbar */
banner = (Hildon.Banner) Banner.ShowProgress (this, null, "Info with progress bar");
/* Set bar to be 20% full */
banner.Fraction = (double)0.2;
break;
case 5:
/* Set bar to be 80% full */
banner.Fraction = (double)0.8;
break;
case 6:
/* With sixth click, end the application */
Application.Quit();
break;
}
/* Increase the counter */
banner_type++;
}
public static void Main (string[] args)
{
Application.Init ("mono",ref args);
Hildon.Program prog = Hildon.Program.Instance;
prog.AddWindow ( new BannerExample ());
Application.Run();
}
}
}