AutoWikiBrowser.Plugins.CFD.CfdOptions.btnOk_Click C# (CSharp) Method

btnOk_Click() private method

private btnOk_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                timer.Enabled = false;
                RefreshCats();
                txtBacklog.Text = txtBacklog.Text.Replace("_", " ");

                ToDo.Clear();
                foreach (DataGridViewRow r in Grid.Rows)
                {
                    if (!r.IsNewRow && !string.IsNullOrEmpty((string)r.Cells[0].Value)
                        && !ToDo.ContainsKey((string)r.Cells[0].Value))
                        ToDo.Add((string)r.Cells[0].Value, (string)r.Cells[1].Value);
                }

                BackgroundRequest req = new BackgroundRequest();
                if (ToDo.Count > 0)
                {
                    string[] cats = new string[ToDo.Count];
                    ToDo.Keys.CopyTo(cats, 0);
                    Enabled = false;

                    req.GetList(new CategoryListProvider(), cats);
                    req.Wait();

                    Enabled = true;

                    if (req.Result != null && req.Result is List<Article>)
                        CfdAWBPlugin.AWB.ListMaker.Add((List<Article>)req.Result);
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.HandleException(ex);
            }
            DialogResult = DialogResult.OK;
        }