Exemple #1
0
 public static void ChangeJobPriority(MVMCollectionSyncher <T> jobBatchList, T job, int delta)
 {
     lock (jobBatchList) //prevent threaded race conditions
     {
         //first check that the job does still exsist in the list.
         if (jobBatchList.Contains(job))
         {
             int currentIndex = jobBatchList.IndexOf(job);
             int newIndex     = currentIndex + delta;
             if (newIndex <= 0)
             {
                 jobBatchList.RemoveAt(currentIndex);
                 jobBatchList.Insert(0, job);
             }
             else if (newIndex >= jobBatchList.Count - 1)
             {
                 jobBatchList.RemoveAt(currentIndex);
                 jobBatchList.Add(job);
             }
             else
             {
                 jobBatchList.RemoveAt(currentIndex);
                 jobBatchList.Insert(newIndex, job);
             }
         }
     }
 }
Exemple #2
0
        public JobAbilityBaseVM(StaticDataStore staticData, Entity colonyEntity)
        {
            //JobChangePriorityCommand = new JobPriorityCommand<TDataBlob, TJob>(this);

            _staticData_   = staticData;
            _colonyEntity_ = colonyEntity;

            _jobCollectionSyncher = new MVMCollectionSyncher <TJob>(DataBlob.JobBatchList);
            _jobCollectionSyncher.CollectionChanged += _jobCollectionSyncher_CollectionChanged;

            SetupJobs();
        }