public bool CreateSmtpWindowAndConnectToServer(string userName, string password) { _smtpWindow = new SmtpWindow(); _user = new LoginInfo(); _user.ImapAddress = "imap.gmail.com"; _user.Username = userName; _user.Password = password; Login = userName; Password = password; _imap = new ImapControl(993); try { if (!_imap.Connect(_user)) { return(false); } } catch (Exception) { MessageBox.Show("Error.Connect to server"); } ViewModel.ViewModel.UpdateListOfMessages(Messages, _imap); ShowMessagesDataGrid.ItemsSource = Messages.OrderByDescending(m => m.Unread); SetCheckedForUnreadMessage(); int num = 0; _timer = new Timer(SendToServerCommands, new object(), 20000, 20000); return(true); }
private void ButtonForSendMessage_Click(object sender, RoutedEventArgs e) { _smtpWindow = new SmtpWindow(); _smtpWindow.Login = Login; _smtpWindow.Password = Password; _smtpWindow.Show(); }