public async Task <bool> OnExClicked()
        {
            IsBusy = true;
            int _points = Helpers.Settings.UserPoints;

            if (_reward.ReqPoints <= _points)
            {
                var     _items   = new LoadAsync <History>(MainViewModel._mclientH);
                History _history = new History();

                _history.DateTime   = DateTime.Now.ToLocalTime();
                _history.EarnPoints = -1 * Convert.ToInt32(_reward.ReqPoints);
                _history.Place      = _reward.Place;
                _history.IsDebit    = true;
                _history.Person     = Helpers.Settings.CurrentUser.Email;
                _history.Reward     = _reward.Name;

                await _items.Save(_history);

                //if (CrossConnectivity.Current.IsConnected)
                //	await _items.InitSync("history"+Helpers.Settings.UserEmail);
                //MessagingCenter.Send(this, "Debited", true);
                return(true);
                //await Navigation.PushAsync(new ExchangePage(_reward, _place));
            }
            else
            {
                //MessagingCenter.Send(this, "Debited", false);
                return(false);
            }
        }
Esempio n. 2
0
 public HistoryViewModel()
 {
     LoadCollection = new LoadAsync <History>(MainViewModel._mclientH);           //MainViewModel._client);
     Items          = new ObservableCollection <History>();
     RefreshCommand = new Command(Load);
 }