Esempio n. 1
0
        /** This function creates objects and calls their methods. First the security methods are called and if they return false call the points updating
         * methods
         */
        private async void AddPointsClicked(object sender, EventArgs e)
        {
            SecurityMethods checks = new SecurityMethods();
            Task <bool>     myTask = checks.DayLimitLock();
            await           myTask;

            Task <bool> myTaskTwo = checks.TimeLimitLock();
            await       myTaskTwo;

            if (myTask.Result)
            {
                await DisplayAlert("Daily Limit Reached", "You can only log 15 Actions per day.", "OK");

                await Navigation.PushAsync(new MainMenu());
            }
            else if (myTaskTwo.Result)
            {
                await DisplayAlert("Too soon", "You must wait 1 minute before logging the next Action.", "OK");

                await Navigation.PushAsync(new MainMenu());
            }
            else
            {
                PointsUpdate helper = new PointsUpdate();
                helper.UpdateByTwoPoints();
                ShoppingPointsUpdate helper2 = new ShoppingPointsUpdate();
                helper2.ClothNapkinsPoints();
                await DisplayAlert("Points Added", AppConstants.twoPointsMsg, "OK");

                await Navigation.PushAsync(new MainMenu());
            }
        }