コード例 #1
0
 public CustomerValidator(Customer customer)
 {
     _customer = customer;
     _titleProperty=PropertySupport.ExtractPropertyName(() => _customer.Title);
     _firstNameProperty = PropertySupport.ExtractPropertyName(() => _customer.FirstName);
     _lastNameProperty = PropertySupport.ExtractPropertyName(() => _customer.LastName);
 }
コード例 #2
0
        public void TestTitleError()
        {
            var cust=new Customer();
            var errorInfo=cust as System.ComponentModel.IDataErrorInfo;

            Assert.IsTrue(String.IsNullOrWhiteSpace(errorInfo["Title"]));

            cust.Title="error";
             Assert.IsFalse(String.IsNullOrWhiteSpace(errorInfo["Title"]));
        }
コード例 #3
0
 private void _InitModel()
 {
     _model = new Customer();
     _model.PropertyChanged += _model_PropertyChanged;
     _model.DefaultAddress.PropertyChanged +=
         DefaultAddress_PropertyChanged;
     _model.InvoiceAddress.PropertyChanged += DefaultAddress_PropertyChanged;
     _model.DeliveryAddress.PropertyChanged += DefaultAddress_PropertyChanged;
     bsCustomer.DataSource = _model;
     _SerializeModel();
 }