Ejemplo n.º 1
0
		public RelayCommand(Action execute, PredicateDelegate canExecute)
		{
			if (execute == null)
				throw new ArgumentNullException("execute");

			_execute = execute;
			_canExecute = (object obj) => { return canExecute(); };
		}
Ejemplo n.º 2
0
		public RelayCommand(Action execute, Predicate<object> canExecute)
		{
			if (execute == null)
				throw new ArgumentNullException("execute");

			_execute = execute;
			_canExecute = canExecute;
		}
Ejemplo n.º 3
0
        public void RemoveFilter(Predicate<object> filter)
        {
            if (m_filters.Contains(filter))
            {
                m_filters.Remove(filter);

                TriggerEvent(this, new GroupFilterEventArgs(GroupFilterEvent.FILTER_MODIFIED));
            }
        }
Ejemplo n.º 4
0
        public void Set(Predicate<object> _filter)
        {
            Debug.Assert(_filter != null);

            Clear();

            m_filter = new Predicate<object>(_filter);
            m_parent.AddFilter(m_filter);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RelayCommand"/> class.
        /// </summary>
        /// <param name="execute">The execute.</param>
        /// <param name="canExecute">The can execute.</param>
        /// <exception cref="System.ArgumentNullException">execute</exception>
        public RelayCommand(Action<object> execute, Predicate<object> canExecute)
        {
            if (execute == null)
            {
                throw new ArgumentNullException("execute");
            }

            this.execute = execute;
            this.canExecute = canExecute;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Gets all worker roles that matches given predicate.
 /// </summary>
 /// <param name="predicate">The matching predicate</param>
 /// <returns>Matched items</returns>
 public IEnumerable<WorkerRole> GetWorkerRoles(Predicate<WorkerRole> predicate)
 {
     return Array.FindAll<WorkerRole>(Definition.WorkerRole, predicate);
 }
Ejemplo n.º 7
0
 public AssemblySpecification(Predicate<string> filter)
 {
     This = new None<Assembly>();
     Filter = filter;
 }
Ejemplo n.º 8
0
        private static int ReadInputUntilValid(Predicate<int> condition, string errorMessage = "Invalid Selection!")
        {
            var conditionMet = false;
            var input = -1;

            while (!conditionMet)
            {
                input = ReadInputUntilValid();
                conditionMet = condition(input);

                if (!conditionMet)
                {
                    Console.WriteLine(errorMessage);
                }
            }

            return input;
        }
Ejemplo n.º 9
0
        public void AddFilter(Predicate<object> filter)
        {
            m_filters.Add(filter);

            TriggerEvent(this, new GroupFilterEventArgs(GroupFilterEvent.FILTER_MODIFIED));
        }
Ejemplo n.º 10
0
 public Predicate Or(Predicate predicate)
 {
     return new Predicate(this.condition || predicate.Evaluate());
 }
Ejemplo n.º 11
0
 public Predicate And(Predicate predicate)
 {
     return new Predicate(this.condition && predicate.Evaluate());
 }