public ConnectionConfigurationViewModel(IApplicationServices applicationServices)
        {
            _hartCommunicationService = applicationServices.HartCommunicationService;
            PossiblePortNames         = new ObservableCollection <string>(_hartCommunicationService.PossiblePortNames);

            _selectedPortName = new DataWrapper <string>(this, _selectedPortChangeArgs, () =>
            {
                if (_selectedPortName != null)
                {
                    _hartCommunicationService.PortName = _selectedPortName.DataValue;
                }
            })
            {
                DataValue = _hartCommunicationService.PortName
            };

            _cachedListOfDataWrappers = DataWrapperHelper.GetWrapperProperties(this);

            SaveCommand = new SimpleCommand <object, object>(item =>
            {
                EndEdit();
                CloseActivePopUpCommand.Execute(true);
            });

            CancelCommand = new SimpleCommand <object, object>(item =>
            {
                CancelEdit();
                CloseActivePopUpCommand.Execute(true);
            });
        }
コード例 #2
0
        public LoginViewViewModel(IViewAwareStatus viewAwareStatus, IAuthenticateService authenticateService,
                                  IMessageBoxService messageBoxService, IBusinessUnitService businessUnitService, IViewInjectionService viewInjectionService)
        {
            //base.IsCloseable = true;
            //Initialise Services
            this.viewAwareStatus      = viewAwareStatus;
            this.authenticateService  = authenticateService;
            this.messageBoxService    = messageBoxService;
            this.businessUnitService  = businessUnitService;
            this.viewInjectionService = viewInjectionService;
            //this.regionManager = regionManager;
            //Initialise Properties
            UserName                         = new DataWrapper <string>(this, userNameArgs);
            Password                         = new DataWrapper <string>(this, passwordArgs);
            SelectedBusinessUnit             = new DataWrapper <Int32>(this, businessUnitsArgs);
            this.viewAwareStatus.ViewLoaded += new Action(viewAwareStatus_ViewLoaded);


            cachedListOfDataWrappers =
                DataWrapperHelper.GetWrapperProperties <LoginViewViewModel>(this);

            //Register Mediator
            Mediator.Instance.Register(this);

            //Initialise Rules
            userName.AddRule(UserNameCannnotBeEmptyRule);
            password.AddRule(PasswordCannotBeEmptyRule);
            selectedBusinessUnit.AddRule(SelectedBusinessUnitCannotBeEmpty);

            //Initialise Commands
            LoginCommand       = new SimpleCommand <object, object>(CanExecuteLoginCommand, ExecuteLoginCommand);
            CancelLoginCommand = new SimpleCommand <object, object>(ExecuteCancelLoginCommand);
        }
コード例 #3
0
        public ImageRatingViewModel(IMessageBoxService messageBoxService)
        {
            //setup services
            this.messageBoxService = messageBoxService;

            //Commands
            SaveImageRatingCommand = new SimpleCommand <Object, Object>(ExecuteSaveImageRatingCommand);


            #region Create DataWrappers

            ImageRating            = new DataWrapper <Int32>(this, imageRatingChangeArgs);
            ImageRating.IsEditable = true;

            //fetch list of all DataWrappers, so they can be used again later without the
            //need for reflection
            cachedListOfDataWrappers =
                DataWrapperHelper.GetWrapperProperties <ImageRatingViewModel>(this);
            #endregion

            #region Create Validation Rules

            imageRating.AddRule(imageRatingRule);
            #endregion
        }
コード例 #4
0
        public BusinessUnit()
        {
            BuId           = new DataWrapper <Int32>(this, buIdArgs);
            BuName         = new DataWrapper <String>(this, buNameArgs);
            BuEmailAddress = new DataWrapper <String>(this, buEmailAddressArgs);
            BuContactNum1  = new DataWrapper <String>(this, buContactNum1Args);
            BuContactNum2  = new DataWrapper <String>(this, buContactNum2Args);
            BuContactNum3  = new DataWrapper <String>(this, buContactNum3Args);
            BuAddress1     = new DataWrapper <String>(this, buAddress1Args);
            BuAddress2     = new DataWrapper <String>(this, buAddress2Args);
            BuAddress3     = new DataWrapper <String>(this, buAddress3Args);
            BuParish       = new DataWrapper <String>(this, buParishArgs);
            BuCountry      = new DataWrapper <String>(this, buCountryArgs);
            CreatedAt      = new DataWrapper <DateTime>(this, createdAtArgs);
            CreatedBy      = new DataWrapper <Int32>(this, createdByArgs);
            UpdatedAt      = new DataWrapper <DateTime>(this, updatedAtArgs);
            UpdatedBy      = new DataWrapper <Int32>(this, updatedByArgs);

            //fetch list of all DataWrappers, so they can be used again later without the
            //need for reflection
            cachedListOfDataWrappers =
                DataWrapperHelper.GetWrapperProperties <BusinessUnit>(this);

            #region Create Validation Rules
            buName.AddRule(BusinessNameRule);
            buAddress1.AddRule(BusinessAddress1Rule);
            buParish.AddRule(BusinessParishRule);
            buCountry.AddRule(BusinessCountryRule);
            #endregion
        }
コード例 #5
0
ファイル: OrderModel.cs プロジェクト: jackhuclan/cinch-wpf
        public OrderModel()
        {
            #region Create DataWrappers

            OrderId      = new DataWrapper <Int32>(this, orderIdChangeArgs);
            CustomerId   = new DataWrapper <Int32>(this, customerIdChangeArgs);
            ProductId    = new DataWrapper <Int32>(this, productIdChangeArgs);
            Quantity     = new DataWrapper <Int32>(this, quantityChangeArgs);
            DeliveryDate = new DataWrapper <DateTime>(this, deliveryDateChangeArgs);

            //fetch list of all DataWrappers, so they can be used again later without the
            //need for reflection
            cachedListOfDataWrappers =
                DataWrapperHelper.GetWrapperProperties <OrderModel>(this);

            #endregion

            #region Create Validation Rules

            quantity.AddRule(quantityRule);

            #endregion


            //I could not be bothered to write a full DateTime picker in
            //WPF, so for the purpose of this demo, DeliveryDate is
            //fixed to DateTime.Now
            DeliveryDate.DataValue = DateTime.Now;
        }
コード例 #6
0
        public CustomerModel()
        {
            #region Create DataWrappers

            CustomerId        = new DataWrapper <Int32>(this, customerIdChangeArgs);
            FirstName         = new DataWrapper <String>(this, firstNameChangeArgs);
            LastName          = new DataWrapper <String>(this, lastNameChangeArgs);
            Email             = new DataWrapper <String>(this, emailChangeArgs);
            HomePhoneNumber   = new DataWrapper <String>(this, homePhoneNumberChangeArgs);
            MobilePhoneNumber = new DataWrapper <String>(this, mobilePhoneNumberChangeArgs);
            Address1          = new DataWrapper <String>(this, address1ChangeArgs);
            Address2          = new DataWrapper <String>(this, address2ChangeArgs);
            Address3          = new DataWrapper <String>(this, address3ChangeArgs);

            //fetch list of all DataWrappers, so they can be used again later without the
            //need for reflection
            cachedListOfDataWrappers =
                DataWrapperHelper.GetWrapperProperties <CustomerModel>(this);
            #endregion

            #region Create Validation Rules

            firstName.AddRule(firstNameRule);
            lastName.AddRule(lastNameRule);
            email.AddRule(emailRule);
            homePhoneNumber.AddRule(homePhoneNumberRule);
            address1.AddRule(address1Rule);
            address2.AddRule(address2Rule);
            address3.AddRule(address3Rule);
            #endregion
        }
コード例 #7
0
 /// <summary>
 /// Override hook which allows us to also put any child
 /// EditableValidatingObject objects into the CancelEdit state
 /// </summary>
 protected override void OnCancelEdit()
 {
     base.OnCancelEdit();
     //Now walk the list of properties in the OrderModel
     //and call CancelEdit() on all Cinch.DataWrapper<T>s.
     //we can use the Cinch.DataWrapperHelper class for this
     DataWrapperHelper.SetCancelEdit <OrderModel>(this);
 }
コード例 #8
0
ファイル: OrderModel.cs プロジェクト: jackhuclan/cinch-wpf
 /// <summary>
 /// Override hook which allows us to also put any child
 /// EditableValidatingObject objects into the EndEdit state
 /// </summary>
 protected override void OnEndEdit()
 {
     base.OnEndEdit();
     //Now walk the list of properties in the CustomerModel
     //and call CancelEdit() on all Cinch.DataWrapper<T>s.
     //we can use the Cinch.DataWrapperHelper class for this
     DataWrapperHelper.SetEndEdit(cachedListOfDataWrappers);
 }
コード例 #9
0
        public User()
        {
            BuId     = new DataWrapper <Int32>(this, buIdArgs);
            UserId   = new DataWrapper <Int32>(this, userIdArgs);
            UserName = new DataWrapper <String>(this, userNameArgs);
            Password = new DataWrapper <String>(this, passwordArgs);


            ConfirmPassword = new DataWrapper <String>(this, confirmPasswordArgs);
            Status          = new DataWrapper <Status>(this, statusArgs);
            JobTitle        = new DataWrapper <String>(this, jobTitleArgs);
            FirstName       = new DataWrapper <String>(this, firstNameArgs);
            MiddleName      = new DataWrapper <String>(this, middleNameArgs);
            LastName        = new DataWrapper <String>(this, lastNameArgs);
            DateOfBirth     = new DataWrapper <DateTime>(this, dateOfBirthArgs);
            EmailAddress    = new DataWrapper <String>(this, emailAddressArgs);
            ContactNum1     = new DataWrapper <String>(this, contactNum1Args);
            ContactNum2     = new DataWrapper <String>(this, contactNum2Args);
            ContactNum3     = new DataWrapper <String>(this, contactNum3Args);
            Address1        = new DataWrapper <String>(this, address1Args);;
            Address2        = new DataWrapper <String>(this, address2Args);;
            Address3        = new DataWrapper <String>(this, address3Args);;
            Parish          = new DataWrapper <String>(this, parishArgs);;
            Gender          = new DataWrapper <Gender>(this, genderArgs);;
            PhotoPath       = new DataWrapper <String>(this, photoPathArgs);;
            CreatedAt       = new DataWrapper <DateTime>(this, createdAtArgs);
            CreatedBy       = new DataWrapper <Int32>(this, createdByArgs);
            UpdatedAt       = new DataWrapper <DateTime>(this, updatedAtArgs);
            UpdatedBy       = new DataWrapper <Int32>(this, updatedByArgs);

            DateOfBirth.DataValue = DateTime.Today;


            PhotoPath.DataValue = GymSoft.CinchMVVM.Common.GymSoftConfigurationManger.GetDefaultUserPicture().ToString();
            //fetch list of all DataWrappers, so they can be used again later without the
            //need for reflection
            cachedListOfDataWrappers =
                DataWrapperHelper.GetWrapperProperties <User>(this);

            #region Create Validation Rules
            firstName.AddRule(FirstNameCannotBeEmptyRule);
            lastName.AddRule(LastNameCannotBeEmptyRule);
            userName.AddRule(UserNameCannotBeEmptyRule);
            password.AddRule(PasswordCannotBeEmptyRule);
            confirmPassword.AddRule(ConfrimPasswordCannotBeEmptyRule);
            confirmPassword.AddRule(ConfirmPasswordAndPasswordMustBeEqualRule);
            status.AddRule(StatusCannotBeEmptyRule);
            jobTitle.AddRule(JobTitleCannotBeEmpyRule);
            emailAddress.AddRule(EmailAddressMustBeInCorrectFormat);
            //dateOfBirth.AddRule(DateOfBirthCannotBeNullRule);
            dateOfBirth.AddRule(DateOfBirthMustBeAValidDate);
            #endregion
        }
コード例 #10
0
        public sameVM()
        {
            #region Create DataWrappers
            PersonA = new Cinch.DataWrapper <Decimal>(this, personAChangeArgs);
            PersonB = new Cinch.DataWrapper <Int32>(this, personBChangeArgs);
            //fetch list of all DataWrappers, so they can be used again later without the
            //need for reflection
            cachedListOfDataWrappers =
                DataWrapperHelper.GetWrapperProperties <sameVM>(this);
            #endregion

            #region Create Auto Generated Property Callbacks
            //Create callbacks for auto generated properties in auto generated partial class part
            //Which allows this part to know when a property in the generated part changes
            Action personACallback = new Action(PersonAChanged);
            autoPartPropertyCallBacks.Add(personAChangeArgs.PropertyName, personACallback);

            Action personBCallback = new Action(PersonBChanged);
            autoPartPropertyCallBacks.Add(personBChangeArgs.PropertyName, personBCallback);

            #endregion
        }
 protected override void OnCancelEdit()
 {
     base.OnCancelEdit();
     DataWrapperHelper.SetCancelEdit(_cachedListOfDataWrappers);
 }
 protected override void OnBeginEdit()
 {
     base.OnBeginEdit();
     DataWrapperHelper.SetBeginEdit(_cachedListOfDataWrappers);
 }