protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById<Button> (Resource.Id.myButton); button.Click += delegate { button.Text = string.Format ("{0} clicks!", count++); }; // replace with Redis server IP address. I found simulators // don't like localhost string host = "192.168.1.120"; Redis r = new Redis (host); // set some values in redis r.Set ("foo", "droid was here"); // subscribe to channel foo RedisSub rs = new RedisSub(r.Host, r.Port); RedisSubEventHandler eventHandler = new RedisSubEventHandler (MessageReceived); rs.MessageReceived += eventHandler; rs.SubscribeReceived += eventHandler; rs.UnsubscribeReceived += eventHandler; // subscribe to channel foo rs.Subscribe ("foo"); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // create a new window instance based on the screen size Window = new UIWindow (UIScreen.MainScreen.Bounds); // If you have defined a root view controller, set it here: // Window.RootViewController = myViewController; // make the window visible Window.MakeKeyAndVisible (); // replace with Redis server IP address. I found simulators // don't like localhost string host = "192.168.1.120"; Redis r = new Redis (host); // set some values in redis r.Set ("foo", "iOS was here"); // subscribe to channel foo RedisSub rs = new RedisSub(r.Host, r.Port); RedisSubEventHandler eventHandler = new RedisSubEventHandler (MessageReceived); rs.MessageReceived += eventHandler; rs.SubscribeReceived += eventHandler; rs.UnsubscribeReceived += eventHandler; // subscribe to channel foo rs.Subscribe ("foo"); return true; }