using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using BS.Shared; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; namespace BeWo.View.Detail { /// /// Interaction logic for HomeView.xaml /// public partial class ViewMailView : BeWoView { private Dictionary _receiverMap = new Dictionary(); public ViewMailView(MailDC mail) { this.InitializeComponent(); this.FillContent(mail); } public enum Mode { Forward, Reply } private void FillContent(MailDC mail) { this.mailTextBox.Text = mail.Message; this.subjectTextBox.Text = mail.Subject; this.senderTextBox.Text = mail.Sender; var priority = mail.Priority ?? Priority.normal; this.priorityLabel.Content = priority == Priority.low ? "Nidrige Priorität" : priority == Priority.high ? "Hohe Priorität" : "Normale Priorität"; // attachmentTextBox.Text = mail.Attachments.Select(attachment => attachment.FileName).Aggregate((acc, str) => acc + ", " + str); foreach (var attachment in mail.Attachments) { var link = new Hyperlink(new Run(attachment.Description)) { // NavigateUri = new Uri(attachment.DownloadURL), // Tag = attachment }; // var button = new Button() // { // Content = attachment.Description,// FileName, // Tag = attachment // }; // button.Click += new RoutedEventHandler(viewAttachmentButton_Click); // attachmentWrapPanel.Children.Add(button); this.attachmentWrapPanel.Children.Add(new TextBlock(link) { Margin = new Thickness(10, 10, 10, 10) }); } } // void viewAttachmentButton_Click(object sender, RoutedEventArgs e) // { // var button = sender as Button; // var attachment = button.Tag as FileAttachmentDC; // MessageBox.Show("Sollte jetzt irgendwie folgendes laden:\n\n" + attachment.URL); // //var navigationService = System.Windows.Navigation.NavigationService.GetNavigationService(this); // //navigationService.Navigate(new Uri(attachment.URL)); // } } }