private static void ActivateInternal(Guid apiKey)
        {
            try
            {
                LegacyManager.CompleteMigration().RunSynchronously();
            }
            catch (Exception)
            {
            }
            YandexMetrica.MigrateApiKeys();
            LiteMetricaService liteMetricaService = Store.Get <LiteMetricaService>();

            if (((IEnumerable <Guid>)Critical.GetApiKeys()).Contains <Guid>(apiKey))
            {
                liteMetricaService.Wake(false, true);
            }
            else
            {
                Critical.AddApiKey(apiKey);
                liteMetricaService.Wake(true, true);
                Critical.Submit();
            }
            lock (YandexMetrica.CacheLock)
            {
                liteMetricaService.Report(YandexMetrica.Cache.ToArray());
                YandexMetrica.Cache.Clear();
                YandexMetrica._liteMetricaService = liteMetricaService;
            }
            liteMetricaService.ForceSend = true;
        }
 public static void ReportLaunchUri(Uri uri)
 {
     if (uri == (Uri)null || string.IsNullOrEmpty(uri.AbsoluteUri))
     {
         return;
     }
     YandexMetrica.Report(EventFactory.Create(ReportMessage.Session.Event.EventType.EVENT_OPEN, "{\"link\":" + uri.ToJson((System.Type)null) + ",\"type\":\"open\"}", (string)null));
 }
 public static void Activate(Guid apiKey)
 {
     YandexMetrica.InternalConfig.ApiKey = apiKey;
     Task.Factory.StartNew((Action)(() =>
     {
         lock (YandexMetrica.ActivationLock)
             YandexMetrica.ActivateInternal(apiKey);
     }));
 }
        internal static void ReportInternalEvent(
            int type,
            string name,
            string value,
            Dictionary <string, object> environment)
        {
            if (type >= 1 && type <= 99 && (type != 14 && type != 15))
            {
                return;
            }
            byte[] numArray     = value == null ? (byte[])null : Encoding.UTF8.GetBytes(value);
            string environment1 = environment != null?environment.ToJson(JsonProfile.GetCompact(), (System.Type) null, 1) : (string)null;

            YandexMetrica.Report(EventFactory.Create((ReportMessage.Session.Event.EventType)type, numArray, name, environment1));
        }
 public static void Activate(string apiKey)
 {
     YandexMetrica.Activate(new Guid(apiKey));
 }
 public static void ReportError(string message, Exception exсeption)
 {
     YandexMetrica.Report(EventFactory.Create(ReportMessage.Session.Event.EventType.EVENT_ERROR, exсeption.ToString(), message));
 }
 public static void ReportUnhandledException(Exception exсeption)
 {
     YandexMetrica.Report(EventFactory.Create(ReportMessage.Session.Event.EventType.EVENT_CRASH, exсeption.ToString(), (string)null));
 }
 public static void ReportEvent <TItem>(string eventName, TItem serializableItem)
 {
     YandexMetrica.Report(EventFactory.Create <TItem>(eventName, serializableItem));
 }
 public static void ReportEvent(string eventName, string jsonData)
 {
     YandexMetrica.Report(EventFactory.Create(eventName, jsonData));
 }
Beispiel #10
0
 public static void ReportEvent(string eventName)
 {
     YandexMetrica.Report(EventFactory.Create(eventName, (string)null));
 }