private void cancel_Booking_Button(object sender, RoutedEventArgs e) { IsolatedStorageFile fileStorage = IsolatedStorageFile.GetUserStoreForApplication(); String LoggedInCustomerID = ""; if(fileStorage.FileExists("LoginDetails.txt")) { String Buffer; try { StreamReader Reader = new StreamReader(new IsolatedStorageFileStream("LoginDetails.txt", FileMode.Open, fileStorage)); Buffer = Reader.ReadLine(); if(Buffer.Equals("Customer Logged In")) { Buffer = Reader.ReadLine(); String[] Token = Buffer.Split(new char[] { ':' }); LoggedInCustomerID = Token[1]; } Reader.Close(); // Checking if the logged in customer has made any bookings ServiceReference1.ServiceClient clientfortesting = new ServiceReference1.ServiceClient(); clientfortesting.CheckCustomerBookingsCompleted += new EventHandler<ServiceReference1.CheckCustomerBookingsCompletedEventArgs>(ReturnFunction); clientfortesting.CheckCustomerBookingsAsync(Convert.ToInt32(LoggedInCustomerID)); } catch(Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Login file does not exist"); } }