private void ResetRC()
        {
            DateTime now   = DateTime.Now;
            int      count = RCEnv.MaxRC / RCEnv.RCRate;

            count += ((RCEnv.MaxRC % RCEnv.RCRate) == 0) ? 0 : 1;

            RCEnv.LastInputTime = now.ToString(AppEnv.DTCulture);

#if TEST
            RCEnv.EndTime = now.AddMinutes(count);
#else
            RCEnv.EndTime = now.AddHours(count);
#endif

            RCEnv.Currency = 0;
            RCEnv.AddCount = 0;

            RCEnv.SaveValue();

            if (Preferences.Get(SettingConstants.NOTI_ENABLED, false))
            {
                new RealmCurrencyNotiManager().UpdateNotisTime();
            }
        }
        protected override void OnDisappearing()
        {
            base.OnDisappearing();

            _calcTimer.Change(Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan);
            _calcTimer.Dispose();

            RCEnv.SaveValue();
        }
        internal override void ApplyValue()
        {
            base.ApplyValue();

            if (int.TryParse(SfUpDown.Text, out int inputValue))
            {
                RCEnv.LastInputTime = DateTime.Now.ToString(AppEnv.DTCulture);
                RCEnv.Currency      = inputValue; //Convert.ToInt32((double)SfUpDown.Value);
                RCEnv.AddCount      = 0;

                RCEnv.CalcEndTime();
                RCEnv.CalcRC();
                RCEnv.SaveValue();

                notiManager.UpdateNotisTime();
                notiManager.UpdateScheduledNoti <RealmCurrencyNoti>();
            }
            else
            {
                DependencyService.Get <IToast>().Show(AppResources.ValueEdit_ValueError_Message);
            }
        }
示例#4
0
        private void ApplySetting()
        {
            RealmEnv.RealmRank = (RealmEnv.RealmRankEnum)RealmRankPicker.SelectedIndex;
            RealmEnv.TrustRank = TrustRankPicker.SelectedIndex + 1;

            switch (type)
            {
            case RealmEnv.RealmType.Currency:
                RCEnv.CalcEndTime();
                RCEnv.SaveValue();
                break;

            case RealmEnv.RealmType.Friendship:
                RFEnv.CalcEndTime();
                RFEnv.SaveValue();
                break;
            }

            UpdateNotis();

            Navigation.PopAsync();
        }