/// <summary> /// 直接输入缺少的金额 /// </summary> public void FinishPaidPrice() { IsLoading = true; Task.Run(async() => { await ExtX.WaitForLoading(); Xamarin.Forms.Device.BeginInvokeOnMainThread(() => { oldList = tempPayList.Select(x => new CommonPayModel(x)).ToList(); ChangePaidPrice.InitialView(this.import.TotalPrice, oldList, false, true, 3); double lessPrice = Math.Round(import.TotalPrice - import.TotalPaidPrice, 2); if (lessPrice != 0) { if (lessPrice > 0) { ChangePaidPrice.SetChangePrice(lessPrice, "+"); } else if (lessPrice < 0) { ChangePaidPrice.SetChangePrice(Math.Abs(lessPrice), "-"); } } IsLoading = false; }); }); }
/// <summary> /// 保存设置 /// </summary> private void Setting() { Task.Run(async() => { await ExtX.WaitForLoading(); Resources.Instance.LastLoginAdminNo = AdminNo; Resources.Instance.IsSavePassword = IsSavePassword; if (IsSavePassword) { Resources.Instance.LastLoginPassword = Password; } else { Resources.Instance.LastLoginPassword = null; Device.BeginInvokeOnMainThread(() => { this.Password = ""; }); } await Common.Instance.SetBak(); }); }
/// <summary> /// 关闭 /// </summary> private void Close() { IsLoading = true; IsPresented = false; Task.Run(async() => { await ExtX.WaitForLoading(); Xamarin.Forms.Device.BeginInvokeOnMainThread(() => { NavigationPath.Instance.SwitchNavigate(1); IsLoading = false; }); }); }
/// <summary> /// 清空并刷新所有(首次或者登录后) /// </summary> internal void RefreshAllWithAnimate() { IsLoading = true; Task.Run(async() => { await ExtX.WaitForLoading(); Xamarin.Forms.Device.BeginInvokeOnMainThread(() => { ClearAndRefreshAll(); IsLoading = false; }); }); }
/// <summary> /// 隐藏 /// </summary> internal void Hide() { IsLoading = true; Task.Run(async() => { await ExtX.WaitForLoading(); Xamarin.Forms.Device.BeginInvokeOnMainThread(() => { // 关闭面板 NavigationPath.Instance.ClosePanels(false); this.IsShow = false; IsLoading = false; }); }); }
/// <summary> /// 登录 /// </summary> private void Login() { // 登录 Device.BeginInvokeOnMainThread(async() => { // 登录 if (InitCount <= 1) { IsLoading = true; await Task.Run(async() => { await ExtX.WaitForLoading(); Device.BeginInvokeOnMainThread(() => { NavigationPath.Instance.RoomListPage = new RoomListPage(); NavigationPath.Instance.ChangePasswordPage = new ChangePasswordPage(); NavigationPath.Instance.AboutPage = new AboutPage(); NavigationPath.Instance.BalancePage = new BalancePage(); NavigationPath.Instance.StatisticPage = new StatisticPage(); NavigationPath.Instance.MainListPage = new MainListPage(); NavigationPath.Instance.MainNavigation = new MainPage(NavigationPath.Instance.MainListPage); NavigationPath.Instance.InitialMainNavigations(NavigationPath.Instance.MainNavigation); }); await ExtX.Sleep(2000); }); // 登录通知 Notification.Instance.ActionLogin(null, null, null); NavigationPath.Instance.SwitchNavigate(1); NavigationPath.Instance.CurrentNavigate.BindingContext = new MainViewModel(NavigationPath.Instance.CurrentNavigate); NavigationPath.Instance.MainListPage.Init(); NavigationPath.Instance.GoNavigateNext(NavigationPath.Instance.MainListPage); IsLoading = false; Setting(); } // 以后就是直接打开了 else { // 登录通知 Notification.Instance.ActionLogin(null, null, null); NavigationPath.Instance.SwitchNavigate(1); MainViewModel viewModel = NavigationPath.Instance.CurrentNavigate.BindingContext as MainViewModel; viewModel.Resize(); Setting(); } }); }