コード例 #1
0
        public DisplayAttachmentWindow(ImageAttachment attachment)
        {
            InitializeComponent();

            Title = String.Format("{0} - {1}", attachment.FileName, App.Current.ApplicationName);
            ImageHost.Source = attachment.Image;
            ImageWrapper.MouseDown += new MouseButtonEventHandler(ImageWrapper_MouseDown);

            if (String.IsNullOrEmpty(attachment.OriginalPath))
            {
                OriginalPathTextBlock.Visibility = Visibility.Collapsed;
            }
            else
            {
                OriginalPathTextBlock.Text = attachment.OriginalPath;
                OriginalPathTextBlock.Visibility = Visibility.Visible;
            }
        }
コード例 #2
0
 public void AddImageFromMemory(byte[] data)
 {
     string fileName = Guid.NewGuid().ToString() + ".png";
     ImageAttachment attachment = new ImageAttachment(fileName, data);
     Items.Add(attachment);
 }
コード例 #3
0
 private void PasteFileList(IEnumerable<string> fileNames)
 {
     foreach (string path in fileNames.Where(w => File.Exists(w)))
     {
         string fileName = GetFileName(path);
         Attachment attachment = null;
         try
         {
             attachment = new ImageAttachment(fileName, path);
         }
         catch
         {
             // Parse error, not an image. Exception intentionally ignored...
         }
         if (attachment == null)
         {
             attachment = new Attachment(fileName, path);
         }
         Items.Add(attachment);
     }
 }