Esempio n. 1
0
        public static SOBGroup GetByName(string name)
        {
            SOBGroup SOBGroup = null;

            foreach (SOBGroup group in SOBGroups)
            {
                if (group.Name == name)
                {
                    SOBGroup = group;
                    break;
                }
            }

            return(SOBGroup);
        }
Esempio n. 2
0
        public static SOBGroup GetByItemIndex(int itemIndex)
        {
            SOBGroup SOBGroup = null;

            foreach (SOBGroup group in SOBGroups)
            {
                if (group.ItemIndex == itemIndex)
                {
                    SOBGroup = group;
                    break;
                }
            }

            return(SOBGroup);
        }
Esempio n. 3
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is string)
            {
                SOBGroup type = SOBGroup.GetByName((string)value);

                if (type != null)
                {
                    return(type);
                }
                else
                {
                    return(null);
                }
            }
            return(base.ConvertFrom(context, culture, value));
        }
Esempio n. 4
0
        public static void AddToSOBGroup(string squadronName, string sobGroupName)
        {
            Squadron squadron = Squadron.GetByName(squadronName);
            SOBGroup sobGroup = SOBGroup.GetByName(sobGroupName);

            if (squadron == null)
            {
                new Problem(ProblemTypes.WARNING, "Squadron \"" + squadronName + "\" not found. Skipping adding to SOB group \"" + sobGroupName + "\".");
                return;
            }
            if (sobGroup == null)
            {
                new Problem(ProblemTypes.WARNING, "SOB group \"" + sobGroupName + "\" not found. Skipping adding \"" + squadronName + "\" to group.");
                return;
            }

            sobGroup.AddSquadron(squadron);
        }
Esempio n. 5
0
        public void RemoveSOBGroup(SOBGroup group)
        {
            ignoreListSOBGroups_SelectedIndexChanged = true;
            listSOBGroups.Items.RemoveAt(group.ItemIndex);

            foreach (SOBGroup sobGroup in SOBGroup.SOBGroups)
            {
                if (sobGroup.ItemIndex > group.ItemIndex)
                {
                    sobGroup.ItemIndex--;
                }
            }

            listSOBGroups.ClearSelected();
            ignoreListSOBGroups_SelectedIndexChanged = false;
            SOBGroup.CurrentSelected = null;
            listSOBGroups_SelectedIndexChanged(this, EventArgs.Empty);
        }
Esempio n. 6
0
        private void listSOBGroups_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ignoreListSOBGroups_SelectedIndexChanged)
            {
                return;
            }

            if (listSOBGroups.SelectedItem == null)
            {
                buttonRemoveSOBGroup.Enabled = false;
                buttonAddSquadron.Enabled    = false;
                buttonRemoveSquadron.Enabled = false;
                comboSquadrons.Enabled       = false;
                comboSquadrons.SelectedItem  = null;
                boxSOBGroupName.Text         = string.Empty;
                boxSOBGroupName.Enabled      = false;
                listSquadrons.Enabled        = false;
                listSquadrons.Items.Clear();

                return;
            }

            SOBGroup.CurrentSelected = SOBGroup.GetByItemIndex(listSOBGroups.SelectedIndex);
            boxSOBGroupName.Text     = SOBGroup.CurrentSelected.Name;

            listSquadrons.Items.Clear();
            foreach (Squadron squadron in SOBGroup.CurrentSelected.Squadrons)
            {
                squadron.ItemIndex = listSquadrons.Items.Add(squadron.Name);
            }

            buttonRemoveSOBGroup.Enabled = true;
            buttonAddSquadron.Enabled    = true;
            buttonRemoveSquadron.Enabled = false;
            boxSOBGroupName.Enabled      = true;
            comboSquadrons.Enabled       = true;
            listSquadrons.Enabled        = true;
        }
Esempio n. 7
0
        private void buttonAddSOBGroup_Click(object sender, EventArgs e)
        {
            SOBGroup newGroup = new SOBGroup("SobGroup_" + (SOBGroup.SOBGroups.Count + 1));

            listSOBGroups.SelectedIndex = newGroup.ItemIndex;
        }
Esempio n. 8
0
 //-------------------- SOB GROUPS -----------------------//
 public void AddSOBGroup(SOBGroup group)
 {
     group.ItemIndex = listSOBGroups.Items.Add(group.Name);
 }