Пример #1
0
        private void TrackingCheck_Checked(object sender, System.Windows.RoutedEventArgs e)
        {
            if (initialized)
            {
                string ServerUrl = null;
                string AppKey    = null;

                if (ServerUrl == null)
                {
                    throw new ArgumentNullException("Type your ServerUrl");
                }
                if (AppKey == null)
                {
                    throw new ArgumentNullException("Type your AppKey");
                }

                Countly.StartSession(ServerUrl, AppKey);

                // Countly.StartSession("http://YOUR_SERVER", "YOUR_APP_KEY");

                RecordBasicEvent.IsEnabled        = true;
                RecordEventSum.IsEnabled          = true;
                RecordEventSegmentation.IsEnabled = true;
            }
        }
Пример #2
0
        private async void TrackingCheck_Checked(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            if (initialized)
            {
                string ServerUrl = "http://try.count.ly";
                string AppKey    = null;

                if (ServerUrl == null)
                {
                    throw new ArgumentNullException("Type your ServerUrl");
                }
                if (AppKey == null)
                {
                    throw new ArgumentNullException("Type your AppKey");
                }

                await Countly.StartSession(ServerUrl, AppKey, "1.0", FileSystem.Current);

                RecordBasicEvent.IsEnabled        = true;
                RecordEventSum.IsEnabled          = true;
                RecordEventSegmentation.IsEnabled = true;
                UserNameText.IsEnabled            = true;
                UploadUserPictureButton.IsEnabled = true;
                CrashButton.IsEnabled             = true;
            }
        }
Пример #3
0
        private void TrackingCheck_Checked(object sender, System.Windows.RoutedEventArgs e)
        {
            if (initialized)
            {
                string ServerUrl = "https://cloud.count.ly";
                string AppKey    = null;

                if (ServerUrl == null)
                {
                    throw new ArgumentNullException("Type your ServerUrl");
                }
                if (AppKey == null)
                {
                    throw new ArgumentNullException("Type your AppKey");
                }

                Countly.StartSession(ServerUrl, AppKey);

                RecordBasicEvent.IsEnabled        = true;
                RecordEventSum.IsEnabled          = true;
                RecordEventSegmentation.IsEnabled = true;
                UserNameText.IsEnabled            = true;
                UploadUserPictureButton.IsEnabled = true;
                CrashButton.IsEnabled             = true;
            }
        }
Пример #4
0
        public async Task SendException()
        {
            Countly.UserDetails.Name = UserName;
            await Countly.StartSession(Server, ApiKey);

            await Countly.RecordException("Oh no!", "this is a trace\nmorelines\n");

            await Countly.EndSession();
        }
Пример #5
0
        public async Task StartCountly()
        {
            Debug.WriteLine("Initializing Countly");
            Countly.IsLoggingEnabled = true;
            await Countly.StartSession(serverURL, appKey, "1.234", Countly.DeviceIdMethod.multipleFields);

            Countly.RecordEvent("SomeKey");
            Thread.Sleep(2000);
        }
Пример #6
0
 private void Start_Session_Button_Click(object sender, RoutedEventArgs e)
 {
     if (ApiKeyBox.Text == "" || ApiKeyBox.Text == "Enter API Key")
     {
         MessageBox.Show("Please enter an API Key.");
     }
     else
     {
         Countly.StartSession("http://cloud.count.ly", ApiKeyBox.Text);
     }
 }
Пример #7
0
 public void TestMethod1()
 {
     try
     {
         Countly.StartSession("http://cloud.count.ly", "87e43ddcc40b5cd0d4ac857a71d250e1750847f0");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Пример #8
0
        public async Task RecordEvent()
        {
            Countly.UserDetails.Name = UserName;
            await Countly.StartSession(Server, ApiKey);

            var segmentation = new Segmentation();

            segmentation.Add("test", new Random().Next(10).ToString());
            Countly.RecordEvent("unit-test", 1, 0, 123.5, segmentation);

            await Countly.EndSession();
        }
Пример #9
0
        public async Task SendAction()
        {
            Countly.UserDetails.Name = UserName;
            await Countly.StartSession(Server, ApiKey);

            Countly.RecordView("ScreenA", MakeSegment());

            var segmentation = MakeSegment();

            segmentation.Add("type", "click");
            segmentation.Add("x", "0");
            segmentation.Add("y", "0");
            segmentation.Add("width", "0");
            segmentation.Add("height", "0");
            Countly.RecordEvent("[CLY]_action", segmentation: segmentation);

            await Countly.EndSession();
        }
Пример #10
0
        private async void Activated()
        {
            Countly.IsLoggingEnabled = true;

            string ServerUrl = "http://try.count.ly";
            string AppKey    = null;

            if (ServerUrl == null)
            {
                throw new ArgumentNullException("Type your ServerUrl");
            }
            if (AppKey == null)
            {
                throw new ArgumentNullException("Type your AppKey");
            }

            await Countly.StartSession(ServerUrl, AppKey, "1.0", FileSystem.Current);
        }
Пример #11
0
        private void Activated()
        {
            Countly.IsLoggingEnabled           = true;
            Countly.IsExceptionsLoggingEnabled = true;

            string ServerUrl = "http://cloud.count.ly";
            string AppKey    = null;

            if (ServerUrl == null)
            {
                throw new ArgumentNullException("Type your ServerUrl");
            }
            if (AppKey == null)
            {
                throw new ArgumentNullException("Type your AppKey");
            }

            Countly.StartSession(ServerUrl, AppKey, this);
        }
Пример #12
0
        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
            Countly.IsLoggingEnabled           = true;
            Countly.IsExceptionsLoggingEnabled = true;

            string ServerUrl = "https://cloud.count.ly";
            string AppKey    = null;

            if (ServerUrl == null)
            {
                throw new ArgumentNullException("Type your ServerUrl");
            }
            if (AppKey == null)
            {
                throw new ArgumentNullException("Type your AppKey");
            }

            Countly.StartSession(ServerUrl, AppKey, this);
        }
Пример #13
0
        // Code to execute when the application is activated (brought to foreground)
        // This code will not execute when the application is first launched
        private void Application_Activated(object sender, ActivatedEventArgs e)
        {
            Countly.IsLoggingEnabled = true;

            string ServerUrl = null;
            string AppKey    = null;

            if (ServerUrl == null)
            {
                throw new ArgumentNullException("Type your ServerUrl");
            }
            if (AppKey == null)
            {
                throw new ArgumentNullException("Type your AppKey");
            }

            Countly.StartSession(ServerUrl, AppKey);

            // Countly.StartSession("http://YOUR_SERVER", "YOUR_APP_KEY");
        }
Пример #14
0
        private async void Launched()
        {
            Countly.IsLoggingEnabled = true;

            string ServerUrl = "SERVER_URL";
            string AppKey    = "API_KEY";

            if (ServerUrl == null)
            {
                throw new ArgumentNullException("Type your ServerUrl");
            }
            if (AppKey == null)
            {
                throw new ArgumentNullException("Type your AppKey");
            }

            await Countly.StartSession(ServerUrl, AppKey, "1.0", FileSystem.Current);

            Countly.RecordEvent("SDFDSFDSFSDF");
            Countly.RecordEvent("4345345345");
        }
Пример #15
0
        public async Task ChangeMyTeamAndLevel()
        {
            Countly.UserDetails.Name = UserName;
            await Countly.StartSession(Server, ApiKey);

            Countly.RecordView("ScreenA", MakeSegment());
            await Task.Delay(1000);

            Countly.RecordView("ScreenB", MakeSegment());
            await Task.Delay(1000);

            Countly.RecordView("ScreenC", MakeSegment());
            await Task.Delay(1000);

            Countly.RecordView("ScreenD", MakeSegment());
            Countly.RecordView("ScreenE", MakeSegment());

            Countly.UserDetails.Custom["Level"] = "3";
            Countly.UserDetails.Custom["Team"]  = "Warriors";
            await Countly.EndSession();
        }
Пример #16
0
        public async Task SendViews()
        {
            Countly.UserDetails.Name            = UserName;
            Countly.UserDetails.Custom["Level"] = "1";
            Countly.UserDetails.Custom["Team"]  = "Warriors";
            await Countly.StartSession(Server, ApiKey);

            Countly.RecordView("ScreenA", MakeSegment());
            await Task.Delay(3500);

            Countly.RecordView("ScreenB", MakeSegment());
            await Task.Delay(1242);

            Countly.RecordView("ScreenC", MakeSegment());
            await Task.Delay(2322);

            Countly.RecordView("ScreenD", MakeSegment());
            Countly.RecordView("ScreenE", MakeSegment());

            await Countly.EndSession();
        }
Пример #17
0
        public async Task SendBunchOfEvents()
        {
            Countly.UserDetails.Name = UserName;
            await Countly.StartSession(Server, ApiKey);

            Countly.RecordEvent("ActionA", segmentation: MakeSegment());
            await Task.Delay(25);

            Countly.RecordEvent("ActionB", segmentation: MakeSegment());
            await Task.Delay(25);

            Countly.RecordEvent("ActionC", segmentation: MakeSegment());
            await Task.Delay(2100);

            Countly.RecordEvent("ActionD", segmentation: MakeSegment());
            await Task.Delay(25);

            Countly.RecordEvent("ActionE", segmentation: MakeSegment());
            await Task.Delay(1000);

            await Countly.EndSession();
        }
Пример #18
0
        public async Task LongTestForSessions()
        {
            var random = new Random();

            Countly.UserDetails.Name = UserName;
            await Countly.StartSession(Server, ApiKey);

            for (int i = 0; i < 200; i++)
            {
                if (random.Next(2) == 0)
                {
                    Countly.RecordEvent("Action" + i, segmentation: MakeSegment());
                }
                else
                {
                    Countly.RecordView("Screen" + i, MakeSegment());
                }

                await Task.Delay(1000);
            }

            await Countly.EndSession();
        }
Пример #19
0
        public async Task SendViewsWithStartEnd()
        {
            Countly.UserDetails.Name = UserName;
            await Countly.StartSession(Server, ApiKey);

            Countly.RecordView("ScreenA", MakeSegment());
            await Task.Delay(3500);

            Countly.RecordView("ScreenB", MakeSegment());
            await Countly.EndSession();

            //Should still be on ScreenB
            await Countly.StartSession(Server, ApiKey);

            await Task.Delay(1242);

            Countly.RecordView("ScreenC", MakeSegment());
            await Task.Delay(2322);

            Countly.RecordView("ScreenD", MakeSegment());

            await Countly.EndSession();
        }
Пример #20
0
 private void btnBeginSession_Click(object sender, EventArgs e)
 {
     Countly.StartSession(serverURL, appKey, "1.234");
 }
Пример #21
0
        public async Task Run()
        {
            Console.WriteLine("Hello to the Countly sample console program");

            if (serverURL == null || appKey == null)
            {
                Console.WriteLine("");
                Console.WriteLine("Problem encountered, you have not set up either the serverURL or the appKey");
                Console.ReadKey();
                return;
            }

            Countly.IsLoggingEnabled = true;
            //Countly.SetCustomDataPath(@"D:\123z\");//usable only when targeting .net3.5
            //Countly.SetCustomDataPath(null);

            //Countly.deferUpload = true;//this call is only available by allowing access to internal members to this project, should not be used
            await Countly.StartSession(serverURL, appKey, "1.234", Countly.DeviceIdMethod.multipleFields);

            Console.WriteLine("DeviceID: " + await Countly.GetDeviceId());

            System.Console.WriteLine("DeviceID: " + await Countly.GetDeviceId());

            while (true)
            {
                Console.WriteLine("");
                Console.WriteLine("Choose your option:");
                Console.WriteLine("1) Sample event");
                Console.WriteLine("2) Sample caught exception");
                Console.WriteLine("3) Change deviceID to a random value (create new user)");
                Console.WriteLine("4) Change the name of the current user");
                Console.WriteLine("5) Exit");
                Console.WriteLine("6) Another caught Exception");
                Console.WriteLine("7) Test");

                if (enableDebugOpptions)
                {
                    Console.WriteLine("8) (debug) Threading test");
                }


                ConsoleKeyInfo cki = System.Console.ReadKey();
                Console.WriteLine("");

                if (cki.Key == ConsoleKey.D1)
                {
                    System.Console.WriteLine("1");
                    Countly.RecordEvent("Some event");
                }
                else if (cki.Key == ConsoleKey.D2)
                {
                    Console.WriteLine("2");

                    try
                    {
                        throw new Exception("This is some bad exception 3");
                    }
                    catch (Exception ex)
                    {
                        Dictionary <string, string> customInfo = new Dictionary <string, string>();
                        customInfo.Add("customData", "importantStuff");
                        Countly.RecordException(ex.Message, ex.StackTrace, customInfo);
                    }
                }
                else if (cki.Key == ConsoleKey.D3)
                {
                    Console.WriteLine("3");
                    //await Device.SetDeviceId("ID-" + (new Random()).Next());
                }
                else if (cki.Key == ConsoleKey.D4)
                {
                    Console.WriteLine("4");
                    Countly.UserDetails.Name = "Some Username " + (new Random()).Next();
                }
                else if (cki.Key == ConsoleKey.D5)
                {
                    Console.WriteLine("5");
                    break;
                }
                else if (cki.Key == ConsoleKey.D6)
                {
                    Console.WriteLine("6");
                    Countly.RecordException("What is here", "");
                }
                else if (cki.Key == ConsoleKey.D7)
                {
                    Console.WriteLine("7");
                }
                else if (enableDebugOpptions && cki.Key == ConsoleKey.D8)
                {
                    Console.WriteLine("8");
                    Console.WriteLine("Running threaded debug test");
                    ThreadTest();
                }
                else
                {
                    Console.WriteLine("Wrong input, please try again.");
                }
            }
            ;

            await Countly.EndSession();
        }
Пример #22
0
        public void Run()
        {
            Console.WriteLine("Hello to the Countly sample console program");
            Console.WriteLine("DeviceID: " + Device.DeviceId);

            if (serverURL == null || appKey == null)
            {
                Console.WriteLine("");
                Console.WriteLine("Problem encountered, you have not set up either the serverURL or the appKey");
                Console.ReadKey();
                return;
            }

            Countly.IsLoggingEnabled = true;
            //Countly.SetCustomDataPath(@"D:\123z\");//usable only when targeting .net3.5
            //Countly.SetCustomDataPath(null);
            Countly.StartSession(serverURL, appKey, "1.234");

            System.Console.WriteLine("DeviceID: " + Device.DeviceId);

            while (true)
            {
                Console.WriteLine("");
                Console.WriteLine("Choose your option:");
                Console.WriteLine("1) Sample event");
                Console.WriteLine("2) Sample caught exception");
                Console.WriteLine("3) Change deviceID to a random value (create new user)");
                Console.WriteLine("4) Change the name of the current user");
                Console.WriteLine("5) Exit");

                if (enableDebugOpptions)
                {
                    Console.WriteLine("8) (debug) Threading test");
                }


                ConsoleKeyInfo cki = System.Console.ReadKey();
                Console.WriteLine("");

                if (cki.Key == ConsoleKey.D1)
                {
                    System.Console.WriteLine("1");
                    Countly.RecordEvent("Some event");
                }
                else if (cki.Key == ConsoleKey.D2)
                {
                    Console.WriteLine("2");

                    try
                    {
                        throw new Exception("This is some bad exception 3");
                    }
                    catch (Exception ex)
                    {
                        Countly.RecordException(ex.Message, ex.StackTrace);
                    }
                }
                else if (cki.Key == ConsoleKey.D3)
                {
                    Console.WriteLine("3");
                    Device.DeviceId = "ID-" + (new Random()).Next();
                }
                else if (cki.Key == ConsoleKey.D4)
                {
                    Console.WriteLine("4");
                    Countly.UserDetails.Name = "Some Username " + (new Random()).Next();
                }
                else if (cki.Key == ConsoleKey.D5)
                {
                    Console.WriteLine("5");
                    break;
                }
                else if (enableDebugOpptions && cki.Key == ConsoleKey.D8)
                {
                    Console.WriteLine("8");
                    Console.WriteLine("Running threaded debug test");
                    ThreadTest();
                }
                else
                {
                    Console.WriteLine("Wrong input, please try again.");
                }
            }
            ;

            Countly.EndSession();
        }
Пример #23
0
 public static async Task StartLegacyCountlySession(string serverUrl, string appKey, string appVersion)
 {
     await Countly.StartSession(serverUrl, appKey, appVersion);
 }
Пример #24
0
        public async Task Run()
        {
            Console.WriteLine("Hello to the Countly sample console program");
            Console.WriteLine("DeviceID: " + await Countly.GetDeviceId());

            if (serverURL == null || appKey == null)
            {
                Console.WriteLine("");
                Console.WriteLine("Problem encountered, you have not set up either the serverURL or the appKey");
                Console.ReadKey();
                return;
            }

            Countly.IsLoggingEnabled = true;

            //Countly.deferUpload = true;
            await Countly.StartSession(serverURL, appKey, "1.234", FileSystem.Current);

            System.Console.WriteLine("DeviceID: " + await Countly.GetDeviceId());

            while (true)
            {
                Console.WriteLine("");
                Console.WriteLine("Choose your option:");
                Console.WriteLine("1) Sample event");
                Console.WriteLine("2) Sample caught exception");
                Console.WriteLine("3) Change deviceID to a random value (create new user)");
                Console.WriteLine("4) Change the name of the current user");
                Console.WriteLine("5) Exit");
                Console.WriteLine("6) Another caught Exception");
                Console.WriteLine("7) Sample event without await");

                if (enableDebugOpptions)
                {
                    Console.WriteLine("8) (debug) Threading test");
                }


                ConsoleKeyInfo cki = System.Console.ReadKey();
                Console.WriteLine("");

                if (cki.Key == ConsoleKey.D1)
                {
                    System.Console.WriteLine("1");
                    await Countly.RecordEvent("Some event");
                }
                else if (cki.Key == ConsoleKey.D2)
                {
                    Console.WriteLine("2");

                    try
                    {
                        throw new Exception("This is some bad exception 3");
                    }
                    catch (Exception ex)
                    {
                        Dictionary <string, string> customInfo = new Dictionary <string, string>();
                        customInfo.Add("customData", "importantStuff");
                        await Countly.RecordException(ex.Message, ex.StackTrace, customInfo);
                    }

                    Exception exToUse;
                    try
                    {
                        throw new Exception("This is some bad exception 35454");
                    }
                    catch (Exception ex)
                    {
                        exToUse = ex;
                    }

                    Dictionary <String, String> dict = new Dictionary <string, string>();
                    dict.Add("booh", "waah");

                    await Countly.RecordException("Big error 1");

                    await Countly.RecordException(exToUse.Message, exToUse.StackTrace);

                    await Countly.RecordException(exToUse.Message, exToUse.StackTrace, dict);

                    await Countly.RecordException(exToUse.Message, exToUse.StackTrace, dict, false);
                }
                else if (cki.Key == ConsoleKey.D3)
                {
                    Console.WriteLine("3");
                    //await Device.SetDeviceId("ID-" + (new Random()).Next());
                }
                else if (cki.Key == ConsoleKey.D4)
                {
                    Console.WriteLine("4");
                    Countly.UserDetails.Name = "Some Username " + (new Random()).Next();
                }
                else if (cki.Key == ConsoleKey.D5)
                {
                    Console.WriteLine("5");
                    break;
                }
                else if (cki.Key == ConsoleKey.D6)
                {
                    Console.WriteLine("6");
                    await Countly.RecordException("What is here", "");
                }
                else if (cki.Key == ConsoleKey.D7)
                {
                    Console.WriteLine("7");
                    Countly.RecordEvent("Some event");
                }
                else if (enableDebugOpptions && cki.Key == ConsoleKey.D8)
                {
                    Console.WriteLine("8");
                    Console.WriteLine("Running threaded debug test");
                    ThreadTest();
                }
                else
                {
                    Console.WriteLine("Wrong input, please try again.");
                }
            }
            ;

            await Countly.EndSession();
        }