/// <summary>
        /// 觸發停止
        /// </summary>
        private async void ExecuteStopTimer()
        {
            string _upOrDown = null;

            _stopwatch.Stop();

            IsStart = true;
            IsStop  = false;

            if (SelectedUser != null)
            {
                //取得前一筆資料
                var lastData = await _divingLogService.GetUserLastDateAsync(SelectedUser.UserName);

                if (lastData != null)
                {
                    _upOrDown = (Timer > lastData.time) ? FontAwesomeIcons.ChevronCircleUp : FontAwesomeIcons.ChevronCircleDown;
                }

                //執行 Insert
                DivingLog itemDivingLog = new DivingLog()
                {
                    ID         = Guid.NewGuid(),
                    name       = SelectedUser.UserName,
                    time       = Timer,
                    createDate = DateTime.Now,
                    UpOrDown   = _upOrDown
                };

                //寫入資料;
                await _divingLogService.InsertAsync(itemDivingLog);
                await LoadValue();
            }
            else
            {
                await Application.Current.MainPage.DisplayAlert("注意", "請先選擇使用者", "OK");
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 更新資料
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns></returns>
 /// <exception cref="System.NotImplementedException"></exception>
 public async Task <bool> UpdateItemAsync(DivingLog item)
 {
     return(await _divingLogRepository.UpdateItemAsync(item));
 }
Exemplo n.º 3
0
 /// <summary>
 /// 新增單筆資料
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns></returns>
 /// <exception cref="System.NotImplementedException"></exception>
 public async Task <bool> InsertAsync(DivingLog item)
 {
     return(await _divingLogRepository.InsertAsync(item));
 }