/// <summary>
        /// Process asynchronously the Create Report click.
        /// </summary>
        async void CreateReportButton_TouchUpInsideAsync()
        {
            try
            {
                // Clear the last displayed report creation status.
                StatusLabel.Text = "";

                // Get the expense code for the Expense Type selected in the UI.
                int    selectedExpenseTypeIndex = ExpenseTypePicker.SelectedRowInComponent(0);
                string expenseTypeCode          = ExpenseTypes[selectedExpenseTypeIndex].Code;

                // Get the ID for the Payment Type selected in the UI.
                int    selectedPaymentTypeIndex = PaymentTypePicker.SelectedRowInComponent(0);
                string paymentTypeId            = PaymentTypes[selectedPaymentTypeIndex].ID;

                // The facade will call Concur APIs to create an expense report with an expense entry and an expense image.
                string reportId = await ClientLibraryFacade.CreateReportWithImageAsync(
                    ReportNameTextField.Text,
                    VendorTextField.Text,
                    decimal.Parse(AmountTextField.Text),
                    CurrencyTextField.Text,
                    expenseTypeCode,
                    DateTime.Parse(DateTextField.Text),
                    paymentTypeId,
                    ExpenseImageData,
                    ReceiptFileType.Jpeg);

                // Show report creation success as the lastest status.
                StatusLabel.Text = "Success!!!  Report ID: " + reportId;
            }
            catch (Exception e)
            {
                DisplayException(e);
            }
        }
        /// <summary>
        /// Asynchronous processing of the login button click.
        /// </summary>
        async void LoginButton_TouchUpInsideAsync()
        {
            try
            {
                // Clear the last displayed status.
                StatusLabel.Text = "";

                // The facade calls Concur API to login using the ClientID, LoginID, and Password entered by the user in the UI.
                await ClientLibraryFacade.LoginAsync(
                    LoginIdTextField.Text,
                    PasswordTextField.Text,
                    ClientIdTextField.Text);

                // The facade calls Concur API to get the configuration this user should use when creating expense reports.
                // Then get the list of allowed Payment Types and allowed Expense Types for this user for creating expense reports.
                var groupConfig = await ClientLibraryFacade.GetGroupConfigurationAsync();

                PaymentTypes = groupConfig.PaymentTypes;
                ExpenseTypes = groupConfig.Policies.First(p => p.IsDefault.Value == true).ExpenseTypes;

                // Display the Payment Types and the Expense Types
                (ExpenseTypePicker.Model as MyPickerModel).MyItems = ExpenseTypes.Select(t => t.Name).ToList();
                (PaymentTypePicker.Model as MyPickerModel).MyItems = PaymentTypes.Select(t => t.Name).ToList();

                // Refresh controls used for displaying and selecting Payment Type and Expense Type.
                ExpenseTypePicker.ReloadAllComponents();
                PaymentTypePicker.ReloadAllComponents();
                SetButtonTitleAsPickerSelection(ExpenseTypeExpandButton, ExpenseTypePicker);
                SetButtonTitleAsPickerSelection(PaymentTypeExpandButton, PaymentTypePicker);

                CreateReportButton.Enabled = true;
            }
            catch (Exception e)
            {
                DisplayException(e);
            }
        }
 void ReleaseDesignerOutlets()
 {
     if (AmountTextField != null)
     {
         AmountTextField.Dispose();
         AmountTextField = null;
     }
     if (ClientIdTextField != null)
     {
         ClientIdTextField.Dispose();
         ClientIdTextField = null;
     }
     if (CreateReportButton != null)
     {
         CreateReportButton.Dispose();
         CreateReportButton = null;
     }
     if (CurrencyTextField != null)
     {
         CurrencyTextField.Dispose();
         CurrencyTextField = null;
     }
     if (DateTextField != null)
     {
         DateTextField.Dispose();
         DateTextField = null;
     }
     if (ExpenseTypeCollapseButton != null)
     {
         ExpenseTypeCollapseButton.Dispose();
         ExpenseTypeCollapseButton = null;
     }
     if (ExpenseTypeExpandButton != null)
     {
         ExpenseTypeExpandButton.Dispose();
         ExpenseTypeExpandButton = null;
     }
     if (ExpenseTypePicker != null)
     {
         ExpenseTypePicker.Dispose();
         ExpenseTypePicker = null;
     }
     if (ImageButton != null)
     {
         ImageButton.Dispose();
         ImageButton = null;
     }
     if (LoginButton != null)
     {
         LoginButton.Dispose();
         LoginButton = null;
     }
     if (LoginIdTextField != null)
     {
         LoginIdTextField.Dispose();
         LoginIdTextField = null;
     }
     if (MyMainView != null)
     {
         MyMainView.Dispose();
         MyMainView = null;
     }
     if (PasswordTextField != null)
     {
         PasswordTextField.Dispose();
         PasswordTextField = null;
     }
     if (PaymentTypeCollapseButton != null)
     {
         PaymentTypeCollapseButton.Dispose();
         PaymentTypeCollapseButton = null;
     }
     if (PaymentTypeExpandButton != null)
     {
         PaymentTypeExpandButton.Dispose();
         PaymentTypeExpandButton = null;
     }
     if (PaymentTypePicker != null)
     {
         PaymentTypePicker.Dispose();
         PaymentTypePicker = null;
     }
     if (ReceiptImageTextField != null)
     {
         ReceiptImageTextField.Dispose();
         ReceiptImageTextField = null;
     }
     if (ReportNameLabel != null)
     {
         ReportNameLabel.Dispose();
         ReportNameLabel = null;
     }
     if (ReportNameTextField != null)
     {
         ReportNameTextField.Dispose();
         ReportNameTextField = null;
     }
     if (StatusLabel != null)
     {
         StatusLabel.Dispose();
         StatusLabel = null;
     }
     if (VendorLabel != null)
     {
         VendorLabel.Dispose();
         VendorLabel = null;
     }
     if (VendorTextField != null)
     {
         VendorTextField.Dispose();
         VendorTextField = null;
     }
 }