Пример #1
0
 private void SetBusy
 (
     bool busy
 )
 {
     Busy = busy;
     BusyChanged?.Invoke(this, EventArgs.Empty);
 } // method SetBusy
Пример #2
0
        /// <summary>
        /// Invokes all rules for the business type.
        /// </summary>
        /// <param name="timeout">Timeout value in milliseconds</param>
        /// <returns>
        /// Returns a list of property names affected by the invoked rules.
        /// The PropertyChanged event should be raised for each affected
        /// property. Does not return until all async rules are complete.
        /// </returns>
        public async Task <List <string> > CheckRulesAsync(int timeout)
        {
            var result = CheckRules();

            if (RunningAsyncRules)
            {
                var tasks = new Task[] { BusyChanged.WaitAsync(), Task.Delay(timeout) };
                var final = await Task.WhenAny(tasks);

                if (final == tasks[1])
                {
                    throw new TimeoutException(nameof(CheckRulesAsync));
                }
            }
            return(result);
        }
Пример #3
0
 private void RaiseBusyChanged(bool newIsBusy)
 {
     BusyChanged?.Invoke(this, newIsBusy);
 }