Exemplo n.º 1
0
        /// <summary>
        /// The remove task.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="task">
        /// The task.
        /// </param>
        private void RemoveTask(IUserTaskChanged sender, UserTaskModel task)
        {
            if (this.userTaskManager.Tasks.Contains(task))
            {
                this.userTaskManager.Tasks.Remove(task);
            }

            sender.UpdateTasks();
        }
Exemplo n.º 2
0
        /// <summary>
        /// The add task.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="task">
        /// The task.
        /// </param>
        private void AddTask(IUserTaskChanged sender, UserTaskModel task)
        {
            if (!this.userTaskManager.Tasks.Contains(task))
            {
                this.userTaskManager.Tasks.Add(task);
            }

            this.taskClients.ToList().ForEach(client => client.UpdateTasks());
        }
Exemplo n.º 3
0
        /// <summary>
        /// The remove client.
        /// </summary>
        /// <param name="client">
        /// The client.
        /// </param>
        public void RemoveClient(IUserTaskChanged client)
        {
            if (!this.taskClients.Contains(client))
            {
                return;
            }

            this.taskClients.Remove(client);

            client.TaskAdded   -= this.AddTask;
            client.TaskRemoved -= this.RemoveTask;
        }
Exemplo n.º 4
0
        /// <summary>
        /// The add client.
        /// </summary>
        /// <param name="client">
        /// The client.
        /// </param>
        public void AddClient(IUserTaskChanged client)
        {
            if (this.taskClients == null)
            {
                this.taskClients = new ObservableCollection <IUserTaskChanged>();
            }

            if (this.taskClients.Contains(client))
            {
                return;
            }

            this.taskClients.Add(client);

            client.TaskAdded   += this.AddTask;
            client.TaskRemoved += this.RemoveTask;
        }
Exemplo n.º 5
0
 /// <summary>
 /// The on task removed.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="task">
 /// The task.
 /// </param>
 protected virtual void OnTaskRemoved(IUserTaskChanged sender, UserTaskModel task)
 {
     this.TaskRemoved?.Invoke(sender, task);
 }