コード例 #1
0
        public RealmFriendshipTimerPage()
        {
            InitializeComponent();

            RFEnv.LoadValues();

            if (Device.RuntimePlatform is not Device.UWP)
            {
                _buttonPressTimer = new(500)
                {
                    AutoReset = false
                };
                _buttonPressTimer.Elapsed += delegate
                {
                    _isRunReset = true;

                    if (Preferences.Get(SettingConstants.QUICKCALC_VIBRATION, true))
                    {
                        Vibration.Vibrate(100);
                    }

                    ResetRF();
                };
            }

            _calcTimer = new(CalcNowRF, new AutoResetEvent(false), TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(1));
        }
コード例 #2
0
        private void ResetRF()
        {
            DateTime now   = DateTime.Now;
            int      count = RFEnv.MaxRF / RFEnv.RFRate;

            count += (RFEnv.MaxRF % RFEnv.RFRate) == 0 ? 0 : 1;

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

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

            RFEnv.Bounty   = 0;
            RFEnv.AddCount = 0;

            RFEnv.SaveValue();

            if (Preferences.Get(SettingConstants.NOTI_ENABLED, false))
            {
                new RealmFriendshipNotiManager().UpdateNotisTime();
            }
        }
コード例 #3
0
        protected override void OnDisappearing()
        {
            base.OnDisappearing();

            RFEnv.SaveValue();

            _calcTimer.Change(Timeout.Infinite, Timeout.Infinite);
        }
コード例 #4
0
        private void CalcNowRF(object statusInfo)
        {
            try
            {
                RFEnv.CalcRF();

                MainThread.BeginInvokeOnMainThread(RefreshInfo);
            }
            catch (Exception ex)
            {
#if DEBUG
                DependencyService.Get <IToast>().Show(ex.ToString());
#endif
            }
        }
コード例 #5
0
        public RealmFriendshipNoti(int percentage)
        {
            Percentage = percentage;
            NotiId     = RealmFriendshipNotiManager.ID_PREINDEX + Percentage;

            try
            {
                UpdateTime();
            }
            catch
            {
                RFEnv.LoadValues();
                UpdateTime();
            }
        }
コード例 #6
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();
        }
コード例 #7
0
        internal override void ApplyValue()
        {
            base.ApplyValue();

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

                RFEnv.CalcEndTime();
                RFEnv.CalcRF();
                RFEnv.SaveValue();

                notiManager.UpdateNotisTime();
                notiManager.UpdateScheduledNoti <RealmFriendshipNoti>();
            }
            else
            {
                DependencyService.Get <IToast>().Show(AppResources.ValueEdit_ValueError_Message);
            }
        }
コード例 #8
0
 public RealmFriendshipHomeItem()
 {
     RFEnv.LoadValues();
     RFEnv.CalcRF();
 }