Пример #1
0
 public SentMailReadingWindow(IMail message, EmailBox emailBox)
 {
     this.InitializeComponent();
     this.Message  = message;
     this.EmailBox = emailBox;
     this.ShowMessageInWindow();
 }
Пример #2
0
 public DraftsMailWindow(EmailBox emailBox, IMail message, long messageUID)
 {
     this.InitializeComponent();
     this.EmailBox    = emailBox;
     this.Message     = message;
     this.Attachments = new List <byte[]>();
     this.MessageUID  = messageUID;
     this.ShowMessageInWindow();
 }
Пример #3
0
 public SendMailWindow(EmailBox emailBox)
 {
     this.InitializeComponent();
     this.EmailBox    = emailBox;
     this.Attachments = new List <byte[]>();
 }
Пример #4
0
        private void AcceptButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.imapServerAddressTextBox.Text == String.Empty ||
                this.imapPortTextBox.Text == String.Empty ||
                this.smtpServerAddressTextBox.Text == String.Empty ||
                this.smtpPortTextBox.Text == String.Empty ||
                this.emailAddressTextBox.Text == String.Empty ||
                this.passwordPasswordBox.Password == String.Empty)
            {
                MessageBox.Show("Все поля обязательны для заполнения.", "Ошибка",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                EmailBox emailBox;
                try
                {
                    emailBox = new EmailBox(this.emailAddressTextBox.Text.Trim(' '), this.passwordPasswordBox.Password,
                                            this.imapServerAddressTextBox.Text.Trim(' '), Convert.ToInt32(this.imapPortTextBox.Text),
                                            this.smtpServerAddressTextBox.Text.Trim(' '), Convert.ToInt32(this.smtpPortTextBox.Text));
                }
                catch (FormatException)
                {
                    MessageBox.Show("Номер порта должен быть целым числом.", "Ошибка",
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                thread = new Thread(() =>
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        this.connectionInfoLabel.Content = "Попытка подключения к серверу...";
                        this.Cursor = Cursors.Wait;
                        this.cancelButton.Cursor    = Cursors.Arrow;
                        this.acceptButton.IsEnabled = false;
                    });

                    bool isConnected = emailBox.ConnectFull();

                    if (isConnected)
                    {
                        this.EmailBox = emailBox;
                        this.Dispatcher.Invoke(() =>
                        {
                            this.Close();
                        });
                    }
                    else
                    {
                        MessageBox.Show("Ошибка соединения с сервером." +
                                        " Проверьте правильность введённых данных или интернет соеденение.", "Ошибка",
                                        MessageBoxButton.OK, MessageBoxImage.Error);
                    }

                    this.Dispatcher.Invoke(() =>
                    {
                        this.connectionInfoLabel.Content = String.Empty;
                        this.Cursor = null;
                        this.cancelButton.Cursor    = null;
                        this.acceptButton.IsEnabled = true;
                    });
                })
                {
                    IsBackground = true, Name = "ConnectThread"
                };
                thread.Start();
            }
        }
Пример #5
0
 public EmailOptionsWindow(EmailBox emailBox) : this()
 {
     this.EmailBox = emailBox;
 }