Ejemplo n.º 1
0
 public MainGame(IDisplayWord displayWord, IValidateInput validateInput, ICharMatcher charMatcher, IRenderHangman renderHangman)
 {
     _displayWord   = displayWord;
     _validateInput = validateInput;
     _charMatcher   = charMatcher;
     _renderHangman = renderHangman;
 }
Ejemplo n.º 2
0
 public SampleService()
 {
     // Poor Man's Dependency Injection
     _dataService = new GetDataService();
     _mapperService = new MapperService();
     _validationInput = new ValidateInput();
 }
 public LogInToExchange(IUserService userService, IConsoleWriter consoleWriter, IInputReader inputReader, IValidateInput validateInput, IMenu mainMenu, IShowUser showUser)
 {
     _userService   = userService;
     _consoleWriter = consoleWriter;
     _inputReader   = inputReader;
     _validateInput = validateInput;
     _mainMenu      = mainMenu;
     _showUser      = showUser;
 }
 public AccountOperations(IConsoleWriter consoleWriter, IInputReader inputReader, IValidateInput validateInput, IShowUser showUser, IExchangeRatesProvider exchangeRatesProvider, ITransactionService transactionService)
 {
     _consoleWriter         = consoleWriter;
     _validateInput         = validateInput;
     _showUser              = showUser;
     _exchangeRatesProvider = exchangeRatesProvider;
     _transactionService    = transactionService;
     _inputReader           = inputReader;
 }
Ejemplo n.º 5
0
 // USED FOR TESTING
 public SampleService(
     IGetDataService dataService = null,
     IMapperService mapperService = null,
     IValidateInput validateInput = null)
 {
     // Poor Man's Dependency Injection
     _dataService = dataService ?? new GetDataService();
     _mapperService = mapperService ?? new MapperService();
     _validationInput = validateInput ?? new ValidateInput();
 }
        private IValidateInput ValidateNewChild(DependencyObject newChild)
        {
            IValidateInput validateInput = newChild as IValidateInput;

            if (newChild != null && validateInput == null)
            {
                throw new InvalidOperationException(string.Format("Child of ValidateInputWrapper should be a {0} instance", typeof(IValidateInput)));
            }

            return(validateInput);
        }
Ejemplo n.º 7
0
 private void RegisterValidationErrorEvent( IValidateInput validationElement, bool isRegistering )
 {
   if( validationElement != null )
   {
     if( isRegistering )
     {
       validationElement.InputValidationError += new InputValidationErrorEventHandler( this.OnInputValidationError );
     }
     else
     {
       validationElement.InputValidationError -= new InputValidationErrorEventHandler( this.OnInputValidationError );
     }
   }
 }
 private void RegisterValidationErrorEvent(IValidateInput validationElement, bool isRegistering)
 {
     if (validationElement != null)
     {
         if (isRegistering)
         {
             validationElement.InputValidationError += new InputValidationErrorEventHandler(this.OnInputValidationError);
         }
         else
         {
             validationElement.InputValidationError -= new InputValidationErrorEventHandler(this.OnInputValidationError);
         }
     }
 }
        protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved)
        {
            base.OnVisualChildrenChanged(visualAdded, visualRemoved);

            if (visualAdded != null)
            {
                IValidateInput validateInput = ValidateNewChild(visualAdded);
                RegisterValidationErrorEvent(validateInput, true);
                this.Child.AddHandler(UIElement.KeyDownEvent, new KeyEventHandler(HandleKeyDown), true);
            }
            if (visualRemoved != null)
            {
                RegisterValidationErrorEvent(visualRemoved as IValidateInput, false);
                this.Child.RemoveHandler(UIElement.KeyDownEvent, new KeyEventHandler(HandleKeyDown));
            }
        }
Ejemplo n.º 10
0
 private void HandleKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         // The DatePicker (and UpDownBase<T> OnValidationError) sets this as handled, which breaks the DataGrid commit.
         e.Handled = false;
     }
     if (e.Key == Key.Tab)
     {
         // We must commit the value before the tab is handled by the
         // DataGrid, or the ValidationError event won't be triggered.
         IValidateInput validationElement = this.Child as IValidateInput;
         if (validationElement != null)
         {
             validationElement.CommitInput();
         }
     }
 }
Ejemplo n.º 11
0
 public void Setup()
 {
     _ValidInput = new ValidateInput();
     _Donor = new Donor();
     _Repository = new Mock<IRepository>();
 }
Ejemplo n.º 12
0
 public void Setup()
 {
     _ValidInput = new ValidateInput();
 }
 protected TransitReportBase(IValidateInput inputValidation,
                             ITransitRepository transitRepo)
 {
     _inputValidation = inputValidation;
     _transitRepo     = transitRepo;
 }
 public PPDCTransitReport([Dependency("PPDC")] IValidateInput inputValidation,
                          [Dependency("PPDC")] ITransitRepository transitRepo) : base(inputValidation, transitRepo)
 {
 }
 public RegisterToExchange(IConsoleWriter consoleWriter, IValidateInput validateInput, IUserService userService)
 {
     _consoleWriter = consoleWriter;
     _validateInput = validateInput;
     _userService   = userService;
 }