private async void View_LoadView(object sender, EventArgs e)
        {
            view.Loading(true);
            try
            {
                await Task.Run(async() =>
                {
                    if (this.order.ID > 0)
                    {
                        this.order = await Task.Run(() => api.GetOrder(this.order)) as OrderData;
                    }

                    OrderData order = this.order as OrderData;
                    OrderVM         = new OrderViewModel();
                    CustomerTabVM   = new CustomerTabViewModel(order, api, settings);
                    ProductsTabVM   = new ProductsTabViewModel(order, api.GetProducts(null));
                    PaymentTabVM    = new PaymentTabViewModel(order, api.GetPaymentMethods(), api.GetCountries(), api.GetZones);
                    ShippingTabVM   = new ShippingTabViewModel(order, api.GetShippingMethods(), api.GetCountries(), api.GetZones);
                    TotalTabVM      = new TotalTabViewModel(order, api.GetOrderStatuses());
                });
            }
            catch (InvalidOperationException ex)
            {
                view.Message(ex.Message);
            }
            finally
            {
                view.Loading(false);
            }
        }
 public CustomerEditViewModel(CustomerTabViewModel parentViewModel, Customer customer)
 {
     ContextualTabGroup = parentViewModel.ContextualTabGroup;
     Customer = customer;
     TabItem = new ContextualTabItem(this) { DataContext = this };
     tabContent = new ContextualTabContent() { DataContext = this };
     ParentViewModel = parentViewModel;
     ContextualTabList = new ObservableCollection<TabItem>();
     ContextualTabList.Add(new EditView.EditViewTabItem());
     EditMode = true;
 }
 public CustomerEditViewModel(CustomerTabViewModel parentViewModel, int ID = -1)
 {
     ContextualTabGroup = parentViewModel.ContextualTabGroup;
     Customer = new Core.Customers.Customer();
     TabItem = new ContextualTabItem(this) { DataContext = this };
     tabContent = new ContextualTabContent() { DataContext = this };
     ParentViewModel = parentViewModel;
     ContextualTabList = new ObservableCollection<TabItem>();
     ContextualTabList.Add(new EditView.EditViewTabItem());
     if (ID != -1)
     {
         Customer.CustomerID = ID.ToString();
     }
     EditMode = false;
 }