public virtual async void Expose() { this.ActiveSessionLock = new object(); this.PauseLock = new object(); this.ActiveSession = this.ActiveSession ?? LiteMetricaCore.CreateSession(); this.ReportPackages = this.ReportPackages ?? new List <ReportPackage>(); this.CompletedSessions = this.CompletedSessions ?? new List <SessionModel>(); SessionModel sessionModel = this.ActiveSession; string str = this.ActiveSession.ReportParameters; if (str == null) { str = "".GlueGetList(await ServiceData.GetReportParameters(), true); } sessionModel.ReportParameters = str; #pragma warning disable IDE0059 // Ненужное присваивание значения sessionModel = (SessionModel)null; #pragma warning restore IDE0059 // Ненужное присваивание значения this.IsPaused = true; }
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); }