Exemplo n.º 1
0
 /// <summary>
 /// Handles the <see cref="INotifyCollectionChanged.CollectionChanged"/> event of the view model's
 /// installed mod list.
 /// </summary>
 /// <remarks>
 /// This updates the list of mods to refelct changes to the installed mod list.
 /// </remarks>
 /// <param name="sender">The object that raised the event.</param>
 /// <param name="e">A <see cref="NotifyCollectionChangedEventArgs"/> describing the event arguments.</param>
 private void TaskList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
     case NotifyCollectionChangedAction.Add:
     case NotifyCollectionChangedAction.Remove:
         lock (m_objLock)
         {
             if ((RunningTask == null) || ((RunningTask.Status != BackgroundTasks.TaskStatus.Queued) && (RunningTask.Status != BackgroundTasks.TaskStatus.Running) && (RunningTask.Status != BackgroundTasks.TaskStatus.Retrying)))
             {
                 if ((TaskList != null) && (TaskList.Count > 0))
                 {
                     lock (TaskList)
                     {
                         WriteLoadOrderTask NextTask = TaskList.FirstOrDefault();
                         RunningTask            = NextTask;
                         RunningTask.TaskEnded += new EventHandler <TaskEndedEventArgs>(RunningTask_TaskEnded);
                         NextTask.Update();
                     }
                 }
             }
         }
         break;
     }
 }