示例#1
0
        public async void PopupRelaodCreditMonthly()
        {
            RelaodCreditMonthly hasBeenRead = null;

            if (!_saveDataService.Contains(App.NeedToDisplayReloadCreditMonthly))
            {
                hasBeenRead = new RelaodCreditMonthly()
                {
                    HasBeenRead = true, DateHasBeenReand = DateTime.Now
                };
                _saveDataService.SaveData(App.NeedToDisplayReloadCreditMonthly, JsonConvert.SerializeObject(hasBeenRead, new JsonSerializerSettings()
                {
                    DateFormatHandling   = DateFormatHandling.MicrosoftDateFormat,
                    DateParseHandling    = DateParseHandling.DateTime,
                    DateTimeZoneHandling = DateTimeZoneHandling.Local
                }));
            }
            else
            {
                var json = _saveDataService.GetData(App.NeedToDisplayReloadCreditMonthly);
                hasBeenRead = JsonConvert.DeserializeObject <RelaodCreditMonthly>(json, new JsonSerializerSettings()
                {
                    DateFormatHandling   = DateFormatHandling.MicrosoftDateFormat,
                    DateParseHandling    = DateParseHandling.DateTime,
                    DateTimeZoneHandling = DateTimeZoneHandling.Local
                });
            }

            int currentMonth = (DateTime.Now.Month == 1 && hasBeenRead.DateHasBeenReand.Month == 12 ? 13 : DateTime.Now.Month);

            if (DateTime.Now.Day >= 16 && DateTime.Now.Hour > 6 && currentMonth > hasBeenRead.DateHasBeenReand.Month)
            {
                if (App.CurrentUserEnvironment.LsSeekios?.Count > 0)
                {
                    await _dialogService.ShowPopupCredit(Resources.RelaodCreditMonthlyTitle
                                                         , Resources.RelaodCreditMonthlyContent);
                }
                hasBeenRead.DateHasBeenReand = DateTime.Now;
                _saveDataService.SaveData(App.NeedToDisplayReloadCreditMonthly, JsonConvert.SerializeObject(hasBeenRead, new JsonSerializerSettings()
                {
                    DateFormatHandling   = DateFormatHandling.MicrosoftDateFormat,
                    DateParseHandling    = DateParseHandling.DateTime,
                    DateTimeZoneHandling = DateTimeZoneHandling.Local
                }));
            }
        }