public async Task <DateTime?> CheckInOrOutAsync()
        {
            var client = new TTClient();

#if DEBUG
            var checkinDatetime = await this.doCheckInOrOutMockAsync();
#else
            var checkinDatetime = await client.DoCheckInOrOutAsync(SecurityService.getCredential().Item1, SecurityService.getCredential().Item2);
#endif

            if (checkinDatetime.HasValue)
            {
                var repository = new TTRepository();
                var check      = new TTCheck();
                check.UserName = SecurityService.getCredential().Item1;
                check.DateTime = checkinDatetime.Value;
                await Historic.Historic.AddAsync(check);
            }

            return(checkinDatetime);
        }
        public async Task<DateTime?> CheckInOrOutAsync()
        {
            var client = new TTClient();
                        
#if DEBUG
            var checkinDatetime = await this.doCheckInOrOutMockAsync();
#else
            var checkinDatetime = await client.DoCheckInOrOutAsync(SecurityService.getCredential().Item1, SecurityService.getCredential().Item2);
#endif

            if (checkinDatetime.HasValue)
            {
                var repository = new TTRepository();
                var check = new TTCheck();
                check.UserName = SecurityService.getCredential().Item1;
                check.DateTime = checkinDatetime.Value;
                await Historic.Historic.AddAsync(check);
            }

            return checkinDatetime;
        }
        public SyncDate()
        {
            OnPropertyChanged("Value");

            var service = new TTClient();

            timer.Interval = TimeSpan.FromSeconds(1);

            timer.Tick += (s, e) =>
            {
                OnPropertyChanged("Value");
            };

            timer.Start();

            service.RemoteDatetimeAsync().ContinueWith(t =>
            {
                if (t.IsCompleted)
                {
                    gap = t.Result.Subtract(DateTime.Now).Ticks;
                }
            });
        }