public MainWindow(IMAPService IMAPServiceObject) { InitializeComponent(); mainWindowViewModel = new MainWindowViewModel(IMAPServiceObject); lstvEmails.ItemsSource = mainWindowViewModel.Emails; lstvEmails.AddHandler(ListViewItem.MouseDoubleClickEvent, new MouseButtonEventHandler(listView_MouseDoubleClick)); }
public MainWindowViewModel(IMAPService iMAPServiceObject) { this.IMAPServiceObject = iMAPServiceObject; CredentialServiceObject = new CredentialService(); Emails = new ObservableCollection <EmailModel>(); refreshEmails = true; Task.Run(() => GetEmailsAsync()); }
private IMAPService AttemptLogin(string[] cred) { string username = cred[0]; string password = cred[1]; IMAPService IMAPServiceObject = new IMAPService(); IMAPServiceObject.ConnectToIMAPService(username, password); return(IMAPServiceObject); }
private void Application_Startup(object sender, StartupEventArgs e) { string[] cred = CredentialServiceObject.GetSavedCredentials(); if (cred == null || cred.Length != 2) { CreateLoginForm(); } else { try { IMAPService IMAPServiceObject = AttemptLogin(cred); CreateMainWindow(IMAPServiceObject); } catch (ArgumentException) { CreateLoginForm(); } } }
public void Setup() { IMAPServiceObject = new IMAPService(); }
private void CreateMainWindow(IMAPService IMAPServiceObject) { MainWindow mainWindow = new MainWindow(IMAPServiceObject); mainWindow.Show(); }