Пример #1
0
        /// <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;

            Config config = new Config();

            config.GlobalEventParams["locale"]  = "ENU";
            config.GlobalEventParams["user_id"] = "92429d82a41e";

            Tapstream.Create("sdktest", "YGP2pezGTI6ec48uti4o1w", config);

            Tapstream tracker = Tapstream.Instance;
            var       op      = tracker.GetConversionDataAsync().AsTask <string>().ContinueWith((task) => {
                string jsonData = task.Result;
                if (jsonData == null)
                {
                    // No conversion data available
                }
                else
                {
                    JsonObject json = null;
                    if (JsonObject.TryParse(jsonData, out json))
                    {
                        // Read some data from this json object, and modify your application's behaviour accordingly
                        // ...
                    }
                }
            });

            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);
        }