Files
BeWoPlaner/BeWo/View/Detail/ViewMailView.xaml.cs
Christian 9c97d6fe79 CB Merge
2019-07-12 17:36:37 +02:00

72 lines
2.6 KiB
C#

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
{
/// <summary>
/// Interaction logic for HomeView.xaml
/// </summary>
public partial class ViewMailView : BeWoView
{
private Dictionary<string, CompactEmployeeDC> _receiverMap = new Dictionary<string, CompactEmployeeDC>();
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));
// }
}
}