Exemplo n.º 1
0
        /// <summary>
        /// Makes a list of pages
        /// </summary>
        /// <param name="provider">The IListProvider to make the list</param>
        /// <param name="sourceValues">An array of string values to create the list with, e.g. an array of categories. Use null if not appropriate</param>
        public void MakeList(IListProvider provider, string[] sourceValues)
        {
            btnStop.Visible = true;

            providerToRun = provider;

            if (providerToRun.RunOnSeparateThread)
            {
                strSource    = sourceValues;
                ListerThread = new Thread(MakeListPlugin);
                ListerThread.SetApartmentState(ApartmentState.STA);
                ListerThread.IsBackground = true;
                ListerThread.Start();
            }
            else
            {
                BusyStatus = true;

                if (!provider.UserInputTextBoxEnabled)
                {
                    Add(providerToRun.MakeList(new string[0]));
                }
                else
                {
                    Add(providerToRun.MakeList(sourceValues));
                }

                BusyStatus = false;
                UpdateNumberOfArticles();
                btnStop.Visible = false;
            }
        }
Exemplo n.º 2
0
        private void MakeListPlugin()
        {
            Thread.CurrentThread.Name = "ListMaker (" + providerToRun.GetType().Name + ": "
                                        + UserInputTextBox.Text + ")";
            StartProgressBar();

            try
            {
                Add(providerToRun.MakeList(strSource));
            }
            catch (ThreadAbortException) { }
            catch (Exception ex)
            {
                ErrorHandler.ListMakerText = UserInputTextBox.Text;
                ErrorHandler.Handle(ex);
                ErrorHandler.ListMakerText = "";
            }
            finally
            {
                if (FilterNonMainAuto)
                {
                    FilterNonMainArticles();
                }
                if (FilterDuplicates)
                {
                    RemoveListDuplicates();
                }
                StopProgressBar();
            }
        }
Exemplo n.º 3
0
        private void MakeListPlugin()
        {
            Thread.CurrentThread.Name = "ListMaker (" + providerToRun.GetType().Name + ": "
                                        + UserInputTextBox.Text + ")";
            StartProgressBar();

            try
            {
                Add(providerToRun.MakeList(strSource));
            }
            catch (ThreadAbortException) { }
            //catch (PageDoesNotExistException ex)
            //{
            //    MessageBox.Show(ex.Message, "Page does not exist", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //}
            catch (Exception ex)
            {
                ErrorHandler.ListMakerText = UserInputTextBox.Text;
                ErrorHandler.Handle(ex);
                ErrorHandler.ListMakerText = "";
            }
            finally
            {
                if (FilterNonMainAuto)
                {
                    FilterNonMainArticles();
                }
                if (FilterDuplicates)
                {
                    removeListDuplicates();
                }
                StopProgressBar();
            }
        }
Exemplo n.º 4
0
        private void MakeTheList()
        {
            StartProgressBar();

            List <Article> articles = null;

            try
            {
                articles = _providerToRun.MakeList(_providerToRun.UserInputTextBoxEnabled ? _source : new string[0]);
                Add(articles);
            }
            catch (ThreadAbortException)
            {
            }
            catch (FeatureDisabledException fde)
            {
                DisabledListProvider(fde);
            }
            catch (LoggedOffException)
            {
                UserLoggedOff();
            }
            catch (ApiErrorException aee)
            {
                if (aee.ErrorCode == "eiinvalidtitle")
                {
                    MessageBox.Show("An invalid title of \"" + aee.GetErrorVariable() + "\" was passed to the API.",
                                    "Invalid Title");
                }
            }
            catch (ArgumentException ae)
            {
                MessageBox.Show(ae.Message, "Invalid Parameter passed to List Maker");
            }
            catch (Exception ex)
            {
                ErrorHandler.ListMakerText = UserInputTextBox.Text;
                ErrorHandler.Handle(ex);
                ErrorHandler.ListMakerText = "";
            }
            finally
            {
                if (FilterNonMainAuto)
                {
                    FilterNonMainArticles();
                }
                if (FilterDuplicates)
                {
                    RemoveListDuplicates();
                }
                StopProgressBar((articles != null) ? articles.Count : 0);
            }
        }