private void SaveExecute()
        {
            try
            {
                if (this.Photo != null)
                {
                    this.Customer.CustomerPicture = new CustomerPicture()
                    {
                        Photo = this.Photo
                    }
                }
                ;
                else
                {
                    this.Customer.CustomerPicture = new CustomerPicture();
                }

                this.Customer.MarkAsAdded();

                MainModuleServiceClient client = new MainModuleServiceClient();
                client.AddCustomerCompleted += delegate
                {
                    _currentCustomer.AcceptChanges();
                    ((VMCustomerListView)((MainPage)App.Current.RootVisual).viewListCustomers.DataContext).GetCustomers();
                    ((MainPage)App.Current.RootVisual).GoBackAddCustomer.Begin();
                    Customer = null;
                };
                client.AddCustomerAsync(this._currentCustomer);
            }
            catch (FaultException <ServiceError> ex)
            {
                MessageBox.Show(ex.Detail.ErrorMessage);
            }
        }
Exemplo n.º 2
0
        private void SaveExecute()
        {
            try
            {
                if (this.Photo != null)
                    this.Customer.CustomerPicture = new CustomerPicture() { Photo = this.Photo };
                else
                    this.Customer.CustomerPicture = new CustomerPicture();

                this.Customer.MarkAsAdded();

                MainModuleServiceClient client = new MainModuleServiceClient();
                client.AddCustomerCompleted += delegate
                {
                    _currentCustomer.AcceptChanges();
                    ((VMCustomerListView)((MainPage)App.Current.RootVisual).viewListCustomers.DataContext).GetCustomers();
                    ((MainPage)App.Current.RootVisual).GoBackAddCustomer.Begin();
                    Customer = null;
                };
                client.AddCustomerAsync(this._currentCustomer);

            }
            catch (FaultException<ServiceError> ex)
            {
                MessageBox.Show(ex.Detail.ErrorMessage);
            }
        }