protected void Button1_Click(object sender, System.EventArgs e)
        {
            nntp1.Server = edtServer.Text;
            nntp1.Open();

            string[] groups = nntp1.GetGroups(false);

            cbNewsgroup.Items.Clear();
            foreach (string group in groups)
            {
                cbNewsgroup.Items.Add(group);
            }

            if (cbNewsgroup.Items.Count > 0)
            {
                cbNewsgroup.SelectedIndex = 0;
            }

            nntp1.Close();
            Button2.Enabled = true;
        }
Ejemplo n.º 2
0
        private void btnConnect_Click(object sender, System.EventArgs e)
        {
            cbNewsGroup.Enabled    = false;
            btnGetArticles.Enabled = false;
            btnPostNew.Enabled     = false;
            btnReply.Enabled       = false;
            tvArticles.Enabled     = false;
            memBody.Enabled        = false;
            cbNewsGroup.Enabled    = false;

            try {
                nntp1.Close();
                nntp1.Server = edtNewsServer.Text;
                nntp1.Open();

                string[] list = nntp1.GetGroups();

                string s = cbNewsGroup.Text;
                cbNewsGroup.Items.Clear();
                foreach (string group in list)
                {
                    cbNewsGroup.Items.Add(group);
                }
                cbNewsGroup.Text = s;

                cbNewsGroup.Enabled    = true;
                btnGetArticles.Enabled = true;
                btnPostNew.Enabled     = true;
                btnReply.Enabled       = true;
                tvArticles.Enabled     = true;
                memBody.Enabled        = true;
                cbNewsGroup.Enabled    = true;
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }