private async Task ExecuteLoadUsersCommand() { if (IsBusy) { return; } IsBusy = true; try { var ListItems = await User_DataStore.GetAllUserAsync(); foreach (var item in ListItems) { _luser.Add(item); } _luser.Sort(x => x.score); await Application.Current.MainPage.Navigation.PushAsync(new TopScore(_luser)); } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
public AddUserVM() { MessagingCenter.Subscribe <AddUserPopup, string>(this, "AddUser", async(obj, nameUser) => { User newUser = new User(nameUser, 0, DeviceInfo.Model); await User_DataStore.AddUser(newUser); await PopupNavigation.Instance.PopAsync(); MainPageVM abc = new MainPageVM(); abc.NewGameCmd.Execute(null); }); }
public OutGameVM(int UScore) { MakeNewGame = new Command(() => { MainPageVM abc = new MainPageVM(); abc.NewGameCmd.Execute(null); }); MainPage = new Command(async() => { await Application.Current.MainPage.Navigation.PopToRootAsync(); }); Device.BeginInvokeOnMainThread(async() => { User upUser = await User_DataStore.CheckDeviceAsync(DeviceInfo.Model); upUser.score = UScore; await User_DataStore.UpdateUser(upUser); }); }