Exemplo n.º 1
0
		private void butSig_Click(object sender,EventArgs e) {
			FormEmailDigitalSignature form=new FormEmailDigitalSignature(_certSig);
			if(form.ShowDialog()==DialogResult.OK) {
				//If the user just added trust, then refresh to pull the newly added certificate into the memory cache.
				EmailMessages.RefreshCertStoreExternal(EmailAddressPreview);
			}
		}
Exemplo n.º 2
0
		private void gridEmailMessages_CellClick(object sender,UI.ODGridClickEventArgs e) {
			if(gridEmailMessages.SelectedIndices.Length>=2) {
				splitContainerNoFlicker.Panel2Collapsed=true;//Do not show preview if there are more than one emails selected.
				return;
			}
			EmailMessage emailMessage=(EmailMessage)gridEmailMessages.Rows[e.Row].Tag;
			if(EmailMessages.IsSecureWebMail(emailMessage.SentOrReceived)) {
				//We do not yet have a preview for secure web mail messages.
				splitContainerNoFlicker.Panel2Collapsed=true;
				return;
			}
			Cursor=Cursors.WaitCursor;
			EmailMessages.UpdateSentOrReceivedRead(emailMessage);
			emailMessage=EmailMessages.GetOne(emailMessage.EmailMessageNum);//Refresh from the database to get the full body text.
			FillGridEmailMessages();//To show the email is read.
			splitContainerNoFlicker.Panel2Collapsed=false;
			emailPreview.Width=splitContainerNoFlicker.Panel2.Width;//For some reason the anchors do not always work inside panel2.
			emailPreview.Height=splitContainerNoFlicker.Panel2.Height;//For some reason the anchors do not always work inside panel2.
			emailPreview.LoadEmailMessage(emailMessage);
			Cursor=Cursors.Default;
			//Handle Sig column clicks.
			if(e.Col!=4) {
				return;//Not the Sig column.
			}
			for(int i=0;i<emailMessage.Attachments.Count;i++) {
				if(emailMessage.Attachments[i].DisplayedFileName.ToLower()!="smime.p7s") {
					continue;
				}
				string smimeP7sFilePath=ODFileUtils.CombinePaths(EmailAttaches.GetAttachPath(),emailMessage.Attachments[i].ActualFileName);
				X509Certificate2 certSig=EmailMessages.GetEmailSignatureFromSmimeP7sFile(smimeP7sFilePath);
				FormEmailDigitalSignature form=new FormEmailDigitalSignature(certSig);
				if(form.ShowDialog()==DialogResult.OK) {
					//If the user just added trust, then refresh to pull the newly added certificate into the memory cache.
					EmailMessages.RefreshCertStoreExternal(AddressInbox);
					//Refresh the entire inbox, because there may be multiple email messages from the same address that the user just added trust for.
					//The Sig column may need to be updated on multiple rows.
					GetMessages();
				}
				break;
			}
		}