Beispiel #1
0
 private void BrowseForEditorToolStripMenuItemClick(object sender, EventArgs e)
 {
     if (_sourceBtn == null)
     {
         _sourceBtn = (AttachPanel)mnuAttach.SourceControl;
     }
     if (_sourceBtn == null) return;
     BrowseAndOpenFile(_sourceBtn.Pointer);
 }
Beispiel #2
0
 private void MnuAttachOpening(object sender, System.ComponentModel.CancelEventArgs e)
 {
     _sourceBtn = mnuAttach.SourceControl as AttachPanel;
 }
Beispiel #3
0
 private void UseDefaultApplicationToolStripMenuItemClick(object sender, EventArgs e)
 {
     if (_sourceBtn == null)
     {
         _sourceBtn = (AttachPanel)mnuAttach.SourceControl;
     }
     if (_sourceBtn == null) return;
     OpenFile(_sourceBtn.Pointer);
 }
Beispiel #4
0
 private void SaveToolStripMenuItemClick(object sender, EventArgs e)
 {
     if (_sourceBtn == null)
     {
         _sourceBtn = (AttachPanel)mnuAttach.SourceControl;
     }
     SaveFile(_sourceBtn.Pointer);
 }
Beispiel #5
0
 private void PreviewToolStripMenuItemClick(object sender, EventArgs e)
 {
     //fire click to preview attachment
     if (_sourceBtn == null)
     {
         _sourceBtn = (AttachPanel)mnuAttach.SourceControl;
     }
     AttachmentClick(_sourceBtn.Pointer);
 }
Beispiel #6
0
 internal static void LoadAttachments(Outlook.MailItem item, string[] pointers,string baseUrl,
     Account account, string senderAddress, string serverName, string serverPort, 
     string encryptKey, string encryptKey2, List<string> EmbeddedFileNames, 
     ref Dictionary<string,Attachment> attachList,
     ref Dictionary<string, Redemption.Attachment> embedded,
     ref Panel panelAttach, ref int upperWidth, ref int upperHeight)
 {
     const string SOURCE = CLASS_NAME + "LoadAttachments";
     SafeMailItem safMail;
     try
     {
         safMail = RedemptionLoader.new_SafeMailItem();
     }
     catch (Exception ex)
     {
         Logger.Warning(SOURCE,string.Format(
             "unable to load attachments for {0}, error instantiating SafeMailItem: {1}",
             item.Subject,ex.Message));
         return;
     }
     safMail.Item = item;
     var safAttachments = safMail.Attachments;
     var index = 0;
     foreach (Redemption.Attachment safAttach in safAttachments)
     {
         index++;
         var attach = new Attachment
                          {
                              Index = index,
                              Name = safAttach.DisplayName
                          };
         if (EmbeddedFileNames.Contains(safAttach.DisplayName)) continue;
         var btn = new AttachPanel
                       {
                           Caption = safAttach.DisplayName
                       };
         switch (safAttach.Type)
         {
             case 1: //byvalue
                 if (string.IsNullOrEmpty(pointers[index])) continue;
                 //is it hidden or have contentId
                 string contentId;
                 bool hidden;
                 GetAttachProps(safAttach, out contentId, out hidden);
                 if (hidden)
                 {
                     continue;
                 }
                 attach.Pointer = pointers[index];
                 //get the image
                 var container = ShellIcons.GetIconForFile(
                     attach.Name, true, false);
                 btn.Picture = container.Icon.ToBitmap();
                 btn.Pointer = attach.Pointer;
                 attachList.Add(attach.Pointer, attach);
                 break;
             case 5: //embedded - will have null/0 pointer
                 btn.Pointer = "embedded:" + index.ToString(CultureInfo.InvariantCulture);
                 embedded.Add(btn.Pointer, safAttach);
                 //use default envelope picture for button
                 break;
         }
         panelAttach.Controls.Add(btn);
         if (btn.Width > upperWidth) upperWidth = btn.Width;
         if (btn.Height > upperHeight) upperHeight = btn.Height;
     }
 }
Beispiel #7
0
 private void LoadAttachments()
 {
     var index = 0;
     var upperWidth = 0;
     var upperHeight = 0;
     panelAttach.Controls.Clear();
     foreach (Redemption.Attachment rdoAttach in _attachments)
     {
         index++;
         var btn = new AttachPanel
                       {
                           Caption = rdoAttach.DisplayName,
                           Pointer = index.ToString(CultureInfo.InvariantCulture)
                       };
         switch (rdoAttach.Type)
         {
             case 1: //byvalue
                 //is it hidden or have contentId
                 string contentId;
                 bool hidden;
                 Utils.GetAttachProps(rdoAttach, out contentId, out hidden);
                 if (!hidden)
                 {
                     //get the image
                     var container = ShellIcons.GetIconForFile(
                         rdoAttach.DisplayName, true, false);
                     btn.Picture = container.Icon.ToBitmap();
                 }
                 break;
             case 5: //embedded
                 //use default envelope picture for button
                 break;
             default:
                 //skip other types
                 continue;
         }
         panelAttach.Controls.Add(btn);
         if (btn.Width > upperWidth) upperWidth = btn.Width;
         if (btn.Height > upperHeight) upperHeight = btn.Height;
     }
     //adjust all to same (upper) Width
     for (var i = 0; i < panelAttach.Controls.Count; i++)
     {
         var btn = (AttachPanel)panelAttach.Controls[i];
         //hook up the event handler
         btn.PanelDblClick += AttachmentDoubleClick;
         if (btn.Width < upperWidth)
         {
             btn.AutoSize = false;
             btn.Width = upperWidth;
             btn.Height = upperHeight;
         }
     }
 }