Example #1
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            string      checkNum        = custRefBox.Text.Trim(); //checknum = user's input. .Trim() added to remove line feed characters
            Customer    currentCustomer = new Customer();
            UserTracker tracker         = UserTracker.Instance;   //singleton instance of UserTracker

            tracker.ReadCustomer(checkNum, currentCustomer);      //check persisntence file for customer records on

            HubPage hub = new HubPage(currentCustomer);

            try
            {
                if (currentCustomer.CustomerRef == Int32.Parse(checkNum)) //if the customer ref (and therefore other details) were successfully set
                {
                    hub.Show();                                           //on with the show, start making a booking
                    this.Close();
                }
            }
            catch
            {
                MessageBox.Show("Customer reference must be a number.", "Invalid input.", // reason for error
                                MessageBoxButton.OK, MessageBoxImage.Error);              //give 'em a BONK
            }
        }