Beispiel #1
0
        public async void ButtonConfirmServiceClicked(object sender, EventArgs e)
        {
            bool success = await DoClockOut(lblServiceName.Text);

            if (success)
            {
                lblServiceConfirmMsg.Text       = "Clock-Out Completed. Checking for the next Job...";
                stkWebViewSiteMap.IsVisible     = false;
                lblServiceConfirmMsg.TextColor  = Color.DarkGreen;
                lblServiceCompleteMsg.IsVisible = true;
                lblServiceCompleteMsg.TextColor = Color.DarkGreen;
                stkBtnConfirm.IsVisible         = false;
                stkServiceChoices.IsVisible     = false;
                success = await TripContext.GetNextJob();

                await Navigation.PopToRootAsync();

                await Navigation.PushAsync(new DirectionsPage());
            }
            else
            {
                lblServiceConfirmMsg.Text      = "Clock-Out Encountered an Error. Please try again.";
                lblServiceConfirmMsg.TextColor = Color.DarkRed;
                stkBtnConfirm.IsVisible        = true;
            }
        }
Beispiel #2
0
        private async void ButtonRegisterTruck(object sender, EventArgs e)
        {
            string message = "Attempting to register the truck";

            messageLabel.Text = message;

            TruckDto newTruck = new TruckDto();

            newTruck.TruckNumber = usernameEntry.Text;
            newTruck.ApiKey      = passwordEntry.Text;

            var result = await TripContext.VerifyCredentials(newTruck);

            if (result != null)
            {
                message = result.Message;
                if (result.TruckId > 0)
                {
                    //message = await CredentialsManager.SaveLoginCredentials(result);
                    message = CredentialsManager.SaveLoginCredentials(result);
                    if (!message.StartsWith("Error:"))
                    {
                        messageLabel.Text       = message;
                        TripContext.Credentials = result;
                        var jobChanged = await TripContext.GetNextJob();

                        TripContext.CurrentPage = "DirectionsPage";
                        await Navigation.PushAsync(new DirectionsPage());
                    }
                }
            }
            else
            {
                message += " failed";
            }
            messageLabel.Text = message;
        }