private void lstUpgrades_MouseDown(object sender, MouseEventArgs e) { var item = lstUpgrades.GetItemAt(e.X, e.Y); if (item != null) { if (e.Button == MouseButtons.Left) { // how many to add? var amount = 1; if (ModifierKeys.HasFlag(Keys.Shift)) { amount *= 10; } if (ModifierKeys.HasFlag(Keys.Control)) { amount *= 100; } var upgrade = (FacilityUpgrade)item.Tag; for (int i = 0; i < amount; i++) { var order = new UpgradeFacilityOrder(upgrade); ConstructionQueue.Orders.Add(order); var cmd = new AddOrderCommand ( ConstructionQueue, order ); newCommands.Add(cmd); } BindQueueListView(); IEnumerable <FacilityTemplate> templates; if (chkOnlyLatest.Checked) { templates = Empire.Current.UnlockedItems.OfType <FacilityTemplate>().Where(f => f.Cost.Any()).OnlyLatestVersions(f => f.Family); } else { templates = Empire.Current.UnlockedItems.OfType <FacilityTemplate>().Where(f => f.Cost.Any()); } BindUpgradeListView(templates); } else if (e.Button == MouseButtons.Right) { var facil = (FacilityUpgrade)item.Tag; var report = new FacilityReport(facil); var form = report.CreatePopupForm(facil.New.Name); FindForm().ShowChildForm(form); } } }
private void lstFacilities_MouseDown(object sender, MouseEventArgs e) { var item = lstFacilities.GetItemAt(e.X, e.Y); if (item != null) { if (e.Button == MouseButtons.Left) { // how many to add? var amount = 1; if (ModifierKeys.HasFlag(Keys.Shift)) { amount *= 10; } if (ModifierKeys.HasFlag(Keys.Control)) { amount *= 100; } var template = (FacilityTemplate)item.Tag; for (int i = 0; i < amount; i++) { var order = new ConstructionOrder <Facility, FacilityTemplate> { Template = template }; ConstructionQueue.Orders.Add(order); var cmd = new AddOrderCommand ( ConstructionQueue, order ); newCommands.Add(cmd); } BindQueueListView(); } else if (e.Button == MouseButtons.Right) { var facil = (FacilityTemplate)item.Tag; var report = new FacilityReport(facil); var form = report.CreatePopupForm(facil.Name); FindForm().ShowChildForm(form); } } }