Beispiel #1
0
        private void AuthenticateDriverReturnFunction(object sender, ServiceReference1.AuthenticateDriverCompletedEventArgs e)
        {
            if (e.Result != -1)
            {
                try
                {
                    // Setting the global attributes sharable between mobile app and background agent
                    //Global_Library.Class1.DriverID = e.Result;
                    ForGlobalVariables.LoginDetails.DriverLoggedIn = true;
                    int DriverID = Convert.ToInt32(e.Result);
                    ForGlobalVariables.LoginDetails.DriverID = e.Result;
                    
                    //Calling service function to return the cab ID for this logged in Driver
                    ServiceReference1.ServiceClient clientfortesting = new ServiceReference1.ServiceClient();
                    
                    clientfortesting.CabIDforDriverCompleted += new EventHandler<ServiceReference1.CabIDforDriverCompletedEventArgs>(CabIDForDriverReturnFunction);
                    clientfortesting.CabIDforDriverAsync(ForGlobalVariables.LoginDetails.DriverID);

                    //NavigationService.Navigate(new Uri("/DriverMainPage.xaml", UriKind.Relative));
                    //Launching the background task
                    //ScheduledActionService.Add(periodicTask);
                    //ScheduledActionService.LaunchForTest("DriverTask", TimeSpan.FromSeconds(60));

                    authenticated = true;
                   
                }
                catch(Exception ex)
                {
                    MessageBox.Show("Exception in authenticate driver completed.\nException message: " + ex.Message);
                }
            }
            else
            {
                MessageBox.Show("ERROR! Invalid username or password.");
            }

        }