Esempio n. 1
0
        public void SetQueue(QueueDictionary queue, SlotType type, bool utcOffsetIsZero)
        {
            if (queue != null)
            {
                _queue           = queue;
                _slotType        = type;
                _utcOffsetIsZero = utcOffsetIsZero;

                cboQueueIndex.SelectedIndexChanged -= cboQueueIndex_SelectedIndexChanged;
                cboQueueIndex.DataSource            = CreateEntryNameCollection(_queue);
                cboQueueIndex.DisplayMember         = "DisplayMember";
                cboQueueIndex.ValueMember           = "ValueMember";
                cboQueueIndex.SelectedIndex         = -1;
                cboQueueIndex.SelectedIndexChanged += cboQueueIndex_SelectedIndexChanged;

                cboQueueIndex.SelectedValue = _queue.CurrentIndex;
            }
            else
            {
                _queue           = null;
                _slotType        = SlotType.Unknown;
                _utcOffsetIsZero = false;
                SetControlsVisible(false);
            }
        }
Esempio n. 2
0
 private static ICollection <ListItem> CreateEntryNameCollection(QueueDictionary queue)
 {
     return(queue.Select(kvp => new ListItem
     {
         DisplayMember = String.Format(CultureInfo.InvariantCulture, "{0} - {1}", kvp.Key, kvp.Value.ToShortProjectString()),
         ValueMember = kvp.Key
     }).ToList().AsReadOnly());
 }
Esempio n. 3
0
        public void SetQueue(QueueDictionary queue, SlotType slotType)
        {
            if (InvokeRequired)
            {
                Invoke(new Action <QueueDictionary, SlotType>(SetQueue), queue, slotType);
                return;
            }

            queueControl.SetQueue(queue, slotType);
        }
Esempio n. 4
0
        public void SetQueue(QueueDictionary queue, SlotType slotType, bool utcOffsetIsZero)
        {
            if (InvokeRequired)
            {
                Invoke(new Action <QueueDictionary, SlotType, bool>(SetQueue), queue, slotType, utcOffsetIsZero);
                return;
            }

            queueControl.SetQueue(queue, slotType, utcOffsetIsZero);
        }
Esempio n. 5
0
    public AbstractMap()
    {
        // this.History = new RingBuffer<HistoryItem>(AbstractMap.HISTORY_SIZE);
        // this.History.OnOverflow = item => item.Slot.Forget();
        this.RemovalQueue = new QueueDictionary <Vector3Int, ModuleSet>(() => new ModuleSet());
        this.BuildQueue   = new Queue <Slot>();

        this.InitialModuleHealth = this.createInitialModuleHealth(ModuleData.Current);

        this.backtrackBarrier = 0;
    }
Esempio n. 6
0
    public AbstractMap()
    {
        InfiniteMap.Random = new System.Random();

        this.History      = new RingBuffer <HistoryItem>(AbstractMap.HISTORY_SIZE);
        this.RemovalQueue = new QueueDictionary <Vector3i, ModuleSet>(() => new ModuleSet());
        this.BuildQueue   = new Queue <Slot>();

        this.InitialModuleHealth = this.createInitialModuleHealth(Module.All);

        this.backtrackBarrier = 0;
    }
Esempio n. 7
0
        private static QueueDictionary BuildQueueDictionary(IEnumerable <Unit> unitCollection, Info info, SlotOptions slotOptions, int slotId)
        {
            QueueDictionary cq = null;

            foreach (var unit in unitCollection.Where(unit => unit.Slot == slotId))
            {
                // don't create a queue until we find a unit that matches this slot id
                if (cq == null)
                {
                    cq = new QueueDictionary {
                        CurrentIndex = -1
                    };
                }

                var cqe = new QueueUnitItem();
                cqe.EntryStatusLiteral = unit.StateEnum.ToString();
                cqe.WaitingOn          = unit.WaitingOn;
                cqe.Attempts           = unit.Attempts;
                cqe.NextAttempt        = unit.NextAttemptTimeSpan.GetValueOrDefault();
                cqe.NumberOfSmpCores   = info.System.CpuCount;
                cqe.BeginTimeUtc       = unit.AssignedDateTime.GetValueOrDefault();
                cqe.BeginTimeLocal     = unit.AssignedDateTime.GetValueOrDefault().ToLocalTime();
                cqe.ProjectID          = unit.Project;
                cqe.ProjectRun         = unit.Run;
                cqe.ProjectClone       = unit.Clone;
                cqe.ProjectGen         = unit.Gen;
                cqe.MachineID          = slotId;
                cqe.ServerIP           = unit.WorkServer;
                cqe.CpuString          = GetCpuString(info, slotOptions);
                cqe.OsString           = ToOperatingSystemString(info.System);
                // Memory Value is in Gigabytes - turn into Megabytes and truncate
                cqe.Memory = (int)(info.System.MemoryValue.GetValueOrDefault() * 1024);
                cq.Add(unit.Id, cqe);

                if (unit.StateEnum == UnitState.Running)
                {
                    cq.CurrentIndex = unit.Id;
                }
            }

            if (cq != null)
            {
                // if no running index and at least something in the queue
                if (cq.CurrentIndex == -1 && cq.Count != 0)
                {
                    // take the minimum queue id
                    cq.CurrentIndex = cq.Keys.First();
                }
            }

            return(cq);
        }
Esempio n. 8
0
 public ConnectionPool(Hashtable hashMap)
 {
     this._connections      = Hashtable.Synchronized(new Hashtable(5));
     this.loadBalancerQueue = new QueueDictionary <Address>();
     if (hashMap != null)
     {
         this._hashMap = (!hashMap.IsSynchronized) ? Hashtable.Synchronized(hashMap) : hashMap;
     }
     else
     {
         this._hashMap  = Hashtable.Synchronized(new Hashtable());
         _hashMapMember = new ArrayList();
     }
 }
Esempio n. 9
0
 public void SetQueue(QueueDictionary queue)
 {
     SetQueue(queue, SlotType.Unknown, false);
 }