コード例 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            btnDelegate.TouchUpInside += delegate {
                Console.WriteLine("tuneDelegate = " + tuneDelegate);
                Tune.RegisterDeeplinkListener(tuneDelegate);
            };

            btnDebug.TouchUpInside += delegate {
                Tune.SetDebugLogVerbose(true);
                Tune.SetDebugLogCallBack((message) => {
                    Console.WriteLine(message);
                });
            };

            btnSession.TouchUpInside += delegate {
                Tune.MeasureSession();
            };

            btnAction.TouchUpInside += delegate {
                Tune.MeasureEventName("eventAction1");

                TuneEvent evt = TuneEvent.EventWithName("eventAction2");
                evt.RefId = "ref1";
                Tune.MeasureEvent(evt);

                evt         = TuneEvent.EventWithName("eventAction3");
                evt.RefId   = "ref2";
                evt.Revenue = 1.99f;
                Tune.MeasureEvent(evt);

                evt       = TuneEvent.EventWithId(932851438);
                evt.RefId = "ref3";
                Tune.MeasureEvent(evt);

                evt              = TuneEvent.EventWithId(932851438);
                evt.RefId        = "ref4";
                evt.Revenue      = 1.99f;
                evt.CurrencyCode = "GBP";
                Tune.MeasureEvent(evt);
            };

            btnActionWithItems.TouchUpInside += delegate {
                TuneEventItem item1 = TuneEventItem.EventItemWithName("item1", 0.99f, 1, 0.99f, "1", "2", "3", "4", "5");
                TuneEventItem item2 = TuneEventItem.EventItemWithName("item2", 0.50f, 2, 1.0f);

                TuneEvent evt = TuneEvent.EventWithName("eventItems");
                evt.EventItems = new TuneEventItem[] { item1, item2 };
                Tune.MeasureEvent(evt);

                evt            = TuneEvent.EventWithName("eventItems");
                evt.EventItems = new TuneEventItem[] { item1, item2 };
                evt.RefId      = "ref5";
                evt.Attribute1 = "attr1";
                evt.Attribute2 = "attr2";
                evt.Attribute3 = "attr3";
                evt.Attribute4 = "attr4";
                evt.Attribute5 = "attr5";
                Tune.MeasureEvent(evt);

                evt                  = TuneEvent.EventWithName("eventItems");
                evt.EventItems       = new TuneEventItem[] { item1, item2 };
                evt.RefId            = "ref6";
                evt.Revenue          = 0.89f;
                evt.CurrencyCode     = "CAD";
                evt.TransactionState = 0;
                Tune.MeasureEvent(evt);

                evt            = TuneEvent.EventWithId(932851438);
                evt.EventItems = new TuneEventItem[] { item1, item2 };
                Tune.MeasureEvent(evt);

                evt            = TuneEvent.EventWithId(932851438);
                evt.EventItems = new TuneEventItem[] { item1, item2 };
                evt.RefId      = "ref7";
                Tune.MeasureEvent(evt);

                evt                  = TuneEvent.EventWithId(932851438);
                evt.EventItems       = new TuneEventItem[] { item1, item2 };
                evt.RefId            = "ref8";
                evt.Revenue          = 0.89f;
                evt.CurrencyCode     = "CAD";
                evt.TransactionState = 0;
                evt.ContentType      = "testContentType";
                evt.ContentId        = "123456789";
                evt.SearchString     = "testSearchString";
                Tune.MeasureEvent(evt);
            };

            btnActionWithReceipt.TouchUpInside += delegate {
                TuneEventItem item1 = TuneEventItem.EventItemWithName("item1", 0.99f, 1, 0.99f, "6", "7", "8", "9", "10");
                TuneEventItem item2 = TuneEventItem.EventItemWithName("item2", 0.50f, 2, 1.0f);

                TuneEvent evt = TuneEvent.EventWithName("eventReceipt");
                evt.EventItems       = new TuneEventItem[] { item1, item2 };
                evt.RefId            = "ref9";
                evt.Revenue          = 132.6f;
                evt.CurrencyCode     = "RUB";
                evt.TransactionState = 0;
                evt.Rating           = 4.5f;
                evt.Quantity         = 1;
                evt.Level            = 9;
                evt.Date1            = NSDate.Now;
                evt.Date2            = NSDate.FromTimeIntervalSinceNow(86400);
                evt.Receipt          = NSData.FromString(GetSampleiTunesIAPReceipt());
                Tune.MeasureEvent(evt);

                evt                  = TuneEvent.EventWithId(932851438);
                evt.EventItems       = new TuneEventItem[] { item1, item2 };
                evt.RefId            = "ref10";
                evt.Revenue          = 132.6f;
                evt.CurrencyCode     = "RUB";
                evt.TransactionState = 0;
                evt.Receipt          = NSData.FromString(GetSampleiTunesIAPReceipt());
                Tune.MeasureEvent(evt);
            };

            btnSetterMethods.TouchUpInside += delegate {
                Console.WriteLine("TUNE setter methods");

                Tune.SetUserId("tempUserId");
                Tune.SetJailbroken(false);

                Tune.SetExistingUser(false);
                Tune.SetPayingUser(false);
            };

            btnGetterMethods.TouchUpInside += delegate {
                Console.WriteLine("MatId        = " + Tune.TuneId);
                Console.WriteLine("OpenLogId    = " + Tune.OpenLogId);
                Console.WriteLine("IsPayingUser = " + Tune.IsPayingUser);
            };
        }