Beispiel #1
0
        public MainPage()
        {
            Location = new YandexMetrica.Location();
            InitializeComponent();

            Loaded   += (sender, args) => YandexMetrica.ReportEvent("Hello!");
            Unloaded += (sender, args) => YandexMetrica.ReportEvent("Bye!");

            LocationButton.Click += (sender, args) => YandexMetricaConfig.SetCustomLocation(Location);
            EventButton.Click    += (sender, args) => YandexMetrica.ReportEvent(EventNameTextBox.Text);
            CrashButton.Click    += (sender, args) => { throw new Exception(); };
            ErrorButton.Click    += (sender, args) =>
            {
                try
                {
                    throw new ArgumentException("Throw exception and catch it");
                }
                catch (Exception exception)
                {
                    YandexMetrica.ReportError(ErrorNameTextBox.Text, exception);
                }
            };

            ResetButton.Click += (sender, args) =>
            {
                YandexMetricaConfig.OfflineMode      = false;
                YandexMetricaConfig.CrashTracking    = true;
                YandexMetricaConfig.LocationTracking = true;
                YandexMetricaConfig.CustomAppVersion = null;
                YandexMetricaConfig.SetCustomLocation(null);
            };

            JsonButton.Click += (sender, args) => YandexMetrica.ReportEvent("abc", JsonData.GetObject());
            JsonButton.Click += (sender, args) => YandexMetrica.ReportEvent("abc", JsonData.GetDictionary());
        }