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());
 }
Example #3
0
        private IMAPService AttemptLogin(string[] cred)
        {
            string      username          = cred[0];
            string      password          = cred[1];
            IMAPService IMAPServiceObject = new IMAPService();

            IMAPServiceObject.ConnectToIMAPService(username, password);
            return(IMAPServiceObject);
        }
Example #4
0
 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();
 }
Example #6
0
        private void CreateMainWindow(IMAPService IMAPServiceObject)
        {
            MainWindow mainWindow = new MainWindow(IMAPServiceObject);

            mainWindow.Show();
        }