public static async void AttachNetworkInfoAsync(this ReportMessage.Session.Event item) { await ServiceData.WaitExposeAsync(); ReportMessage.Session.Event @event = item; ReportMessage.Session.Event.NetworkInfo networkInfo = await TaskEx.FromResult <ReportMessage.Session.Event.NetworkInfo>(ServiceData.NetworkTracker.Provide()); @event.network_info = networkInfo; #pragma warning disable IDE0059 // Ненужное присваивание значения @event = (ReportMessage.Session.Event)null; #pragma warning restore IDE0059 // Ненужное присваивание значения }
private static void Report(ReportMessage.Session.Event item) { if (YandexMetrica.InternalConfig.ApiKey == Guid.Empty) { throw new ArgumentException("ApiKey is empty"); } if (YandexMetrica._liteMetricaService == null) { lock (YandexMetrica.CacheLock) { if (YandexMetrica._liteMetricaService != null) { return; } YandexMetrica.Cache.Add(item); } } else { YandexMetrica._liteMetricaService.Report(item); } }
private SessionModel StartSession(bool isFirstSession = false) { SessionModel activeSession; lock (this.ActiveSessionLock) { this.EnsureActiveSessionFinished(); if (this.ActiveSession != null && this.ActiveSession.EventCounter > 0UL) { lock (this.CompletedSessions) this.CompletedSessions.Add(this.ActiveSession); } this.ActiveSession = LiteMetricaCore.CreateSession(); ReportMessage.Session.Event[] eventArray; if (!isFirstSession) { eventArray = new ReportMessage.Session.Event[1] { EventFactory.Create(ReportMessage.Session.Event.EventType.EVENT_START, (byte[])null, (string)null, (string)null) } } ; else { eventArray = new ReportMessage.Session.Event[3] { EventFactory.Create(ReportMessage.Session.Event.EventType.EVENT_FIRST, (byte[])null, (string)null, (string)null), EventFactory.Create(ReportMessage.Session.Event.EventType.EVENT_START, (byte[])null, (string)null, (string)null), EventFactory.Create(Config.Global.HandleFirstActivationAsUpdate ? ReportMessage.Session.Event.EventType.EVENT_UPDATE : ReportMessage.Session.Event.EventType.EVENT_INIT, (byte[])null, (string)null, (string)null) } }; this.Report(eventArray); Config.Global.LastWakeTime = new DateTime?(DateTime.UtcNow); activeSession = this.ActiveSession; } this.TriggerForcedSend(); return(activeSession); }