PopulateVertexComboBox
        (
            ComboBox cbxVertex
        )
        {
            Debug.Assert(cbxVertex != null);
            AssertValid();

            // Save the ObjectWithText that is selected in the vertex ComboBox, if
            // there is one.

            ObjectWithText oOldSelectedObjectWithText =
                (ObjectWithText)cbxVertex.SelectedItem;

            ComboBox.ObjectCollection oItems = cbxVertex.Items;
            oItems.Clear();

            foreach (DataGridViewRow oDataGridViewRow in dgvSourceColumns.Rows)
            {
                if ((Boolean)oDataGridViewRow.Cells[IsEdgeColumnIndex].Value)
                {
                    oItems.Add((ObjectWithText)oDataGridViewRow.Cells[
                                   ColumnNameIndex].Value);
                }
            }

            cbxVertex.SelectedItem = oOldSelectedObjectWithText;
        }
示例#2
0
 public FFTypeDescriptor SetContext([CanBeNull] object obj, [CanBeNull] IEnumerable <ITitled> scope, [CanBeNull] Action <object, FFTypeDescriptor> onSelectedObjectChanged)
 {
     _SelectedObjectChanged = onSelectedObjectChanged;
     ComboBox.ObjectCollection items = cbScope.Items;
     items.Clear();
     if (cbScope.Enabled = scope != null && obj != null)
     {
         foreach (var t in scope)
         {
             items.AddTitledItem(t);
         }
     }
     else
     {
         var t = obj as ITitled;
         if (t != null)
         {
             items.AddTitledItem(t);
         }
         else
         {
             if (obj != null)
             {
                 items.Add(obj.ToString());
             }
         }
     }
     return(SetCurrentObject(obj));
 }
示例#3
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService editorService = null;

            if (context != null && context.Instance != null && provider != null)
            {
                editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (editorService != null)
                {
                    CustomPropertyCollection  cbx   = (CustomPropertyCollection)context.Instance;
                    ComboBox.ObjectCollection coc   = (ComboBox.ObjectCollection)cbx[6].Value;
                    FormComboBoxItem          form2 = new FormComboBoxItem();

                    if (null != coc && coc.Count > 0)
                    {
                        form2.ExplainData = coc[0] as ComboBoxItemData;
                    }
                    if (DialogResult.OK == editorService.ShowDialog(form2))
                    {
                        coc.Clear();
                        coc.Add(form2.ExplainData);

                        value = coc;
                    }
                    return(value);
                }
            }

            return(value);
        }
示例#4
0
        private void FindAvailableDates(Job job)
        {
            availableYears.Clear();
            availableMonths.Clear();
            availableDays.Clear();

            job.ForEach(x => AddDateToFilterPanel(x.Date));
        }
示例#5
0
 public static void CopyToFromObjectCollection(ComboBox.ObjectCollection fromItems, ComboBox.ObjectCollection toItems)
 {
     toItems.Clear();
     for (int i = 0; i < fromItems.Count; i++)
     {
         toItems.Add(fromItems[i]);
     }
 }
示例#6
0
        ////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////
        #region Serial port

        /// <summary>
        /// Updates toolStripMenuItemSerialPort DropDownItems to include all available serial port.
        /// </summary>
        private void RefreshSerialPortAList()
        {
            ComboBox.ObjectCollection comboBoxCollection = comboBoxPortA.Items;
            comboBoxCollection.Clear();
            comboBoxCollection.Add("Refresh List");
            foreach (string portName in System.IO.Ports.SerialPort.GetPortNames())
            {
                comboBoxCollection.Add("COM" + Regex.Replace(portName.Substring("COM".Length, portName.Length - "COM".Length), "[^.0-9]", "\0"));
            }
        }
示例#7
0
 private void arrayCheckBoxToComboItems(CheckBox [] arrayCheckBox, ComboBox.ObjectCollection items)
 {
     items.Clear();
     for (int i = 1; i < arrayCheckBox.Length; i++)
     {
         if (arrayCheckBox[i].Checked)
         {
             items.Add(arrayCheckBox[i].Text);
         }
     }
 }
        private void ResortComboBoxItemCollection(ComboBox.ObjectCollection coll)
        {
            var oAList = new ArrayList(coll);

            oAList.Sort(new ComboBoxItemComparer());
            coll.Clear();

            foreach (object oItem in oAList)
            {
                coll.Add(oItem);
            }
        }
示例#9
0
        PopulateWithTableColumnNames
        (
            Microsoft.Office.Interop.Excel.ListObject table
        )
        {
            Debug.Assert(table != null);
            AssertValid();

            ComboBox.ObjectCollection oItems = this.Items;
            oItems.Clear();
            oItems.AddRange(GetTableColumnNamesInternal(table));
        }
示例#10
0
        public static void ConvertStringToItems(string str, ComboBox.ObjectCollection items)
        {
            items.Clear();
            int index = str.IndexOf(';');

            while (index >= 0)
            {
                str = str.Remove(index, 1);
                int nextIndex = str.IndexOf(';');
                if (nextIndex >= 0)
                {
                    items.Add(str.Substring(index, nextIndex - index));
                    str = str.Remove(index, nextIndex - index + 1);
                }
                index = str.IndexOf(';');
            }
        }
示例#11
0
            public static TransformNode GetTransformOptions(IUIService uiService, LinkedList <TransformNode> nodes)
            {
                ImportStepOptions form = myForm;

                if (form == null)
                {
                    myForm = form = new ImportStepOptions();
                    form.TransformsCombo.SelectedValueChanged += new EventHandler(
                        delegate(object sender, EventArgs e)
                    {
                        ComboBox senderCombo       = (ComboBox)sender;
                        PropertyGrid gridControl   = ((ImportStepOptions)senderCombo.Parent).TransformOptionsPropertyGrid;
                        TransformNode selectedNode = (TransformNode)senderCombo.SelectedItem;
                        gridControl.SelectedObject = (selectedNode != null) ? selectedNode.CreateDynamicParametersTypeDescriptor() : null;
                    });
                }
                ComboBox     combo = form.TransformsCombo;
                PropertyGrid grid  = form.TransformOptionsPropertyGrid;

                ComboBox.ObjectCollection items = combo.Items;
                foreach (TransformNode node in nodes)
                {
                    items.Add(node);
                }
                combo.SelectedIndex = 0;
                if (nodes.Count == 1)
                {
                    grid.Select();
                }
                TransformNode retVal = null;

                if (DialogResult.OK == uiService.ShowDialog(form))
                {
                    TransformNode node = (TransformNode)combo.SelectedItem;
                    if (node != null)
                    {
                        node.SynchronizeArguments();
                        retVal = node;
                    }
                }
                items.Clear();
                grid.SelectedObject = null;
                return(retVal);
            }
示例#12
0
        public static void FillComboBox(ComboBox.ObjectCollection Items, string commandString,
                                        string CustomInitialDisplayValue)
        {
            Items.Clear();
            OleDbCommand    command = new OleDbCommand(commandString, dbConnection);
            OleDbDataReader reader  = command.ExecuteReader();

            if (CustomInitialDisplayValue != null)
            {
                Items.Add(CustomInitialDisplayValue);
            }

            while (reader.Read())
            {
                Items.Add(GetString(reader[0]));
            }

            reader.Close();
        }
        public void RequeryCategories()
        {
            object selected = cmbSelectedCategory.SelectedItem;             // Keep as object for null coalescing.

            ComboBox.ObjectCollection            items      = cmbSelectedCategory.Items;
            ARKDataSet.EngramCategoriesDataTable categories = new ARKDataSet.EngramCategoriesDataTable();

            engramCategoriesTableAdapter.Fill(aRKDataSet.EngramCategories);
            engramCategoriesTableAdapter.Fill(categories);
            items.Clear();
            items.Add(EngramCategoryEntry.ShowAll);

            foreach (ARKDataSet.EngramCategoriesRow row in categories)
            {
                items.Add(new EngramCategoryEntry(row));
            }

            cmbSelectedCategory.SelectedItem = selected ?? EngramCategoryEntry.ShowAll;
            // Engrams get requeried when --^ changes.
        }
示例#14
0
 private void UpdateVersions()
 {
     if (InvokeRequired)
     {
         Invoke(_updateVersionsDelegate);
     }
     else
     {
         ComboBox.ObjectCollection items = versionBox.Items;
         items.Clear();
         items.Add("Latest");
         _versions.Sort();
         _versions.Reverse();
         foreach (string s in _versions)
         {
             items.Add(s);
         }
         versionBox.SelectedIndex = 0;
     }
 }
示例#15
0
        public static void FillComboBoxValuesInt(ComboBox.ObjectCollection Items, string commandString,
                                                 string CustomInitialDisplayValue)
        {
            Items.Clear();
            OleDbCommand    command = new OleDbCommand(commandString, dbConnection);
            OleDbDataReader reader  = command.ExecuteReader();

            if (CustomInitialDisplayValue != null)
            {
                Items.Add(CustomInitialDisplayValue);
            }

            while (reader.Read())
            {
                ListItem newListItem = new ListItem();
                newListItem.Text  = reader.GetInt32(0).ToString();
                newListItem.Value = reader.GetInt32(1).ToString();
                Items.Add(newListItem);
            }

            reader.Close();
        }
示例#16
0
 public void RefreshCategories()
 {
     ResourceMgr.ResPackage[]  packages = null;
     ComboBox.ObjectCollection items    = this.categoryCMB.Items;
     items.Clear();
     packages = this.mResourceManager.Current;
     if (packages != null && packages.Length > 0)
     {
         items.Add(Category.Current);
     }
     packages = this.mResourceManager.GameCore;
     if (packages != null && packages.Length > 0)
     {
         items.Add(Category.GameCore);
     }
     packages = this.mResourceManager.GameContent;
     if (packages != null && packages.Length > 0)
     {
         items.Add(Category.GameContent);
     }
     packages = this.mResourceManager.DDSImages;
     if (packages != null && packages.Length > 0)
     {
         items.Add(Category.DDSImages);
     }
     packages = this.mResourceManager.Thumbnails;
     if (packages != null && packages.Length > 0)
     {
         items.Add(Category.Thumbnails);
     }
     packages = this.mResourceManager.CustomContent;
     if (packages != null && packages.Length > 0)
     {
         items.Add(Category.CustomContent);
     }
 }
 public static void ClearThenAddRange(this ComboBox.ObjectCollection @this, string[] data)
 {
     @this.Clear();
     @this.AddRange(data);
 }
        private void refreshButton_Click(object sender, EventArgs e)
        {
            //On refresh poll for possible IP's and populate combobox with them
            _ipAddrItems.Clear();
            foreach (string addr in WebServerScripts.GetIPAddrs())
            {
                _ipAddrItems.Add(addr);
            }
            deviceView.Items.Clear();
            refreshConfigs();
            if (_connectedIp == "")
            {
                return;
            }
            string devices = WebServerScripts.HttpGet(_connectedIp, CTRProductStuff.Devices.None, 0, CTRProductStuff.Action.GetDeviceList, "", 1000);

            if (devices == "Failed")
            {
                updateReturnTextBox();
                return;
            }

            _deviceStatus = JsonConvert.DeserializeObject <GetDevicesReturn>(devices);
            if (_deviceStatus != null)
            {
                foreach (DeviceDescriptor d in _deviceStatus.DeviceArray)
                {
                    if ((d.ID & 0xFFFFFFC0) == 0x0204f400)
                    {
                        d.Model = "Pigeon Over Ribbon";
                    }

                    CTRProductStuff.Devices dev = CTRProductStuff.DeviceIDMap[(d.ID & 0xFFFFFFC0)];
                    string[] array = new string[7];
                    array[0] = d.Name;
                    array[1] = d.Model;
                    array[2] = (d.ID & 0x3F).ToString();
                    array[3] = d.CurrentVers;
                    array[4] = d.ManDate;
                    array[5] = d.BootloaderRev;
                    array[6] = d.SoftStatus;

                    int imageKey = 0;
                    switch (dev)
                    {
                    case CTRProductStuff.Devices.TalonSRX:
                        imageKey = 0;
                        break;

                    case CTRProductStuff.Devices.VictorSPX:
                        imageKey = 1;
                        break;

                    case CTRProductStuff.Devices.PigeonIMURibbon:
                    case CTRProductStuff.Devices.PigeonIMU:
                        imageKey = 2;
                        break;

                    case CTRProductStuff.Devices.CANifier:
                        imageKey = 3;
                        break;

                    case CTRProductStuff.Devices.PCM:
                        imageKey = 4;
                        break;

                    case CTRProductStuff.Devices.PDP:
                        imageKey = 5;
                        break;
                    }

                    deviceView.Items.Add(new ListViewItem(array, imageKey));
                }
            }
            updateReturnTextBox(_deviceStatus.GeneralReturn.Error, _deviceStatus.GeneralReturn.ErrorMessage);
            foreach (Control c in deviceSpecificControls.Controls)
            {
                c.Enabled = false;
            }
        }
示例#19
0
        //Swicth language. Note that the order of items must be preserved
        public static void SetLanguage(ComboBox.ObjectCollection items, Type type)
        {
            StringCollection saveKeys = new StringCollection();

            for (int idx = 0; idx < items.Count; idx++)
            {
                common.myComboBoxItem item = (common.myComboBoxItem)items[idx];
                saveKeys.Add(item.Value);
            }
            if (type == typeof(AppTypes.TimeScale))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindTimeScaleByCode(saveKeys[idx]);
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.TimeScale item = (AppTypes.TimeScale)obj;
                    items.Add(new common.myComboBoxItem(item.Description, item.Code));
                }
                return;
            }

            if (type == typeof(AppTypes.TradeActions))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.TradeActions));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.TradeActions item = (AppTypes.TradeActions)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }


            if (type == typeof(AppTypes.TimeRanges))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.TimeRanges));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.TimeRanges item = (AppTypes.TimeRanges)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.StrategyTypes))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.StrategyTypes));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.StrategyTypes item = (AppTypes.StrategyTypes)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.Sex))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.Sex));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.Sex item = (AppTypes.Sex)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.CommonStatus))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.CommonStatus));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.CommonStatus item = (AppTypes.CommonStatus)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.ChartTypes))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.ChartTypes));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.ChartTypes item = (AppTypes.ChartTypes)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
            if (type == typeof(AppTypes.BizSectorTypes))
            {
                items.Clear();
                for (int idx = 0; idx < saveKeys.Count; idx++)
                {
                    object obj = FindCodeInEnum(saveKeys[idx], typeof(AppTypes.BizSectorTypes));
                    if (obj == null)
                    {
                        continue;
                    }
                    AppTypes.BizSectorTypes item = (AppTypes.BizSectorTypes)obj;
                    items.Add(new common.myComboBoxItem(AppTypes.Type2Text(item), item.ToString()));
                }
                return;
            }
        }
        private void UpdateGame(Game game)
        {
            ComboBox.ObjectCollection p1charlist = PlayerOneComboBox.Items;
            ComboBox.ObjectCollection p2charlist = PlayerTwoComboBox.Items;

            //reset next-image-button
            nextImageButton.Enabled = true;
            //reset game label color
            GameLabel.ForeColor = Color.FromKnownColor(KnownColor.ControlText);

            #region fill char lists
            List <string> chars = new List <string>()
            {
                " "
            };
            List <string> p1chars = new List <string>();
            List <string> p2chars = new List <string>();

            switch (game)
            {
            case Game._:
            case Game._1943:
            case Game.Astyanax:
            case Game.Donkey_Kong:
            case Game.Double_Dragon:
            case Game.Frogger:
            case Game.Galaga_88:
            case Game.Galaxian:
            case Game.Gyruss:
            case Game.Metal_Slug:
            case Game.Pang:
            case Game.Puckman:
            case Game.Tetris:
            case Game.Space_Invaders_Part_II:
                break;

            case Game.Asterix:
                #region Asterix chars
                chars.AddRange(new string[]
                {
                    "Asterix",
                    "Obelix"
                });
                #endregion
                break;

            case Game.Bomberman:
                chars.AddRange(new[]
                {
                    "Atomic",
                    "Black",
                    "Blue",
                    "Cat",
                    "Fake",
                    "Gold",
                    "Hayate",
                    "Honey",
                    "Kotetu",
                    "Red",
                    "Rubber",
                    "White"
                });
                break;

            case Game.Contra:
                #region Contra chars
                p1chars.Add("Bill");
                p2chars.Add("Lance");
                #endregion
                break;

            case Game.Golden_Axe_The_Revenge_Of_Death_Adder:
                #region GATRODA chars
                chars.AddRange(new string[]
                {
                    "Dora",
                    "Goah",
                    "Sternblade",
                    "Trix"
                });
                #endregion
                break;

            case Game.Mario_Bros:
                #region MaBro chars
                p1chars.Add("Mario");
                p2chars.Add("Luigi");
                #endregion
                break;

            case Game.Marvel_Super_Heroes_vs_Street_Fighter:
                #region MaSHeVStreF chars
                chars.AddRange(new string[]
                {
                    "Akuma",
                    "Bison",
                    "Blackheart",
                    "Captain America",
                    "Chun-Li",
                    "Cyclops",
                    "Dan",
                    "Dhalsim",
                    "Hulk",
                    "Ken",
                    "Omega Red",
                    "Ryu",
                    "Sakura",
                    "Shuma-Gurath",
                    "Spiderman",
                    "Zangief"
                });
                #endregion
                break;

            case Game.Mortal_Kombat:
                #region MoKo chars
                #region playable
                chars.AddRange(new string[]
                {
                    "Cage",
                    "Kano",
                    "Liu Kang",
                    "Raiden",
                    "Scorpion",
                    "Sonya",
                    "Sub-Zero"
                });
                #endregion
                #region bosses
                p2chars.AddRange(new string[]
                {
                    "Goro",
                    "Shang Tsung"
                });
                #endregion
                #endregion
                break;

            case Game.Sega_Sonic_The_Hedgehog:
                #region SeSTHe chars
                chars.AddRange(new string[]
                {
                    "Mighty",
                    "Ray",
                    "Sonic"
                });
                #endregion
                break;

            case Game.Sonic_The_Hedgehog_II:
                #region SoTH2 chars
                p1chars.Add("Sonic");
                p2chars.Add("Tails");
                #endregion
                break;

            case Game.Street_Fighter_II_Champion_Edition:
                #region StreF2ChE chars
                chars.AddRange(new string[]
                {
                    "Balrog",
                    "Blanka",
                    "Chun Li",
                    "Dhalsim",
                    "E. Honda",
                    "Guile",
                    "Ken",
                    "M. Bison",
                    "Ryu",
                    "Sagat",
                    "Vega",
                    "Zangief"
                });
                #endregion
                break;

            case Game.Street_Fighter_III_New_Generation:
                #region StreF3NeG chars
                chars.AddRange(new string[]
                {
                    "Alex",
                    "Dudley",
                    "Elena",
                    "Ibuki",
                    "Ken",
                    "Necro",
                    "Oro",
                    "Ryu",
                    "Sean",
                    "Yun"
                });
                #endregion
                break;

            case Game.Super_Street_Fighter_II_The_New_Challenger:
            case Game.Super_Street_Fighter_II_Turbo:
                #region SuStreF2 chars
                chars.AddRange(new string[]
                {
                    "Balrog",
                    "Blanka",
                    "Cammy",
                    "Dee Jay",
                    "Chun Li",
                    "Dhalsim",
                    "E. Honda",
                    "Fei Long",
                    "Guile",
                    "Ken",
                    "M. Bison",
                    "Ryu",
                    "Sagat",
                    "T. Hawk",
                    "Vega",
                    "Zangief"
                });
                #endregion
                break;

            case Game.The_King_Of_Fighters_96:
                #region TheKOF96 chars
                #region playable
                chars.AddRange(new string[]
                {
                    "Andy Bogard",
                    "Athena Asamiya",
                    "Benimaru Nikaido",
                    "Chang Koehan",
                    "Chin Gentsai",
                    "Choi Bounge",
                    "Clark Still",
                    "Geese Howard",
                    "Goro Daimon",
                    "Iori Yagami",
                    "Joe Higashi",
                    "Kasumi Todoh",
                    "Kim Kaphwan",
                    "King",
                    "Kyo Kusanagi",
                    "Leona Heidern",
                    "Mai Shiranui",
                    "Mature",
                    "Mr. Big",
                    "Ralf Jones",
                    "Robert Garcia",
                    "Ryo Sakazaki",
                    "Sie Kensou",
                    "Terry Bogard",
                    "Vice",
                    "Wolfgang Krauser",
                    "Yuri Sakazaki"
                });
                #endregion
                #region bosses
                p2chars.AddRange(new string[]
                {
                    "Chizuru Kagura",
                    "Goenitz"
                });
                #endregion
                #endregion
                break;

            case Game.The_Punisher:
                #region TheP chars
                p1chars.Add("The Punisher");
                p2chars.Add("Nick Fury");
                #endregion
                break;

            default:
                //indicate the game hasn't been propperly implemented yet and prevent from labeling
                GameLabel.ForeColor     = Color.Red;
                nextImageButton.Enabled = false;
                break;
            }

            //remove the empty ones from the p1 and p2 exclusive lists
            #endregion
            #region actually update the combobox lists
            p1charlist.Clear();
            p1charlist.AddRange(chars.ToArray());
            p1charlist.AddRange(p1chars.ToArray());

            p2charlist.Clear();
            p2charlist.AddRange(chars.ToArray());
            p2charlist.AddRange(p2chars.ToArray());

            UpdatePlayers();
            #endregion
        }