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

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

			_execute = execute;
			_canExecute = canExecute;
		}
Esempio 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));
            }
        }
Esempio 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);
        }
Esempio 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;
        }
 /// <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);
 }
 public AssemblySpecification(Predicate<string> filter)
 {
     This = new None<Assembly>();
     Filter = filter;
 }
        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;
        }
Esempio n. 9
0
        public void AddFilter(Predicate<object> filter)
        {
            m_filters.Add(filter);

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