Back to index

lightning-sunbird  0.9+nobinonly
sample-app.cs
Go to the documentation of this file.
00001 using System;
00002 using Mozilla.XPCOM;
00003 using Interfaces = Mozilla.XPCOM.Interfaces;
00004 
00005 
00006 public class Test
00007 {
00008     class TestCallback : Mozilla.XPCOM.Interfaces.testCallback
00009     {
00010         public void Call() {
00011             Console.WriteLine("Callback invoked!");
00012         }
00013     }
00014 
00015     public static void Main()
00016     {
00017         Interfaces.test myTest = (Interfaces.test)
00018             Components.CreateInstance("@off.net/test-component;1",
00019                                       typeof(Interfaces.test));
00020         Console.WriteLine("3 + 5 = {0}", myTest.Add(3, 5));
00021         int before = myTest.IntProp;
00022         myTest.IntProp = 99;
00023         Console.WriteLine("intProp: {0}, (= 99), {1}", before, myTest.IntProp);
00024         Console.WriteLine("roIntProp: {0}", myTest.RoIntProp);
00025         Console.WriteLine("Invoking callback:");
00026         TestCallback tcb = new TestCallback();
00027         myTest.Callback(tcb);
00028         Console.WriteLine("Done!");
00029     }
00030 }