protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.activity_events); base.debugTextView = (EditText)FindViewById (Resource.Id.debug_output_field_events); selectEventButton = (Button)FindViewById (Resource.Id.select_event_button); sendEventButton = (Button)FindViewById (Resource.Id.send_event_button); EventHandler<DialogClickEventArgs> handler = (s, o) => { // save off selected event selectEventButton.Text = items [o.Which]; lastSelectedEvent = items [o.Which]; sendEventButton.Enabled = true; }; selectEventButton.Click += (sender, e) => { AlertDialog.Builder builder = new AlertDialog.Builder (this); builder.SetTitle ("Select Event"); builder.SetItems (items, handler); builder.Show(); }; // set up click listener for when event is sent sendEventButton.Click += (sender, e) => { tapjoyEvent = new TJEvent(this, lastSelectedEvent, null, eventCallback); tapjoyEvent.EnableAutoPresent(true); tapjoyEvent.Send(); }; }
public virtual void OnClick (View v) { if (v is Button) { Button button = ((Button)v); int id = button.Id; // -------------------------------------------------------------------------------- // Events // -------------------------------------------------------------------------------- if (id == Resource.Id.EventsButton) { Intent intent = new Intent (ApplicationContext, typeof(EventsActivity)); StartActivity (intent); } else if (id == Resource.Id.OffersButton) { // Disable button disableButton (button); if (isAppManaged ()) { log ("Method Called: showOffers"); TapjoyConnect.TapjoyConnectInstance.ShowOffers (offersNotifier); } else { log ("Method Called: showOffersWithCurrencyID \nCurrency ID: " + getActiveCurrency ()); TapjoyConnect.TapjoyConnectInstance.ShowOffersWithCurrencyID (getActiveCurrency (), false, offersNotifier); } } else if (id == Resource.Id.GetDirectPlayVideoAd) { // Disable button disableButton (button); // Shows a direct play video TJEvent directPlayEvent = new TJEvent (this, "video_unit", new CustomTJEventCallback (TAG, this)); // By default, ad content will be shown automatically on a successful send. For finer control of when content should be shown, call: directPlayEvent.EnableAutoPresent (false); directPlayEvent.Send (); } else if (id == Resource.Id.VirtualCurrencyButton) { Intent intent = new Intent (ApplicationContext, typeof(VirtualCurrencyActivity)); StartActivity (intent); } else { log (((Button)v).Text.ToString ()); } } }