/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; Tapstream.Create("sdktest", "YGP2pezGTI6ec48uti4o1w"); Tapstream tracker = Tapstream.Instance; Event e = new Event("test-event", false); e.AddPair("player", "John Doe"); e.AddPair("score", 5); tracker.FireEvent(e); e = new Event("test-event-oto", true); tracker.FireEvent(e); Hit h = new Hit("test-tracker"); h.AddTag("tag1"); h.AddTag("tag2"); Task.Run(async () => { Response response = await tracker.FireHitAsync(h); if (response.Status >= 200 && response.Status < 300) { // Success } else { // Error } }); }
public IAsyncOperation<Response> FireHitAsync(Hit h) { string url = String.Format(HIT_URL_TEMPLATE, accountName, h.EncodedTrackerName); string data = h.PostData; return Task<Response>.Run(() => { #endif Response response = platform.Request(url, data); if(response.Status < 200 || response.Status >= 300) { Logging.Log(LogLevel.ERROR, "Tapstream Error: Failed to fire hit, http code: {0}", response.Status); listener.ReportOperation("hit-failed"); } else { Logging.Log(LogLevel.INFO, "Fired hit to tracker: {0}", h.TrackerName); listener.ReportOperation("hit-succeeded"); } #if WINDOWS_PHONE if(completion != null) { completion(response); } }), TimeSpan.FromSeconds(0)); #else return response; }).AsAsyncOperation<Response>();
public void FireHit(Hit h, Hit.Complete completion) { string url = String.Format(HIT_URL_TEMPLATE, accountName, h.EncodedTrackerName); string data = h.PostData; scheduler.Schedule(new Action(() => {
public void FireHit(Hit h, Hit.Complete completion) { core.FireHit(h, completion); }
public IAsyncOperation <Response> FireHitAsync(Hit h) { return(core.FireHitAsync(h)); }
public IAsyncOperation<Response> FireHitAsync(Hit h) { return core.FireHitAsync(h); }