Exemplo n.º 1
0
        public async void LogEvent(Exception e)
        {
            try
            {
                if (e == null)
                {
                    return;
                }

                AppLog appLog = new AppLog();
                FireBaseOnlineStore fireBaseOnlineStore = new FireBaseOnlineStore(User);
                appLog.LogType    = "Exception";
                appLog.Message    = e.Message;
                appLog.Data       = e.ToString();
                appLog.Time       = DateTime.Now;
                appLog.DeviceType = DeviceInfo.DeviceType.ToString();
                appLog.Model      = DeviceInfo.Model;
                appLog.Platform   = DeviceInfo.Platform.ToString();
                appLog.Version    = DeviceInfo.VersionString;
                appLog.UserId     = User.Id;

                fireBaseOnlineStore.AddLog(appLog);
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 2
0
        private void OnPomodoroFinished()
        {
            if (ActiveTask.TaskStatistic == null)
            {
                ActiveTask.TaskStatistic = new FinishedTaskStatistic();
            }

            ActiveTask.TaskStatistic.Add(1);

            AlarmService.RunPomodoroFinishedAlarm();
            var taskStatistic = new TaskStatistic()
            {
                Id           = Guid.NewGuid(),
                UserId       = User.Id,
                TaskId       = ActiveTask.Id,
                FinishedTime = DateTime.Now,
                Duration     = PomodoroSettings.PomodoroDuration,
                TaskName     = ActiveTask.TaskName
            };

            CurrentSession.FinishedTaskInfo.Add(taskStatistic);


            StorageService.UpdateSessionInfo(CurrentSession);
            StorageService.UpdateUserTask(ActiveTask);

            UserTaskModifiedEvent?.Invoke(this, new UserTaskModifiedEventArgs()
            {
                UserTask = ActiveTask
            });

            try
            {
                FireBaseOnlineStore fireBaseOnlineStore = new FireBaseOnlineStore(User);
                fireBaseOnlineStore.AddTaskStatisticsAsync(taskStatistic);
            }
            catch (Exception)
            {
                throw;
            }
        }