Пример #1
0
        private void UpdateListBox1()
        {
            using (var objProvider = new MailProvider()) {
                listBox1.Items.Clear();
                Receiver     objReceiver = objProvider.GetReceiver((int)treeView1.SelectedNode.Tag, treeView1.SelectedNode.Name);
                List <Email> objEmails   = objProvider.GetEmailsByReceiverId(objReceiver.Id);

                if (objEmails.Count != 0)
                {
                    listBox1.Items.AddRange(objEmails.ToArray());
                    listBox1.SelectedIndex = 0;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Sort Emails by sended flag
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            try {
                using (var objProvider = new MailProvider()) {
                    Receiver objReceiver = objProvider.GetReceiver((int)treeView1.SelectedNode.Tag, treeView1.SelectedNode.Name);
                    if (objReceiver == null)
                    {
                        return;
                    }

                    List <Email> objEmails = objProvider.GetEmailsByReceiverId(objReceiver.Id);
                    listBox1.Items.Clear();
                    if (objEmails.Count != 0)
                    {
                        listBox1.Items.AddRange(objEmails.ToArray());
                    }
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }