public ContactViewModel()
        {
            ObservableContact contact = new ObservableContact();

            Contacts    = new EntityDataViewModel(15, typeof(Contact), false);
            ContactEdit = (Observable <ObservableContact>)ValidatedObservableFactory.ValidatedObservable(contact);//Knockout.Observable<ObservableContact>(new ObservableContact());
            ContactEdit.GetValue().OnSaveComplete += ContactViewModel_OnSaveComplete;
            ErrorMessage = Knockout.Observable <string>();
            Contacts.OnDataLoaded.Subscribe(Contacts_OnDataLoaded);

            ObservableContact.RegisterValidation(Contacts.ValidationBinder);
        }
Beispiel #2
0
        public ContactsViewModel(EntityReference parentCustomerId, int pageSize)
        {
            Contacts = new EntityDataViewModel(pageSize, typeof(Contact), true);
            ParentCustomerId.SetValue(parentCustomerId);

            ObservableContact contact = new ObservableContact();

            contact.ParentCustomerId.SetValue(parentCustomerId);
            ContactEdit = (Observable <ObservableContact>)ValidatedObservableFactory.ValidatedObservable(contact);
            ContactEdit.GetValue().OnSaveComplete += ContactsViewModel_OnSaveComplete;
            Contacts.OnDataLoaded.Subscribe(Contacts_OnDataLoaded);
            ObservableContact.RegisterValidation(Contacts.ValidationBinder);
            AllowAddNew = Knockout.DependentObservable <bool>(AllowAddNewComputed);
            AllowOpen   = Knockout.Observable <bool>(false);
            Contacts.OnSelectedRowsChanged += Contacts_OnSelectedRowsChanged;
        }
 public ObservableContact()
 {
     ObservableContact.RegisterValidation(new ObservableValidationBinder(this));
 }