/// <summary>
        /// Special handling for arrangements so that they display nicely
        /// </summary>
        /// <param name="tabParent"></param>
        /// <param name="workOrderId"></param>
        public WorkOrderPage(TabbedWorkOrderPage tabParent, long workOrderId)
        {
            Initialize(tabParent);

            //load work order data for the id passed
            ((App)App.Current).GetWorkOrder(workOrderId).ContinueWith(a => WorkOrderLoaded(a.Result));

            //load all inventory item images
            //tabParent.LoadWorkOrderImages(workOrderId);
        }
 public WorkOrderPage(TabbedWorkOrderPage tabParent)
 {
     Initialize(tabParent);
 }
        private void Initialize(TabbedWorkOrderPage tabParent)
        {
            InitializeComponent();

            TabParent = tabParent;

            MessagingCenter.Subscribe <WorkOrderInventoryItemDTO>(this, "SearchInventory", (arg) =>
            {
                searchedForInventory = arg;
            });

            MessagingCenter.Subscribe <PersonAndAddressDTO>(this, "SearchCustomer", (arg) =>
            {
                searchedForPerson = arg as PersonAndAddressDTO;
            });

            MessagingCenter.Subscribe <PersonAndAddressDTO>(this, "SearchDeliveryRecipient", (arg) =>
            {
                searchedForDeliveryRecipient = arg as PersonAndAddressDTO;
            });

            orderType.Add(new KeyValuePair <int, string>(0, "Walk In"));
            orderType.Add(new KeyValuePair <int, string>(1, "Phone"));
            orderType.Add(new KeyValuePair <int, string>(2, "Email"));

            OrderType.ItemsSource   = orderType;
            OrderType.SelectedIndex = 0;

            deliveryTypeList.Add(new KeyValuePair <long, string>(1, "Pickup"));
            deliveryTypeList.Add(new KeyValuePair <long, string>(2, "Delivery"));
            deliveryTypeList.Add(new KeyValuePair <long, string>(3, "Site Service"));

            DeliveryType.ItemsSource   = deliveryTypeList;
            DeliveryType.SelectedIndex = 0;

            DeliverTo.Text = "Buyer";

            buyerChoiceList.Add(new KeyValuePair <int, string>(0, "Pick one"));
            buyerChoiceList.Add(new KeyValuePair <int, string>(1, "Choose Existing"));
            buyerChoiceList.Add(new KeyValuePair <int, string>(2, "Create New"));

            BuyerChoice.ItemsSource   = buyerChoiceList;
            BuyerChoice.SelectedIndex = 0;

            BuyerChoice.SelectedIndexChanged += BuyerChoice_SelectedIndexChanged;

            ((App)App.Current).GetUsers().ContinueWith(a => LoadUsers(a.Result));

            Save.IsEnabled = true;

            Save.Clicked += OnSaveWorkOrder;

            //both buttons are disabled until the work order data is saved
            Payment.IsEnabled = false;

            MessagingCenter.Subscribe <WorkOrderResponse>(this, "PaymentSuccess", (arg) =>
            {
                currentWorkOrderPaymentId = -1;
                Save.IsEnabled            = EnableSave();
                Payment.IsEnabled         = EnablePayment();
                AddInventory.IsEnabled    = false;
                RedrawInventoryList(); //disable  arrangement list view item qty text boxes and delete buttons
            });
        }