Example #1
0
 public void When(TaskUpdated taskUpdated)
 {
     if (string.IsNullOrEmpty(Description) && string.IsNullOrEmpty(Name))
     {
         throw new Exception();
     }
 }
            public void Apply(TaskUpdated @event)
            {
                var task = List.SingleOrDefault(t => t.TaskId == @event.TaskId);

                if (task == null)
                {
                    return;
                }

                task.Description = @event.Description;
            }
Example #3
0
        private TestEvents.FakeEvent GetTaskUpdatedEvent()
        {
            TestEvents.FakeEvent result = new TestEvents.FakeEvent(this, EventType.TaskUpdated
                                                                   );
            TaskUpdated datum = new TaskUpdated();

            datum.finishTime = 2;
            datum.taskid     = "ID";
            result.SetDatum(datum);
            return(result);
        }
Example #4
0
 public void SelectTask(Guid id)
 {
     if (_tasks.All(memberVm => memberVm.Id != id))
     {
         return;
     }
     {
         SelectedTask = _tasks.SingleOrDefault(memberVm => memberVm.Id == id);
         TaskUpdated?.Invoke(this, null);
     }
 }
Example #5
0
        /// <summary>
        /// Cleans up event handlers when finished using this object
        /// </summary>
        public virtual void Dispose()
        {
            foreach (Delegate d in TaskAdded.GetInvocationList())
            {
                TaskAdded -= (EventHandler <TaskConqueror.TaskAddedEventArgs>)d;
            }

            foreach (Delegate d in TaskUpdated.GetInvocationList())
            {
                TaskUpdated -= (EventHandler <TaskConqueror.TaskUpdatedEventArgs>)d;
            }

            foreach (Delegate d in TaskDeleted.GetInvocationList())
            {
                TaskDeleted -= (EventHandler <TaskConqueror.TaskDeletedEventArgs>)d;
            }
        }
Example #6
0
        public async Task UpdateTask(TaskViewModel taskViewModel)
        {
            var result = await Update(taskViewModel.ToUpdateTaskCommand());

            Console.WriteLine(JsonSerializer.Serialize(result));

            if (result != null)
            {
                var updatedList = (await GetAllTasks()).Payload;

                if (updatedList != null)
                {
                    _tasks = updatedList;
                    TaskUpdated?.Invoke(this, null);
                    return;
                }
                UpdateTaskFailed?.Invoke(this, "The save was successful, but we can no longer get an updated list of members from the server.");
            }

            UpdateTaskFailed?.Invoke(this, "Unable to save changes.");
        }
Example #7
0
        public void Start()
        {
            _stoped = false;
            TrackTask trackTask = null;

            while (!_stoped)
            {
                trackTask = _taskProvider.GetPlannedTask();

                if (trackTask != null)
                {
                    //if we have enough resources to execute task
                    if (_runningTasks.Count() < _tasksMaximum || trackTask.Track.ServiceUser.Subscripe.Priority != Priority.Low)
                    {
                        _taskProvider.UpdateTaskStatus(trackTask.Id, TrackTaskStatus.Started);
                        TaskUpdated?.Invoke(this, trackTask);
                        //Async execute task
                        var executingTask = trackTask;
                        var task          = _taskFactory.StartNew(async() =>
                        {
                            //Execute task
                            var status = await _taskExecutor.ExecuteTask(executingTask);
                            _taskProvider.UpdateTaskStatus(executingTask.Id, status);
                            _taskProvider.UpdateTargetContent(executingTask.Id, executingTask.Track.TargetContent);
                            //User must knows about his track
                            _userNotifier.NotifyUser(executingTask);
                            TaskUpdated?.Invoke(this, executingTask);
                        });
                        _runningTasks.Add(task);
                        task.ContinueWith((t) =>
                        {
                            _runningTasks.Remove(t);
                        });
                    }
                }
            }
        }
Example #8
0
 public virtual void SetDatum(object datum)
 {
     this.datum = (TaskUpdated)datum;
 }
 internal void ApplyEvent(TaskUpdated @event)
 {
     Descriptions[@event.TaskId] = @event.Description;
 }
            public void Apply(TaskUpdated @event)
            {
                var task = List.Single(t => t.TaskId == @event.TaskId);

                task.Description = @event.Description;
            }
 private void Persist(TaskDescriptionView view, TaskUpdated @event)
 {
     view.ApplyEvent(@event);
 }
Example #12
0
 public void SelectNullTask()
 {
     SelectedTask = null;
     TaskUpdated?.Invoke(this, null);
 }
Example #13
0
 public void Apply(TaskUpdated @event)
 {
     Description = $"New Logic: {@event.Description}";
 }
Example #14
0
 public void Apply(TaskUpdated @event)
 {
     Description = @event.Description;
 }
Example #15
0
 public void SubscribeToTaskUpdate(TaskUpdated func)
 {
     taskUpdated += func;
 }
Example #16
0
 public void CallbackTaskList()
 {
     TaskUpdated?.Invoke(this, null);
 }
Example #17
0
 public async void LoadTasks()
 {
     _tasks = (await GetAllTasks()).Payload;
     TaskUpdated?.Invoke(this, null);
 }