pEp format again
authorvb
Mon, 14 Jul 2014 08:12:25 +0200
changeset 1a6c2462cf5d2
parent 0 6dfec3b090d6
child 2 ae3692e69e35
pEp format again
CryptableMailItem.cs
EncryptionStatusPanel.cs
ThisAddIn.Designer.cs
ThisAddIn.Designer.xml
     1.1 --- a/CryptableMailItem.cs	Wed Jun 25 18:35:57 2014 +0200
     1.2 +++ b/CryptableMailItem.cs	Mon Jul 14 08:12:25 2014 +0200
     1.3 @@ -7,6 +7,8 @@
     1.4  using System.IO;
     1.5  using System.Windows.Forms;
     1.6  using System.Runtime.InteropServices;
     1.7 +using System.Text.RegularExpressions;
     1.8 +
     1.9  using Outlook = Microsoft.Office.Interop.Outlook;
    1.10  using pEpComAdapterLib;
    1.11  using MIME;
    1.12 @@ -239,148 +241,103 @@
    1.13                  }
    1.14              }
    1.15          }
    1.16 -        //if (false && (ct == _pEp_comm_type.pEp_ct_pEp || ct == _pEp_comm_type.pEp_ct_pEp_unconfirmed))
    1.17 -        //{
    1.18 -        //    MimeMessage msg;
    1.19 -        //    //MimeBody body;
    1.20 -        //    //msg = new MimeMessage();
    1.21 -        //    //if (mailItem.BodyFormat == Outlook.OlBodyFormat.olFormatPlain)
    1.22 -        //    //{
    1.23 -        //    //    msg.SetText(mailItem.Body);
    1.24 -        //    //}
    1.25 -        //    //else
    1.26 -        //    //{
    1.27 -        //    //    msg.SetContentType("multipart/alternative");
    1.28 -        //    //    msg.SetBoundary(null);
    1.29 -        //    //    body = msg.CreatePart();
    1.30 -        //    //    body.SetContentType("text/plain");
    1.31 -        //    //    body.SetCharset("us-ascii");
    1.32 -        //    //    body.SetTransferEncoding("quoted-printable");
    1.33 -        //    //    body.SetText(mailItem.Body);
    1.34 -        //    //    body = msg.CreatePart();
    1.35 -        //    //    body.SetContentType("text/html");
    1.36 -        //    //    body.SetCharset("us-ascii");
    1.37 -        //    //    body.SetTransferEncoding("quoted-printable");
    1.38 -        //    //    body.SetText(mailItem.HTMLBody);
    1.39 -        //    //}
    1.40 -        //    //StringBuilder sb = new StringBuilder();
    1.41 -        //    //msg.StoreBody(sb);
    1.42 -        //    //string plain = sb.ToString().Replace("\r\n", "\n");
    1.43 -        //    string plain = "";
    1.44 -        //    if (mailItem.BodyFormat == Outlook.OlBodyFormat.olFormatPlain)
    1.45 -        //        plain = mailItem.Body;
    1.46 -        //    else
    1.47 -        //        plain = mailItem.HTMLBody;
    1.48 -        //    string cipher;
    1.49 -        //    string[] _key_list = key_list.ToArray();
    1.50 -        //    _pEp_STATUS status = pEp.encrypt(_key_list, plain, out cipher);
    1.51 -        //    if (status == _pEp_STATUS.pEp_STATUS_OK)
    1.52 -        //    {
    1.53 -        //        foreach (Outlook.Attachment attachment in mailItem.Attachments)
    1.54 -        //        {
    1.55 -        //            attachment.Delete();
    1.56 -        //        }
    1.57 -        //        mailItem.BodyFormat = Outlook.OlBodyFormat.olFormatPlain;
    1.58  
    1.59 -        //        //msg = new MimeMessage();
    1.60 -        //        //msg.SetContentType("multipart/encrypted");
    1.61 -        //        //msg.SetBoundary(null);
    1.62 -        //        //msg.SetParameter("multipart/encrypted", "protocol", "\"application/pgp-encrypted\"");
    1.63 -        //        //MimeBody body1 = msg.CreatePart();
    1.64 -        //        //body1.SetContentType("application/pgp-encrypted");
    1.65 -        //        //body1.SetFieldValue("Version", "1", null);
    1.66 -        //        //MimeBody body2 = msg.CreatePart();
    1.67 -        //        //body2.SetText(cipher);
    1.68 -        //        //body2.SetContentType("application/octet-stream");
    1.69 +        protected void encrypt_pEp_format(List<string> key_list, pEp_identity_s me)
    1.70 +        {
    1.71 +            MimeMessage msg;
    1.72 +            MimeBody body;
    1.73 +            msg = new MimeMessage();
    1.74 +            if (mailItem.BodyFormat != Outlook.OlBodyFormat.olFormatHTML)
    1.75 +            {
    1.76 +                msg.SetText(mailItem.Body);
    1.77 +            }
    1.78 +            else if (mailItem.BodyFormat == Outlook.OlBodyFormat.olFormatHTML)
    1.79 +            {
    1.80 +                msg.SetContentType("multipart/alternative");
    1.81 +                msg.SetBoundary(null);
    1.82 +                body = msg.CreatePart();
    1.83 +                body.SetContentType("text/plain");
    1.84 +                body.SetCharset("us-ascii");
    1.85 +                body.SetTransferEncoding("quoted-printable");
    1.86 +                body.SetText(mailItem.Body);
    1.87 +                body = msg.CreatePart();
    1.88 +                body.SetContentType("text/html");
    1.89 +                body.SetCharset("us-ascii");
    1.90 +                body.SetTransferEncoding("quoted-printable");
    1.91 +                body.SetText(mailItem.HTMLBody);
    1.92 +            }
    1.93 +            StringBuilder sb = new StringBuilder();
    1.94 +            msg.StoreBody(sb);
    1.95 +            string plain = sb.ToString().Replace("\r\n", "\n");
    1.96 +            string cipher;
    1.97 +            string[] _key_list = key_list.ToArray();
    1.98 +            _pEp_STATUS status = pEp.encrypt(_key_list, plain, out cipher);
    1.99 +            if (status == _pEp_STATUS.pEp_STATUS_OK)
   1.100 +            {
   1.101 +                foreach (Outlook.Attachment attachment in mailItem.Attachments)
   1.102 +                {
   1.103 +                    attachment.Delete();
   1.104 +                }
   1.105 +                mailItem.BodyFormat = Outlook.OlBodyFormat.olFormatPlain;
   1.106  
   1.107 -        //        //StringBuilder sb2 = new StringBuilder();
   1.108 -        //        //msg.StoreBody(sb2);
   1.109 +                msg = new MimeMessage();
   1.110 +                msg.SetContentType("multipart/encrypted");
   1.111 +                msg.SetBoundary(null);
   1.112 +                msg.SetParameter("multipart/encrypted", "protocol", "\"application/pgp-encrypted\"");
   1.113 +                MimeBody body1 = msg.CreatePart();
   1.114 +                body1.SetContentType("application/pgp-encrypted");
   1.115 +                body1.SetFieldValue("Version", "1", null);
   1.116 +                MimeBody body2 = msg.CreatePart();
   1.117 +                body2.SetText(cipher);
   1.118 +                body2.SetContentType("application/octet-stream");
   1.119  
   1.120 -        //        mailItem.Body = cipher;
   1.121 +                StringBuilder sb2 = new StringBuilder();
   1.122 +                msg.StoreBody(sb2);
   1.123  
   1.124 -        //        //string temp_name = Path.GetTempFileName();
   1.125 -        //        //File.Delete(temp_name);
   1.126 -        //        //string temp_dir = temp_name + ".dir";
   1.127 -        //        //Directory.CreateDirectory(temp_dir);
   1.128 +                mailItem.Body = cipher;
   1.129  
   1.130 -        //        //string temp_file;
   1.131 -        //        //Outlook.Attachment a;
   1.132 +                string temp_name = Path.GetTempFileName();
   1.133 +                File.Delete(temp_name);
   1.134 +                string temp_dir = temp_name + ".dir";
   1.135 +                Directory.CreateDirectory(temp_dir);
   1.136  
   1.137 -        //        //try
   1.138 -        //        //{
   1.139 -        //        //    temp_file = temp_dir + "\\content.txt";
   1.140 -        //        //    File.WriteAllText(temp_file, sb2.ToString());
   1.141 -        //        //    a = mailItem.Attachments.Add(temp_file);
   1.142 -        //        //    File.Delete(temp_file);
   1.143 -        //        //    a.PropertyAccessor.SetProperty(PR_CONTENT_DISPOSITION, "inline");
   1.144 -        //        //}
   1.145 -        //        //catch (Exception ex)
   1.146 -        //        //{
   1.147 -        //        //    Stop(ex.ToString());
   1.148 -        //        //}
   1.149 +                string temp_file;
   1.150 +                Outlook.Attachment a;
   1.151  
   1.152 -        //        //temp_file = temp_dir + "\\cryptinfo.txt";
   1.153 -        //        //File.WriteAllText(temp_file, "Version: 1\r\n");
   1.154 -        //        //a = mailItem.Attachments.Add(temp_file);
   1.155 -        //        //File.Delete(temp_file);
   1.156 -        //        //a.PropertyAccessor.SetProperty(ThisAddIn.PR_ATTACH_MIME_TAG, "application/pgp-encrypted");
   1.157 +                try
   1.158 +                {
   1.159 +                    temp_file = temp_dir + "\\content.txt";
   1.160 +                    File.WriteAllText(temp_file, sb2.ToString());
   1.161 +                    a = mailItem.Attachments.Add(temp_file);
   1.162 +                    File.Delete(temp_file);
   1.163 +                    a.PropertyAccessor.SetProperty(ThisAddIn.PR_CONTENT_DISPOSITION, "inline");
   1.164 +                }
   1.165 +                catch
   1.166 +                {
   1.167 +                }
   1.168  
   1.169 -        //        //temp_file = temp_dir + "\\mail.pgp";
   1.170 -        //        //File.WriteAllText(temp_file, cipher);
   1.171 -        //        //a = mailItem.Attachments.Add(temp_file);
   1.172 -        //        //File.Delete(temp_file);
   1.173 -        //        //a.PropertyAccessor.SetProperty(ThisAddIn.PR_ATTACH_MIME_TAG, "application/octet-stream");
   1.174 +                temp_file = temp_dir + "\\cryptinfo.txt";
   1.175 +                File.WriteAllText(temp_file, "Version: 1\r\n");
   1.176 +                a = mailItem.Attachments.Add(temp_file);
   1.177 +                File.Delete(temp_file);
   1.178 +                a.PropertyAccessor.SetProperty(ThisAddIn.PR_ATTACH_MIME_TAG, "application/pgp-encrypted");
   1.179  
   1.180 -        //        //Directory.Delete(temp_dir);
   1.181 -        //        //mailItem.InternetCodepage = System.Text.Encoding.UTF8.CodePage;
   1.182 -        //    }
   1.183 -        //    else
   1.184 -        //    {
   1.185 -        //        DialogResult result = Stop("Cannot encrypt mail.\n\nencrypt() resulted in " + status.ToString() + "\n\nShould we send unencrypted instead?", "p≡p", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
   1.186 -        //        if (result == DialogResult.No)
   1.187 -        //            Cancel = true;
   1.188 -        //    }
   1.189 -        //}
   1.190 -        //else
   1.191 +                temp_file = temp_dir + "\\mail.pgp";
   1.192 +                File.WriteAllText(temp_file, cipher);
   1.193 +                a = mailItem.Attachments.Add(temp_file);
   1.194 +                File.Delete(temp_file);
   1.195 +                a.PropertyAccessor.SetProperty(ThisAddIn.PR_ATTACH_MIME_TAG, "application/octet-stream");
   1.196  
   1.197 -        public void encrypt()
   1.198 +                Directory.Delete(temp_dir);
   1.199 +                mailItem.InternetCodepage = System.Text.Encoding.UTF8.CodePage;
   1.200 +            }
   1.201 +        }
   1.202 +
   1.203 +        protected void encrypt_inline_PGP(List<string> key_list, pEp_identity_s me)
   1.204          {
   1.205  
   1.206 -            pEp_identity_s me = ThisAddIn.addIn.mySelf();
   1.207 -            pEp.log("me", "debug", me.address + ", " + me.fpr);
   1.208 -
   1.209 -            List<string> key_list = new List<string>();
   1.210 -            key_list.Add(me.fpr);
   1.211 -
   1.212 -            pEp.log("addresses", "debug", String.Join(",", addresses));
   1.213 -            foreach (string address in addresses)
   1.214 -            {
   1.215 -                try
   1.216 -                {
   1.217 -                    pEp.log("get_identity", "debug", address);
   1.218 -                    pEp_identity_s ident = pEp.get_identity(address);
   1.219 -                    pEp.log("ident", "debug", ident.fpr);
   1.220 -                    key_list.Add(ident.fpr);
   1.221 -                }
   1.222 -                catch (COMException ex)
   1.223 -                {
   1.224 -                    MessageBox.Show("cannot encrypt; key is missing for " + address + "; " + ex.ToString());
   1.225 -                    return;
   1.226 -                }
   1.227 -                catch (Exception ex2)
   1.228 -                {
   1.229 -                    MessageBox.Show(ex2.ToString());
   1.230 -                    return;
   1.231 -                }
   1.232 -            }
   1.233 -
   1.234              string plain;
   1.235 -            pEp.log("BodyFormat", "debug", mailItem.BodyFormat.ToString());
   1.236 -            if (mailItem.BodyFormat == Outlook.OlBodyFormat.olFormatPlain)
   1.237 -                plain = (mailItem.Body + "\n").Replace("\r\n", "\n");
   1.238 -            else
   1.239 -                plain = (mailItem.HTMLBody + "\n").Replace("\r\n", "\n");
   1.240 -            pEp.log("plain", "debug", plain);
   1.241 +            plain = (mailItem.Body + "\n").Replace("\r\n", "\n");
   1.242  
   1.243              string cipher;
   1.244              keylist = key_list.ToArray();
   1.245 @@ -388,9 +345,7 @@
   1.246              _pEp_STATUS status;
   1.247              try
   1.248              {
   1.249 -                pEp.log("pEp.encrypt", "debug");
   1.250                  status = pEp.encrypt(keylist, plain, out cipher);
   1.251 -                pEp.log("pEp.encrypt done", "debug", cipher);
   1.252              }
   1.253              catch (COMException ex)
   1.254              {
   1.255 @@ -418,7 +373,11 @@
   1.256                      string temp_file = temp_dir + "\\" + filename;
   1.257                      attachment.SaveAsFile(temp_file);
   1.258                      filenames.Add(temp_file);
   1.259 -                    attachment.Delete();
   1.260 +                }
   1.261 +
   1.262 +                while (mailItem.Attachments.Count > 0)
   1.263 +                {
   1.264 +                    mailItem.Attachments.Remove(1);
   1.265                  }
   1.266  
   1.267                  mailItem.BodyFormat = Outlook.OlBodyFormat.olFormatPlain;
   1.268 @@ -454,6 +413,51 @@
   1.269              }
   1.270          }
   1.271  
   1.272 +        public void encrypt()
   1.273 +        {
   1.274 +            pEp_identity_s me = ThisAddIn.addIn.mySelf();
   1.275 +            pEp.log("me", "debug", me.address + ", " + me.fpr);
   1.276 +
   1.277 +            List<string> key_list = new List<string>();
   1.278 +            key_list.Add(me.fpr);
   1.279 +
   1.280 +            pEp.log("addresses", "debug", String.Join(",", addresses));
   1.281 +            foreach (string address in addresses)
   1.282 +            {
   1.283 +                try
   1.284 +                {
   1.285 +                    pEp.log("get_identity", "debug", address);
   1.286 +                    pEp_identity_s ident = pEp.get_identity(address);
   1.287 +                    pEp.log("ident", "debug", ident.fpr);
   1.288 +                    key_list.Add(ident.fpr);
   1.289 +                }
   1.290 +                catch (COMException ex)
   1.291 +                {
   1.292 +                    MessageBox.Show("cannot encrypt; key is missing for " + address + "; " + ex.ToString());
   1.293 +                    return;
   1.294 +                }
   1.295 +                catch (Exception ex2)
   1.296 +                {
   1.297 +                    MessageBox.Show(ex2.ToString());
   1.298 +                    return;
   1.299 +                }
   1.300 +            }
   1.301 +
   1.302 +            try
   1.303 +            {
   1.304 +                encrypt_inline_PGP(key_list, me);
   1.305 +            }
   1.306 +            catch
   1.307 +            {
   1.308 +                throw;
   1.309 +            }
   1.310 +
   1.311 +            while (mailItem.Attachments.Count > 0)
   1.312 +            {
   1.313 +                mailItem.Attachments.Remove(1);
   1.314 +            }
   1.315 +        }
   1.316 +
   1.317          private const string pgp_begin_message = "-----BEGIN PGP MESSAGE-----";
   1.318  
   1.319          protected bool isInlinePGP()
   1.320 @@ -986,7 +990,9 @@
   1.321              pEp_identity_s me = ThisAddIn.addIn.mySelf();
   1.322  
   1.323              string my_key = pEp.export_key(me.fpr);
   1.324 -            string keyfile = temp_dir + "\\key.asc";
   1.325 +            string filename = "pEp key of " + me.username;
   1.326 +            filename = Regex.Replace(filename, "\\W+", "_");
   1.327 +            string keyfile = temp_dir + "\\" + filename + ".asc";
   1.328              File.WriteAllText(keyfile, my_key);
   1.329              Outlook.Attachment a = mailItem.Attachments.Add(keyfile);
   1.330              a.PropertyAccessor.SetProperty(ThisAddIn.PR_ATTACH_MIME_TAG, "text/plain");
     2.1 --- a/EncryptionStatusPanel.cs	Wed Jun 25 18:35:57 2014 +0200
     2.2 +++ b/EncryptionStatusPanel.cs	Mon Jul 14 08:12:25 2014 +0200
     2.3 @@ -296,16 +296,19 @@
     2.4                          TextBox txtPartnersSafewordsFull = (TextBox)handshakeDialog.Controls.Find("txtPartnersSafewordsFull", true).First();
     2.5                          TextBox txtPartnersFpr = (TextBox)handshakeDialog.Controls.Find("txtPartnersFpr", true).First();
     2.6  
     2.7 -                        string addressPartner;
     2.8 +                        pEp_identity_s identityPartner = new pEp_identity_s();
     2.9                          if (mailItem.incoming)
    2.10 -                            addressPartner = mailItem.from;
    2.11 +                        {
    2.12 +                            identityPartner.address = mailItem.from;
    2.13 +                        }
    2.14                          else // outgoing
    2.15 -                            addressPartner = mailItem.addresses.First(); // BUG: this is not true for all cases
    2.16 +                        {
    2.17 +                            identityPartner.address = mailItem.addresses.First(); // BUG: this is not true for all cases
    2.18 +                        }
    2.19  
    2.20 -                        pEp_identity_s identityPartner;
    2.21                          try
    2.22                          {
    2.23 -                            identityPartner = ThisAddIn.pEp.get_identity(addressPartner);
    2.24 +                            identityPartner = ThisAddIn.pEp.update_identity(identityPartner);
    2.25                          }
    2.26                          catch
    2.27                          {
    2.28 @@ -313,7 +316,7 @@
    2.29                              return;
    2.30                          }
    2.31  
    2.32 -                        lblPartner.Text = addressPartner + ":";
    2.33 +                        lblPartner.Text = identityPartner.address + ":";
    2.34                          txtPartnersSafewordsShort.Text = ThisAddIn.pEp.safewords(identityPartner.fpr, max_words: 5).ToLower();
    2.35                          txtPartnersSafewordsFull.Text = ThisAddIn.pEp.safewords(identityPartner.fpr).ToLower();
    2.36                          txtPartnersFpr.Text = quadruple(identityPartner.fpr);
    2.37 @@ -340,12 +343,12 @@
    2.38                              case DialogResult.Yes:
    2.39                                  if ((int)identityPartner.comm_type < 0x80)
    2.40                                      identityPartner.comm_type = (_pEp_comm_type)((int)identityPartner.comm_type + 0x80);
    2.41 -                                ThisAddIn.pEp.set_identity(identityPartner);
    2.42 +                                ThisAddIn.pEp.update_identity(identityPartner);
    2.43                                  enc_status = EncStatus.secure;
    2.44                                  break;
    2.45                              case DialogResult.No:
    2.46                                  identityPartner.comm_type = _pEp_comm_type.pEp_ct_COMPROMIZED;
    2.47 -                                ThisAddIn.pEp.set_identity(identityPartner);
    2.48 +                                ThisAddIn.pEp.update_identity(identityPartner);
    2.49                                  enc_status = EncStatus.forged;
    2.50                                  break;
    2.51                          }
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/ThisAddIn.Designer.cs	Mon Jul 14 08:12:25 2014 +0200
     3.3 @@ -0,0 +1,286 @@
     3.4 +//------------------------------------------------------------------------------
     3.5 +// <auto-generated>
     3.6 +//     This code was generated by a tool.
     3.7 +//     Runtime Version:4.0.30319.34014
     3.8 +//
     3.9 +//     Changes to this file may cause incorrect behavior and will be lost if
    3.10 +//     the code is regenerated.
    3.11 +// </auto-generated>
    3.12 +//------------------------------------------------------------------------------
    3.13 +
    3.14 +#pragma warning disable 414
    3.15 +namespace pEp {
    3.16 +    
    3.17 +    
    3.18 +    /// 
    3.19 +    [Microsoft.VisualStudio.Tools.Applications.Runtime.StartupObjectAttribute(0)]
    3.20 +    [global::System.Security.Permissions.PermissionSetAttribute(global::System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
    3.21 +    public sealed partial class ThisAddIn : Microsoft.Office.Tools.Outlook.OutlookAddInBase {
    3.22 +        
    3.23 +        internal Microsoft.Office.Tools.CustomTaskPaneCollection CustomTaskPanes;
    3.24 +        
    3.25 +        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
    3.26 +        private global::System.Object missing = global::System.Type.Missing;
    3.27 +        
    3.28 +        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
    3.29 +        internal Microsoft.Office.Interop.Outlook.Application Application;
    3.30 +        
    3.31 +        /// 
    3.32 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    3.33 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
    3.34 +        public ThisAddIn(global::Microsoft.Office.Tools.Outlook.Factory factory, global::System.IServiceProvider serviceProvider) : 
    3.35 +                base(factory, serviceProvider, "AddIn", "ThisAddIn") {
    3.36 +            Globals.Factory = factory;
    3.37 +        }
    3.38 +        
    3.39 +        /// 
    3.40 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    3.41 +        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
    3.42 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
    3.43 +        protected override void Initialize() {
    3.44 +            base.Initialize();
    3.45 +            this.Application = this.GetHostItem<Microsoft.Office.Interop.Outlook.Application>(typeof(Microsoft.Office.Interop.Outlook.Application), "Application");
    3.46 +            Globals.ThisAddIn = this;
    3.47 +            global::System.Windows.Forms.Application.EnableVisualStyles();
    3.48 +            this.InitializeCachedData();
    3.49 +            this.InitializeControls();
    3.50 +            this.InitializeComponents();
    3.51 +            this.InitializeData();
    3.52 +        }
    3.53 +        
    3.54 +        /// 
    3.55 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    3.56 +        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
    3.57 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
    3.58 +        protected override void FinishInitialization() {
    3.59 +            this.InternalStartup();
    3.60 +            this.OnStartup();
    3.61 +        }
    3.62 +        
    3.63 +        /// 
    3.64 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    3.65 +        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
    3.66 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
    3.67 +        protected override void InitializeDataBindings() {
    3.68 +            this.BeginInitialization();
    3.69 +            this.BindToData();
    3.70 +            this.EndInitialization();
    3.71 +        }
    3.72 +        
    3.73 +        /// 
    3.74 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    3.75 +        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
    3.76 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
    3.77 +        private void InitializeCachedData() {
    3.78 +            if ((this.DataHost == null)) {
    3.79 +                return;
    3.80 +            }
    3.81 +            if (this.DataHost.IsCacheInitialized) {
    3.82 +                this.DataHost.FillCachedData(this);
    3.83 +            }
    3.84 +        }
    3.85 +        
    3.86 +        /// 
    3.87 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    3.88 +        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
    3.89 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
    3.90 +        private void InitializeData() {
    3.91 +        }
    3.92 +        
    3.93 +        /// 
    3.94 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    3.95 +        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
    3.96 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
    3.97 +        private void BindToData() {
    3.98 +        }
    3.99 +        
   3.100 +        /// 
   3.101 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   3.102 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
   3.103 +        private void StartCaching(string MemberName) {
   3.104 +            this.DataHost.StartCaching(this, MemberName);
   3.105 +        }
   3.106 +        
   3.107 +        /// 
   3.108 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   3.109 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
   3.110 +        private void StopCaching(string MemberName) {
   3.111 +            this.DataHost.StopCaching(this, MemberName);
   3.112 +        }
   3.113 +        
   3.114 +        /// 
   3.115 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   3.116 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
   3.117 +        private bool IsCached(string MemberName) {
   3.118 +            return this.DataHost.IsCached(this, MemberName);
   3.119 +        }
   3.120 +        
   3.121 +        /// 
   3.122 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   3.123 +        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
   3.124 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
   3.125 +        private void BeginInitialization() {
   3.126 +            this.BeginInit();
   3.127 +            this.CustomTaskPanes.BeginInit();
   3.128 +        }
   3.129 +        
   3.130 +        /// 
   3.131 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   3.132 +        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
   3.133 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
   3.134 +        private void EndInitialization() {
   3.135 +            this.CustomTaskPanes.EndInit();
   3.136 +            this.EndInit();
   3.137 +        }
   3.138 +        
   3.139 +        /// 
   3.140 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   3.141 +        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
   3.142 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
   3.143 +        private void InitializeControls() {
   3.144 +            this.CustomTaskPanes = Globals.Factory.CreateCustomTaskPaneCollection(null, null, "CustomTaskPanes", "CustomTaskPanes", this);
   3.145 +        }
   3.146 +        
   3.147 +        /// 
   3.148 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   3.149 +        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
   3.150 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
   3.151 +        private void InitializeComponents() {
   3.152 +        }
   3.153 +        
   3.154 +        /// 
   3.155 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   3.156 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
   3.157 +        private bool NeedsFill(string MemberName) {
   3.158 +            return this.DataHost.NeedsFill(this, MemberName);
   3.159 +        }
   3.160 +        
   3.161 +        /// 
   3.162 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   3.163 +        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
   3.164 +        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
   3.165 +        protected override void OnShutdown() {
   3.166 +            this.CustomTaskPanes.Dispose();
   3.167 +            base.OnShutdown();
   3.168 +        }
   3.169 +    }
   3.170 +    
   3.171 +    /// 
   3.172 +    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   3.173 +    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
   3.174 +    internal sealed partial class Globals {
   3.175 +        
   3.176 +        /// 
   3.177 +        private Globals() {
   3.178 +        }
   3.179 +        
   3.180 +        private static ThisAddIn _ThisAddIn;
   3.181 +        
   3.182 +        private static global::Microsoft.Office.Tools.Outlook.Factory _factory;
   3.183 +        
   3.184 +        private static ThisRibbonCollection _ThisRibbonCollection;
   3.185 +        
   3.186 +        private static ThisFormRegionCollection _ThisFormRegionCollection;
   3.187 +        
   3.188 +        internal static ThisAddIn ThisAddIn {
   3.189 +            get {
   3.190 +                return _ThisAddIn;
   3.191 +            }
   3.192 +            set {
   3.193 +                if ((_ThisAddIn == null)) {
   3.194 +                    _ThisAddIn = value;
   3.195 +                }
   3.196 +                else {
   3.197 +                    throw new System.NotSupportedException();
   3.198 +                }
   3.199 +            }
   3.200 +        }
   3.201 +        
   3.202 +        internal static global::Microsoft.Office.Tools.Outlook.Factory Factory {
   3.203 +            get {
   3.204 +                return _factory;
   3.205 +            }
   3.206 +            set {
   3.207 +                if ((_factory == null)) {
   3.208 +                    _factory = value;
   3.209 +                }
   3.210 +                else {
   3.211 +                    throw new System.NotSupportedException();
   3.212 +                }
   3.213 +            }
   3.214 +        }
   3.215 +        
   3.216 +        internal static ThisRibbonCollection Ribbons {
   3.217 +            get {
   3.218 +                if ((_ThisRibbonCollection == null)) {
   3.219 +                    _ThisRibbonCollection = new ThisRibbonCollection(_factory.GetRibbonFactory());
   3.220 +                }
   3.221 +                return _ThisRibbonCollection;
   3.222 +            }
   3.223 +        }
   3.224 +        
   3.225 +        internal static ThisFormRegionCollection FormRegions {
   3.226 +            get {
   3.227 +                if ((_ThisFormRegionCollection == null)) {
   3.228 +                    _ThisFormRegionCollection = new ThisFormRegionCollection(Globals.ThisAddIn.GetFormRegions());
   3.229 +                }
   3.230 +                return _ThisFormRegionCollection;
   3.231 +            }
   3.232 +        }
   3.233 +    }
   3.234 +    
   3.235 +    /// 
   3.236 +    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   3.237 +    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "12.0.0.0")]
   3.238 +    internal sealed partial class ThisRibbonCollection : Microsoft.Office.Tools.Ribbon.RibbonCollectionBase {
   3.239 +        
   3.240 +        /// 
   3.241 +        internal ThisRibbonCollection(global::Microsoft.Office.Tools.Ribbon.RibbonFactory factory) : 
   3.242 +                base(factory) {
   3.243 +        }
   3.244 +        
   3.245 +        internal ThisRibbonCollection this[Microsoft.Office.Interop.Outlook.Inspector inspector] {
   3.246 +            get {
   3.247 +                return this.GetRibbonContextCollection<ThisRibbonCollection>(inspector);
   3.248 +            }
   3.249 +        }
   3.250 +        
   3.251 +        internal ThisRibbonCollection this[Microsoft.Office.Interop.Outlook.Explorer explorer] {
   3.252 +            get {
   3.253 +                return this.GetRibbonContextCollection<ThisRibbonCollection>(explorer);
   3.254 +            }
   3.255 +        }
   3.256 +    }
   3.257 +    
   3.258 +    /// 
   3.259 +    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   3.260 +    internal sealed partial class ThisFormRegionCollection : Microsoft.Office.Tools.Outlook.FormRegionCollectionBase {
   3.261 +        
   3.262 +        /// 
   3.263 +        public ThisFormRegionCollection(System.Collections.Generic.IList<Microsoft.Office.Tools.Outlook.IFormRegion> list) : 
   3.264 +                base(list) {
   3.265 +        }
   3.266 +        
   3.267 +        internal WindowFormRegionCollection this[Microsoft.Office.Interop.Outlook.Explorer explorer] {
   3.268 +            get {
   3.269 +                return ((WindowFormRegionCollection)(Globals.ThisAddIn.GetFormRegions(explorer, typeof(WindowFormRegionCollection))));
   3.270 +            }
   3.271 +        }
   3.272 +        
   3.273 +        internal WindowFormRegionCollection this[Microsoft.Office.Interop.Outlook.Inspector inspector] {
   3.274 +            get {
   3.275 +                return ((WindowFormRegionCollection)(Globals.ThisAddIn.GetFormRegions(inspector, typeof(WindowFormRegionCollection))));
   3.276 +            }
   3.277 +        }
   3.278 +    }
   3.279 +    
   3.280 +    /// 
   3.281 +    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
   3.282 +    internal sealed partial class WindowFormRegionCollection : Microsoft.Office.Tools.Outlook.FormRegionCollectionBase {
   3.283 +        
   3.284 +        /// 
   3.285 +        public WindowFormRegionCollection(System.Collections.Generic.IList<Microsoft.Office.Tools.Outlook.IFormRegion> list) : 
   3.286 +                base(list) {
   3.287 +        }
   3.288 +    }
   3.289 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/ThisAddIn.Designer.xml	Mon Jul 14 08:12:25 2014 +0200
     4.3 @@ -0,0 +1,4 @@
     4.4 +<hostitem:hostItem hostitem:baseType="Microsoft.Office.Tools.Outlook.OutlookAddInBase" hostitem:namespace="pEp" hostitem:className="ThisAddIn" hostitem:identifier="ThisAddIn" hostitem:primaryCookie="AddIn" hostitem:master="true" hostitem:factoryType="Microsoft.Office.Tools.Outlook.Factory" hostitem:startupIndex="0" xmlns:hostitem="http://schemas.microsoft.com/2004/VisualStudio/Tools/Applications/HostItem.xsd">
     4.5 +  <hostitem:hostObject hostitem:name="Application" hostitem:identifier="Application" hostitem:type="Microsoft.Office.Interop.Outlook.Application" hostitem:cookie="Application" hostitem:modifier="Internal" />
     4.6 +  <hostitem:hostControl hostitem:name="CustomTaskPanes" hostitem:identifier="CustomTaskPanes" hostitem:type="Microsoft.Office.Tools.CustomTaskPaneCollection" hostitem:primaryCookie="CustomTaskPanes" hostitem:modifier="Internal" />
     4.7 +</hostitem:hostItem>
     4.8 \ No newline at end of file