Beispiel #1
0
        public void ListBoxSelectedObjectCollection_IListClear_Invoke_ThrowsNotSupportedException()
        {
            using var owner = new ListBox();
            IList collection = new ListBox.SelectedObjectCollection(owner);

            Assert.Throws <NotSupportedException>(() => collection.Clear());
        }
Beispiel #2
0
        void SetSelection(List <string> inSelection)
        {
            ListBox.SelectedObjectCollection sel = new ListBox.SelectedObjectCollection(controlsLB);
            sel.Clear();

            foreach (string str in inSelection)
            {
                foreach (object obj in controlsLB.Items)
                {
                    if (obj.ToString() == str)
                    {
                        sel.Add(str);
                        break;
                    }
                }
            }
        }
Beispiel #3
0
        private void ConvertButton_Click(object sender, EventArgs e)
        {
            _coursesToConverted = coursesListBox.SelectedItems;

            if (_coursesToConverted.Count <= 0)
            {
                MessageBox.Show("Please select course(s) to convert.");
            }
            else
            {
                try
                {
                    if (!Directory.Exists(OutPutPathFolder))
                    {
                        Util.CreateDirectory(OutPutPathFolder);
                    }

                    foreach (var course in _coursesToConverted)
                    {
                        Thread convertThread = new Thread(() => Program.DecryptCourse(course.ToString(), OutPutPathFolder, _dbConn));

                        try
                        {
                            convertThread.Start();

                            do
                            {
                                LabelBak2.Text = "Converting... " + course.ToString();
                                LabelBak3.Text = "PLEASE WAIT!";
                            } while (convertThread.IsAlive);

                            LabelBak2.Text = course.ToString() + " converted.";
                            LabelBak3.Text = "";
                        } catch (Exception anException)
                        {
                            MessageBox.Show(anException.StackTrace);
                        }
                    }

                    _coursesToConverted.Clear();
                } catch (Exception exceptionThis)
                {
                    MessageBox.Show("Some error occurred:\n " + exceptionThis.StackTrace);
                }
            }
        }