Пример #1
0
        protected TaskViewModel(ILogger logger, ITask task, string name, string description, object icon)
        {
            if (logger == null)
                throw new ArgumentNullException("logger");
            if (task == null)
                throw new ArgumentNullException("task");
            if (name == null)
                throw new ArgumentNullException("name");
            if (description == null)
                throw new ArgumentNullException("description");
            if (icon == null)
                throw new ArgumentNullException("icon");

            this.logger = logger;
            this.task = task;
            this.name = name;
            this.description = description;
            this.icon = icon;

            task.AddStoppedCallback(() => OnStopped());
            task.AddCancelledCallback(() => OnCancelled());
            task.AddCompletedCallback(() => OnCompleted());
            task.AddErrorCallback(error => OnError(error));
            task.AddFailedCallback(() => OnFailed());
            task.AddPausedCallback(() => OnPaused());
            task.AddProgressCallback(progress => OnProgressChanged(progress));
            task.AddItemChangedCallback(item => OnItemChanged(item));
            task.AddResumedCallback(() => OnResumed());
            task.AddStartedCallback(() => OnStarted());
        }
Пример #2
0
        public void AddErrorCallback(Action <TaskError> callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }

            task.AddErrorCallback(callback);
        }
Пример #3
0
        protected TaskViewModel(ILogger logger, ITask task, string name, string description, object icon)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            if (task == null)
            {
                throw new ArgumentNullException("task");
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (description == null)
            {
                throw new ArgumentNullException("description");
            }
            if (icon == null)
            {
                throw new ArgumentNullException("icon");
            }

            this.logger      = logger;
            this.task        = task;
            this.name        = name;
            this.description = description;
            this.icon        = icon;

            task.AddStoppedCallback(() => OnStopped());
            task.AddCancelledCallback(() => OnCancelled());
            task.AddCompletedCallback(() => OnCompleted());
            task.AddErrorCallback(error => OnError(error));
            task.AddFailedCallback(() => OnFailed());
            task.AddPausedCallback(() => OnPaused());
            task.AddProgressCallback(progress => OnProgressChanged(progress));
            task.AddItemChangedCallback(item => OnItemChanged(item));
            task.AddResumedCallback(() => OnResumed());
            task.AddStartedCallback(() => OnStarted());
        }