Пример #1
0
        internal void Run()
        {
            _isRequestedToStop = false;

            while (!_isRequestedToStop)
            {
                MVVQueueCommand cmd = _queue.Pop();

                if (cmd != null)
                {
                    _isBusy = true;

                    try
                    {
                        cmd.worker = this;

                        cmd.ExecuteCommand();
                        cmd.OnComplete();
                    }
                    catch (Exception ex)
                    {
                        cmd.OnError(ex);
                        _isBusy = false;

                        Console.WriteLine(ex.ToString());

                        throw ex;
                    }
                    _isBusy = false;
                }

                Thread.Sleep(1);
            }
        }