Пример #1
0
 internal static List <int> ToList([NotNull] this ListBox.SelectedIndexCollection indexCollection)
 {
     if (indexCollection == null)
     {
         throw new ArgumentNullException("indexCollection");
     }
     return(new List <int>(indexCollection.Cast <int>()));
 }
Пример #2
0
        private void RefreshListbox(ListBox.SelectedIndexCollection indices = null, int offset = 0)
        {
            lstCurrentQueue.DataSource = null;
            lstCurrentQueue.DataSource = Program.JobQueue.Jobs;
            lstCurrentQueue.Refresh();

            if (indices != null && offset != 0)
            {
                int[] array = indices.Cast <int>().ToArray();

                for (int index = 0; index < lstCurrentQueue.Items.Count; index++)
                {
                    lstCurrentQueue.SetSelected(index, false);
                }

                foreach (int index in array)
                {
                    if (index > -1 && index < lstCurrentQueue.Items.Count)
                    {
                        lstCurrentQueue.SetSelected(index + offset, true);
                    }
                }
            }
        }