示例#1
0
        /// <summary>
        /// 更新当前测试项目和对数
        /// </summary>
        /// <param name="itemName"></param>
        /// <param name="clbType"></param>
        private void SetCheckItem(string itemName, ClbType clbType)
        {
            CheckedListBox targetCheckedListBox = new CheckedListBox();

            switch (clbType)
            {
            case ClbType.TestItem:
                targetCheckedListBox = chkList_TestItem;
                break;

            case ClbType.DiffPair:
                targetCheckedListBox = chkList_LossPair;
                break;

            case ClbType.NextPair:
                targetCheckedListBox = chkList_NextPair;
                break;

            case ClbType.FextPair:
                targetCheckedListBox = chkList_FextPair;
                break;
            }
            if (targetCheckedListBox.InvokeRequired)
            {
                Action <string, ClbType> d = SetCheckItem;
                this.Invoke(d, new object[] { itemName, clbType });
            }
            else
            {
                int index = targetCheckedListBox.FindString(itemName);
                targetCheckedListBox.SelectedIndex = index;
                targetCheckedListBox.SetItemChecked(index, true);
                Extende.SelectTab(targetCheckedListBox);
            }
        }
示例#2
0
        // ----------------------------------------------------------------------------------------
        /// <!-- FromTo -->
        /// <summary>
        ///      Adds the selected item from the source list if it is not already in the destination list
        /// </summary>
        /// <param name="form">allows no-action if the controls are not on the form</param>
        /// <param name="drop"></param>
        /// <param name="list"></param>
        public static void FromTo(Form form, ComboBox dropFrom, CheckedListBox listTo)
        {
            if (Scrape.Active(form, dropFrom) && Scrape.Active(form, listTo))
            {
                // ---------------------------------------------------------------------90
                //  Find the item in the 'From' list
                // ---------------------------------------------------------------------90
                int idxFrom = dropFrom.SelectedIndex;
                if (idxFrom >= 0)
                {
                    ListItem itemFrom = (ListItem)dropFrom.Items[idxFrom];


                    // -----------------------------------------------------------------90
                    //  Add the item to the 'To' list
                    // -----------------------------------------------------------------90
                    int idxTo = listTo.FindString(itemFrom.Display);
                    if (idxTo < 0)
                    {
                        idxTo = listTo.FindString(itemFrom.Descr);
                    }
                    if (idxTo < 0)
                    {
                        string codeFrom = itemFrom.Code;
                        for (int i = 0; i < listTo.Items.Count; ++i)
                        {
                            ListItem item = (ListItem)listTo.Items[i];
                            if (codeFrom == item.Code)
                            {
                                idxTo = i;
                            }
                        }
                    }
                    if (idxTo < 0)
                    {
                        string   idFrom  = dropFrom.SelectedValue.ToString();
                        string   code    = itemFrom.Code;
                        string   descr   = itemFrom.Descr;
                        string   display = itemFrom.Display;
                        string   idTo    = (listTo.Items.Count + 1).ToString();
                        ListItem itemTo  = new ListItem(idTo, code, descr, display);
                        listTo.Items.Add(itemTo, true);
                    }
                }
            }
        }
示例#3
0
        private void Search_tx_TextChanged(object sender, EventArgs e)
        {
            string searchString = Search_tx.Text;

            int index = itemlistbox.FindString(searchString, -1);

            if (index != -1)
            {
                itemlistbox.SetSelected(index, true);
            }
        }
示例#4
0
 private void SetlistboxValue(CheckedListBox clbBox, List <string> selectedValues)
 {
     foreach (var VARIABLE in selectedValues)
     {
         int indexFind = clbBox.FindString(VARIABLE);
         if (indexFind != -1)
         {
             clbBox.SetItemChecked(indexFind, true);
         }
     }
 }
        private void SetSimpleVerification(string typeName, string memName, CheckedListBox chckLst)
        {
            int index1 = 0;
            int index2 = 0;

            try
            {
                index1 = chckLst.FindString(typeName);
                index2 = chckLst.FindString("\t" + memName, index1);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            if (index2 > index1)
            {
                chckLst.SetItemChecked(index1, true);
                chckLst.SetItemChecked(index2, true);
            }
        }
示例#6
0
 private void RemarcarCheckListBox(HashSet <String> ejerciciosSeleccionados, CheckedListBox clbEjercicios)
 {
     for (int i = 0; i < ejerciciosSeleccionados.Count; i++)
     {
         int posicion = clbEjercicios.FindString(ejerciciosSeleccionados.ElementAt(i));
         if (posicion != -1)
         {
             clbEjercicios.SetItemChecked(posicion, true);
         }
     }
 }
示例#7
0
        private void ButtonFindExact_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TextBoxFindSelect.Text))
            {
                MessageBox.Show("Nothing to searching.", "No data", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            int iTemp = CheckedListBox.FindString(TextBoxFindSelect.Text, CheckedListBox.SelectedIndex);

            if (iTemp != -1)
            {
                // CheckedListBox.SetItemCheckState(iTemp, CheckState.Checked)
                CheckedListBox.SetSelected(iTemp, true);
            }
            else
            {
                MessageBox.Show("Nothing founded.", "Nothing", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#8
0
        /// <summary>
        ///     Gibt einen Wahrheitswert aus, der angibt, ob das Item mit den angegebenen Parametern erlaubt ist.
        /// </summary>
        /// <param name="item">zu überprüfendes <see cref="Loot"/> Objekt </param>
        /// <param name="unten">Mindest-Rarity-Wert</param>
        /// <param name="oben">Maximal-Rarity-Wert</param>
        /// <param name="tags">Tag Zeichenkette von Char als String</param>
        /// <param name="blackWhite">Modus der Black/Whitelist</param>
        /// <param name="nameFilter">Zwangsweise enthaltener Teilstring im Name</param>
        /// <param name="extrainfo">Wahrheitswert der das Ereignislog aktiviert</param>
        /// <returns><see cref="bool"/> -> <see cref="true"/> = erlaubt</returns>
        private bool isLootAllowed(Loot item, int unten, int oben, string tags, bool blackWhite, string nameFilter)
        {
            //Achtung : ich könnte zwar schon beim ersten Verstoß false returnen, allerdings
            //halte ich mir die möglickeit offen SÄMTLICHE betreffende Verstöße noch irgendwo auszugeben
            //*schlechte Performance intensifies*

            Loot tempLoot = item;
            //Index des Itemtyps in der Type-CheckedListBox
            int typeIndex = (typeOutput.FindString(tempLoot.type));
            //ist diese Checkbox-Zeile aktiviert?
            bool typeAllowed = typeOutput.GetItemChecked(typeIndex);
            //Anfänglich wird davon ausgegeangen, dass sowohl der Name und die Tags zugelassen sind.
            bool nameAllowed       = true;
            bool blackWhiteAllowed = true;
            bool questAllowed      = false;
            bool areaAllowed       = false;

            if (nameFilter != "")
            {
                //Wenn ein Filter übergeben wird, MUSS dieser im Namen vorhanden sein, ansonten ist das Item nicht zugelassen
                if (tempLoot.name.IndexOf(nameFilter) == -1)
                {
                    nameAllowed = false;
                }
            }
            if (tags != "")
            {
                if (blackWhite)
                {
                    for (int k = 0; k < tempLoot.tags.Length; k++)
                    {
                        if (tags.IndexOf(tempLoot.tags[k]) != -1)
                        {
                            //wenn ein Tag-Filter vorhanden ist und es eine Blacklist ist, dann darf KEINER der Filter-Tags in den item Tags sein!
                            blackWhiteAllowed = false;
                            break;
                        }
                    }
                }
                else
                {
                    if (tempLoot.tags.Length == 0)
                    {
                        blackWhiteAllowed = false;
                    }
                    else
                    {
                        for (int j = 0; j < tempLoot.tags.Length; j++)
                        {
                            if (tags.IndexOf(tempLoot.tags[j]) == -1)
                            {
                                //wenn ein Tag-Filter vorhanden ist und es eine Whitelist ist, dann muss JEDES der Filter-Tags in den item Tags sein!
                                blackWhiteAllowed = false;
                                break;
                            }
                        }
                    }
                }
            }
            if (config.useAreaCheckBx)
            {
                if ((areaTags.Items.Count == 0) || (item.areaTags.Count == 0))
                {
                    areaAllowed = true;
                }
                else
                {
                    for (int i = 0; i < item.areaTags.Count; i++)
                    {
                        int index = areaTags.FindStringExact(item.areaTags[i]);
                        if (index != -1)
                        {
                            if (areaTags.GetItemChecked(index))
                            {
                                areaAllowed = true;
                                break;
                            }
                        }
                    }
                }
            }
            if (config.useQuestCheckBx)
            {
                if ((questTags.Items.Count == 0) || (item.questTags.Count == 0))
                {
                    questAllowed = true;
                }
                else
                {
                    for (int i = 0; i < item.questTags.Count; i++)
                    {
                        int index = questTags.FindStringExact(item.questTags[i]);
                        if (index != -1)
                        {
                            if (questTags.GetItemChecked(index))
                            {
                                questAllowed = true;
                                break;
                            }
                        }
                    }
                }
            }
            return((tempLoot.rarity >= unten) &&
                   (tempLoot.rarity <= oben) &&
                   (typeAllowed) &&
                   (nameAllowed) &&
                   (blackWhiteAllowed) &&
                   (areaAllowed) &&
                   (questAllowed));
            //Alles muss erfüllt sein (logischerweise)
        }