public ResinTimerPage() { InitializeComponent(); BindingContext = this; REnv.OneCountTime = new(); REnv.TotalCountTime = new(); REnv.LoadValues(); if (Device.RuntimePlatform is not Device.UWP) { _buttonPressTimer = new(500) { AutoReset = false }; _buttonPressTimer.Elapsed += delegate { _isRunQuickCalc = true; if (Preferences.Get(SettingConstants.QUICKCALC_VIBRATION, true)) { Vibration.Vibrate(100); } QuickCalc(); }; } if (REnv.IsSyncEnabled) { _ = SyncData(); } }
public ResinNoti(int resin) { NotiId = Resin = resin; Interval = (REnv.MaxResin - Resin) * REnv.OneRestoreInterval; try { NotiTime = REnv.EndTime.AddSeconds(-Interval); } catch (Exception) { REnv.LoadValues(); NotiTime = REnv.EndTime.AddSeconds(-Interval); } }
public override async void OnUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { base.OnUpdate(context, appWidgetManager, appWidgetIds); try { REnv.LoadValues(); if (REnv.IsSyncEnabled) { if (await SyncHelper.Update(SyncHelper.SyncTarget.Resin)) { REnv.SaveValue(); if (Preferences.Get(SettingConstants.NOTI_ENABLED, false)) { var notiManager = new ResinNotiManager(); var notiScheduleAndroid = new NotiScheduleAndroid(); if (notiManager.Notis.Count > 0) { notiManager.UpdateNotisTime(); notiScheduleAndroid.Cancel <ResinNoti>(); notiScheduleAndroid.Schedule <ResinNoti>(); } } } } REnv.CalcResin(); UpdateLayout(context, appWidgetManager, appWidgetIds); } catch { Toast.MakeText(context, Resources.AppResources.ResinWidget_UpdateFail, ToastLength.Short).Show(); } if (isClick) { Toast.MakeText(context, Resources.AppResources.ResinWidget_UpdateComplete, ToastLength.Short).Show(); isClick = false; } }
public ResinHomeItem() { REnv.LoadValues(); }