Esempio n. 1
0
 public void PopulateSquadDropDownMenuItems()
 {
     foreach (var item in Registry.SquadNamesSet.Select(name => new ToolStripMenuItem(name)))
     {
         item.Click += OnSquadClicked;
         SquadsMenuItem.Add(item);
     }
 }
Esempio n. 2
0
        private void OnSquadClicked(object sender, EventArgs args)
        {
            var selectedSquad = "";

            try
            {
                if (FindAndWarnOnOpenLoaderDialog() || FindAndWarnOnOpenDeletePilotWindowDialog())
                {
                    return;
                }

                var clicked = SquadsMenuItem.Cast <ToolStripItem>().SingleOrDefault(item => item.Pressed);

                selectedSquad = clicked.Text;
                BuildAndDisplaySquadForm(selectedSquad, Registry.GetSquad(selectedSquad));
            }
            catch (SquadDoesNotExistInRegistryException e)
            {
                Utility.WriteDebugTraceFile(e);
                MessageBox.Show(string.Format("Failed to compile squad \"{0}\" data.\nCheck that the pilots nominated in your squad have data.", selectedSquad));
            }
        }