示例#1
0
 public EmailWindow()
 {
     InitializeComponent();
     if (Properties.Settings.Default.User_AdvancedLogging)
     {
         Log.Commit("[EmailWindow] Loaded.");
     }
     //Define the instance of the EmailWindow "Window" as this window.
     Window = this;
 }
 //Opens the email window and fills it with the data for the selected customer so they can be emailed.
 private void Email_Click(object sender, RoutedEventArgs e)
 {
     if (CustomerList.SelectedItem != null)
     {
         //Fetch that row and store it as a CustomerViewmodel so it is easy to manipulate the data.
         CustomerViewmodel SelectedCustomer = (CustomerViewmodel)CustomerList.SelectedItem;
         EditFirstnameField.Text = SelectedCustomer.Firstname;
         EditLastnameField.Text  = SelectedCustomer.Lastname;
         EditEmailField.Text     = SelectedCustomer.Email;
         EmailWindow emailWindow = new EmailWindow();
         emailWindow.Show();
         EmailWindow.SetContent(SelectedCustomer.Email, SelectedCustomer.Firstname, SelectedCustomer.Lastname);
     }
     else
     {
         MessageBox.Show("No item selected.", "Invalid", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }