/// <Summary> /// Add to queue button pressed. /// </Summary> /// <param name="sender">The source of the event.</param> /// <param name="e">A <see cref="EventArgs"/> that contains the event data.</param> private void AddToQueue_Click(object sender, System.EventArgs e) { if (designList.SelectedItems.Count <= 0) { return; } IProductionUnit productionUnit = designList.SelectedItems[0].Tag as IProductionUnit; // Starbases are handled differently to the other component types. // Ctrl-Add + 100 items // shift-Add +10 items // Add +1 items int quantity = 1; if (Button.ModifierKeys == Keys.Control) { quantity = 100; } else if (Button.ModifierKeys == Keys.Shift) { quantity = 10; } ProductionOrder productionOrder = new ProductionOrder(quantity, productionUnit, false); AddProduction(productionOrder); }
/// <summary> /// initializing constructor. /// </summary> /// <param name="quantity">The number of items to produce.</param> /// <param name="design">The <see cref="Design"/> to build.</param> public ProductionOrder(int quantity, IProductionUnit productionUnit, bool isAutoBuild) { Quantity = quantity; Unit = productionUnit; IsAutoBuild = isAutoBuild; }