예제 #1
0
        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method populates the specified <see cref="ComboBox" /> item
        /// list with the recognized ADO.NET provider names.  This method will
        /// only work correctly when called from the user-interface thread.
        /// </summary>
        /// <param name="items">
        /// The <see cref="ComboBox.Items" /> property value containing the
        /// list of items to be modified.  This value cannot be null.
        /// </param>
        /// <returns>
        /// The number of items actually added to the list, which may be zero.
        /// </returns>
        public static int AddProviderNames(
            ComboBox.ObjectCollection items
            )
        {
            int result = 0;

            if (items == null)
            {
                return(result);
            }

            IList <string> names = new List <string>();

#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461
            names.Add(Ef6ProviderName);
#endif

            names.Add(LegacyProviderName);

            foreach (string name in names)
            {
                if (CheckProviderName(name))
                {
                    items.Add(name);
                    result++;
                }
            }

            return(result);
        }
예제 #2
0
 public Results(string text, ComboBox cB_Den, ComboBox.ObjectCollection items, GameStrings gameStrings)
 {
     InitializeComponent();
     seedBox.Text = text;
     foreach (var den in cB_Den.Items)
     {
         denBox.Items.Add(den);
     }
     denBox.SelectedIndex = cB_Den.SelectedIndex;
     foreach (var item in items)
     {
         speciesList.Items.Add(item);
     }
     this.GameStrings = gameStrings;
     natureBox.Items.Clear();
     natureBox.Items.Add("Any");
     natureBox.Items.AddRange(GameStrings.natures);
     speciesList.SelectedIndex = 0;
     natureBox.SelectedIndex   = 0;
     shinyBox.SelectedIndex    = 0;
     characteristics           = new string[6];
     for (int counter = 0, i = 1; i < GameStrings.characteristics.Length; i += 5, counter++)
     {
         characteristics[counter] = GameStrings.characteristics[i];
     }
 }
예제 #3
0
        public static int GetNearestComboIndex(string text, ComboBox.ObjectCollection items, int defaultIndex = -1)
        {
            if (text.Length > 0)
            {
                //check for full match
                for (var i = 0; i < items.Count; i++)
                {
                    if (items[i].ToString().Equals(text, StringComparison.CurrentCultureIgnoreCase))
                    {
                        return(i);
                    }
                }

                //check for prefix match
                for (var i = 0; i < items.Count; i++)
                {
                    if (items[i].ToString().StartsWith(text, StringComparison.CurrentCultureIgnoreCase))
                    {
                        return(i);
                    }
                }

                //check for any
                for (var i = 0; i < items.Count; i++)
                {
                    if (items[i].ToString().IndexOf(text, StringComparison.CurrentCultureIgnoreCase) >= 0)
                    {
                        return(i);
                    }
                }
            }

            //give up and return default
            return(defaultIndex);
        }
 public GeneralPrefs(ComboBox.ObjectCollection mSummaries)
 {
     foreach (object s in mSummaries)
     {
         Summaries.Add(s.ToString());
     }
 }
예제 #5
0
 public Results(string text, ComboBox cB_Den, ComboBox.ObjectCollection items, GameStrings gameStrings)
 {
     InitializeComponent();
     seedBox.Text = text;
     foreach (var den in cB_Den.Items)
     {
         denBox.Items.Add(den);
     }
     denBox.SelectedIndex = cB_Den.SelectedIndex;
     foreach (var item in items)
     {
         speciesList.Items.Add(item);
     }
     IVBoxes          = new[] { minHP, maxHP, minAtk, maxAtk, minDef, maxDef, minSpa, maxSpa, minSpd, maxSpd, MinSpe, maxSpe };
     this.GameStrings = gameStrings;
     natureBox.Items.Clear();
     natureBox.Items.Add("Any");
     natureBox.Items.AddRange(GameStrings.natures);
     for (int i = 0; i < GameStrings.natures.Length; i++)
     {
         natureIdx[GameStrings.natures[i]] = i + 1;
     }
     natureBox.MaxDropDownItems = 1 + GameStrings.natures.Length;
     natureBox.ValueSeparator   = ", ";
     speciesList.SelectedIndex  = 0;
     natureBox.SetItemChecked(0, true);
     natureBox.DisplayMember = "Value";
     shinyBox.SelectedIndex  = 0;
     characteristics         = new string[6];
     for (int counter = 0, i = 1; i < GameStrings.characteristics.Length; i += 5, counter++)
     {
         characteristics[counter] = GameStrings.characteristics[i];
     }
     natureBox.DropDownClosed += new System.EventHandler(this.nature_DropDownClosed);
 }
예제 #6
0
        public void Add(uint iProcessID, uint iCharacterID, string zName, byte iLevel)
        {
            ComboBox.ObjectCollection items = this.List.Items;
            // ISSUE: variable of a boxed type
            var    local = (ValueType)iProcessID;
            string str1  = ": ";
            string str2;

            if (zName != null && zName.Length != 0)
            {
                str2 = string.Concat(new object[4]
                {
                    (object)zName,
                    (object)" (",
                    (object)iLevel,
                    (object)")"
                });
            }
            else
            {
                str2 = "No character information.";
            }
            string str3 = (string)(object)local + (object)str1 + str2;

            items.Add((object)str3);
            this._hProcessList.Add(iProcessID);
        }
예제 #7
0
 /// <summary>
 /// Gets an IEnumerable<typeparamref name="T"/> from a ComboBox.Items collection.
 /// </summary>
 /// <typeparam name="T">Generic type parameter.</typeparam>
 /// <param name="collection">The collection.</param>
 static public IEnumerable <T> AsIEnumerable <T>(this ComboBox.ObjectCollection collection)
 {
     foreach (T item in collection)
     {
         yield return(item);
     }
 }
예제 #8
0
 public void SetElements(ComboBox.ObjectCollection preElements)
 {
     this.inputCombo.Items.Clear();
     foreach (string x in preElements)
     {
         this.inputCombo.Items.Add(x.ToString());
     }
 }
예제 #9
0
 public AddFilterView(ComboBox.ObjectCollection oldFilterItems, int nbFilters)
 {
     InitializeComponent();
     newNbFilter    = nbFilters;
     newFilterItems = oldFilterItems;
     tmpFilterItems = oldFilterItems;
     initDatas(newFilterItems, nbFilters);
 }
예제 #10
0
 public MainForm()
 {
     InitializeComponent();
     availableYears  = availableYearsCB.Items;
     availableMonths = availableMonthsCB.Items;
     availableDays   = availableDaysCB.Items;
     FormClosing    += MainForm_FormClosing;
 }
예제 #11
0
 public static void AddNotExists(this ComboBox.ObjectCollection items, object value)
 {
     if (items.Contains(value))
     {
         return;
     }
     items.Add(value);
 }
예제 #12
0
 private void PopulateFrequencyList(ComboBox.ObjectCollection l)
 {
     for (var i = 1800; i <= 4000; i += 50)
     {
         var v = i / 1000.00;
         l.Add(new FrequencyListItem(i, $"{v:0.00} GHz"));
     }
 }
예제 #13
0
 private void maintainHistoryLength(ComboBox.ObjectCollection items)
 {
     if (items.Count > DEFAULT_MAX_HISTORY)
     {
         int lastIndex = items.Count - 1;
         items.RemoveAt(lastIndex);
     }
 }
예제 #14
0
 public static void FromString(this ComboBox.ObjectCollection coll, string values)
 {
     if (!string.IsNullOrWhiteSpace(values))
     {
         string[] items = values.Split(new[] { _delimiter }, StringSplitOptions.RemoveEmptyEntries);
         coll.AddRange(items);
     }
 }
예제 #15
0
 public void UpdateRealmSynergies(ComboBox.ObjectCollection synergies)
 {
     comboBoxRealmSynergy.Items.Clear();
     foreach (FFRKViewPartyPlanner.Synergy synergy in synergies)
     {
         comboBoxRealmSynergy.Items.Add(synergy);
     }
 }
예제 #16
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]);
     }
 }
예제 #17
0
 private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this.tabControl1.SelectedIndex == 0)
     {
         this.currentSet.skill = this.copySet.skill;
         this.file.css[this.cbChar.SelectedIndex] = this.currentSet;
         this.lck = false;
         int selectedIndex = this.cbChar.SelectedIndex;
         this.cbChar.SelectedIndex = 0;
         this.cbChar.Items.Clear();
         for (int index = 0; index < this.file.css.Count; ++index)
         {
             ComboBox.ObjectCollection items = this.cbChar.Items;
             string       str1         = "Character ";
             charSkillSet charSkillSet = this.file.css[index];
             string       str2         = charSkillSet.charID.ToString("000");
             string       str3         = " - Costume ";
             charSkillSet = this.file.css[index];
             string str4 = charSkillSet.costumeID.ToString("00");
             string str5 = str1 + str2 + str3 + str4;
             items.Add((object)str5);
         }
         this.cbChar.SelectedIndex = selectedIndex;
         this.lck = true;
     }
     else
     {
         this.currentSkill = this.copySkill;
         this.UpdateCurrentSkill();
         this.UpdateSkillList();
         this.lck = false;
         this.txtShortName.Text = this.currentSkill.shortName;
         this.txtid.Text        = this.currentSkill.id.ToString();
         this.txtid2.Text       = this.currentSkill.id2.ToString();
         this.textBox1.Text     = this.currentSkill.racelock.ToString();
         this.txt1.Text         = this.currentSkill.unk1.ToString();
         this.txt2.Text         = this.currentSkill.unk2.ToString();
         this.txtHair.Text      = this.currentSkill.hair.ToString();
         this.txt3.Text         = this.currentSkill.unk3.ToString();
         this.txt4.Text         = this.currentSkill.Paths[0];
         this.txt5.Text         = this.currentSkill.Paths[1];
         this.txt6.Text         = this.currentSkill.Paths[2];
         this.txt7.Text         = this.currentSkill.Paths[3];
         this.txt8.Text         = this.currentSkill.Paths[4];
         this.txt9.Text         = this.currentSkill.Paths[5];
         this.txt10.Text        = this.currentSkill.Paths[6];
         this.txt11.Text        = this.currentSkill.unk4.ToString();
         this.txt12.Text        = this.currentSkill.unk5.ToString();
         this.txt13.Text        = this.currentSkill.unk6.ToString();
         this.txt14.Text        = this.currentSkill.unk7.ToString();
         this.txt15.Text        = this.currentSkill.unk8.ToString();
         this.txt16.Text        = this.currentSkill.unk9.ToString();
         this.txt17.Text        = this.currentSkill.unk10.ToString();
         this.txt18.Text        = this.currentSkill.unk11.ToString();
         this.lck = true;
     }
     this.lblStatus.Text = "Data has been pasted in";
 }
예제 #18
0
        // ComboBox.ObjectCollection
        static public void RemoveAll(this ComboBox.ObjectCollection thisItems)
        {
            int itemsLenght = thisItems.Count;

            for (int l = 0; l < itemsLenght; l++)
            {
                thisItems.Remove(thisItems[0]);
            }
        }
예제 #19
0
        //private void SetStatus(string s)
        //{
        //    statusLabel.Text = s;
        //}
        private void PopulateStatusComboBox(ComboBox.ObjectCollection collection)
        {
            var values = Enum.GetValues(typeof(RecordStatus));

            foreach (var value in values)
            {
                collection.Add(value.ToString());
            }
        }
예제 #20
0
파일: MainForm.cs 프로젝트: xuxiandi/XJoy
        private void ParseConfigMapping(string From, string To)
        {
            ComboBox inputControl = GetControlForInput(From);

            if (inputControl != null)
            {
                ComboBox.ObjectCollection items = inputControl.Items;
                HID_USAGES axis;
                bool       isAxis = TryGetAxisFromString(To, out axis);

                if (isAxis)
                {
                    for (int i = 0; i < items.Count; i++)
                    {
                        vJoyManager.AnalogInput inputData = items[i] as vJoyManager.AnalogInput;
                        if (inputData != null)
                        {
                            if (inputData.Axis == axis)
                            {
                                inputControl.SelectedIndex = i;
                                return;
                            }
                        }
                    }
                }
                else
                {
                    int  buttonIndex;
                    bool s = Int32.TryParse(To, out buttonIndex);
                    if (s)
                    {
                        for (int i = 0; i < items.Count; i++)
                        {
                            vJoyManager.DigitalInput inputData = items[i] as vJoyManager.DigitalInput;
                            if (inputData != null)
                            {
                                if (inputData.ButtonIndex == buttonIndex)
                                {
                                    inputControl.SelectedIndex = i;
                                    return;
                                }
                            }
                        }
                        Console.WriteLine("Couldn't match button index #" + buttonIndex);
                        return;
                    }
                }
                Console.WriteLine("Failed to find input mapping for '" + To + "'");
                return;
            }
            else
            {
                Console.WriteLine("Failed to find input control for '" + From + "'");
                return;
            }
        }
예제 #21
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            modList.Items.Clear();
            List <string> listOfMods = new List <string>();

            //	foreach (string dir in Directory.GetDirectories(Directory.GetCurrentDirectory()))
            foreach (string dir in Directory.GetDirectories(gamePath))
            {
                if (isModDirectory(dir))
                {
                    listOfMods.Add(dir.Substring(dir.LastIndexOf('\\') + 1));
                }
            }
            modList.Items.AddRange(listOfMods.ToArray());

            // Choosing saved mod
            string choosedGameMod = getModDirectory();
            int    k          = 0;
            bool   isModFound = false;

            ComboBox.ObjectCollection listItems = modList.Items;
            foreach (string val in listItems)
            {
                //	Console.WriteLine(val + " - " + choosedGameMod);
                if (val == choosedGameMod)
                {
                    modList.SelectedIndex = k;
                    isModFound            = true;
                    break;
                }
                k++;
            }
            if (!isModFound)
            {
                k = 0;
                foreach (string val in listItems)
                {
                    if (val.IndexOf(choosedGameMod) >= 0)
                    {
                        modList.SelectedIndex = k;
                        break;
                    }
                    k++;
                }
            }

#if TRANSLATION
            // Translating
            for (int i = 0; i < modList.Items.Count; i++)
            {
                string oldValue = (string)modList.Items[i];
                TranslateModDirectory(ref oldValue);
                modList.Items[i] = oldValue;
            }
#endif
        }
        public static List <string> GetStringList(this ComboBox.ObjectCollection collection)
        {
            List <string> stringList = new List <string>();

            foreach (var item in collection)
            {
                stringList.Add((string)item);
            }
            return(stringList);
        }
예제 #23
0
        private void initDatas(ComboBox.ObjectCollection filters, int nb)
        {
            //filter combobox
            int i = -1;

            while (i++ != nb - 1)
            {
                this.newFComboBox.Items.Add(filters[i]);
            }
        }
예제 #24
0
        public static string ConvertItemsToString(ComboBox.ObjectCollection items)
        {
            string str = "";

            for (int i = 0; i < items.Count; i++)
            {
                str = str + ";" + items[i] + ";";
            }
            return(str);
        }
예제 #25
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"));
            }
        }
예제 #26
0
        public ReorderDialog(ComboBox.ObjectCollection items)
        {
            InitializeComponent();

            var list = items.Cast <CustomStyle>().ToArray();

            listBox.Items.AddRange(list);

            listBox.SelectedIndex = 0;
        }
예제 #27
0
 public void DataUpdateHandler(ComboBox.ObjectCollection items)
 {
     for (int i = 0; i < items.Count; i++)
     {
         if (_data[i].Item1 != items[i].ToString())
         {
             _data[i] = new Tuple <string, string>(items[i].ToString(), _data[i].Item2);
         }
     }
 }
예제 #28
0
        public void FontsAreAlphabeticallySorted()
        {
            ComboBox.ObjectCollection fontNamesNormal = m_fontsControl.DefaultFontComboBox.Items;

            for (int i = 0; i + 1 < fontNamesNormal.Count; i++)
            {
                // Check that each font in the list is alphabetically before the next font in the list
                Assert.LessOrEqual(fontNamesNormal[i] as string, fontNamesNormal[i + 1] as string, "Font names not alphabetically sorted.");
            }
        }
예제 #29
0
        private string ToFullString(ComboBox.ObjectCollection items)
        {
            StringBuilder sb = new StringBuilder();

            foreach (Object item in items)
            {
                sb.AppendLine("\t" + item.ToString());
            }
            return(sb.ToString());
        }
예제 #30
0
파일: Form2.cs 프로젝트: hasashin/Numerator
        public NewDialog(ComboBox.ObjectCollection combo, DataTable dt)
        {
            InitializeComponent();

            table = dt;
            yearComboBox.Items.Add("Dodaj nowy");
            foreach (Object item in combo)
            {
                yearComboBox.Items.Add(item);
            }
        }