private void EmailLogin_OnClick(object sender, RoutedEventArgs e) { _newEmailPerson = new EmailLogin(_newEmailer); _newEmailPerson.ShowDialog(); if (!string.IsNullOrEmpty(_newEmailPerson.EmailUser)) { } try { _newEmailer = new PersonEmail(_newEmailPerson.EmailUser, _newEmailPerson.EmailPass) { SendingTo = _newEmailPerson.SendToEmail }; if (_newEmailPerson.WillSerialize) { SerializeTask(_newEmailer, _emailInfo); } _emailer = new EmailProcess(_newEmailer.EmailAddress, _newEmailer.Password, _newEmailer.SendingTo); } catch (Exception ex) { MessageBox.Show("Email information was not entered", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public MainWindow() { InitializeComponent(); _notifyIcon.Icon = new Icon(Resource.notepad2, 40, 40); this.StateChanged += new EventHandler(Window_Resize); _notifyIcon.MouseDoubleClick += new MouseEventHandler(Window_Unminimize); DeserializeEmail(_emailInfo); //check if saved email login exists //with no saved login, prompt user if (_isEmailSaved == false) { _newEmailPerson.ShowDialog(); _newEmailer = new PersonEmail(_newEmailPerson.EmailUser, _newEmailPerson.EmailPass) { SendingTo = _newEmailPerson.SendToEmail }; if (_newEmailPerson.WillSerialize) { SerializeTask(_newEmailer, _emailInfo); } } WindowStartupLocation = WindowStartupLocation.CenterScreen; _checkTime.Elapsed += checkTime_Elapsed; _checkTime.Enabled = true; _emailer = new EmailProcess(_newEmailer.EmailAddress, _newEmailer.Password, _newEmailer.SendingTo); _listOfTasks = new TasksView(); TaskList.ItemsSource = _listOfTasks; TaskList.Items.Refresh(); DeserializeTasks(_taskData); //if (_taskData.Count() > 0) // if tasks were loaded, auto select first time //{ // TaskList.SelectedIndex = 0; //} //MessageBox.Show(System.IO.Path.GetDirectoryName( // System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)); }