Some cleanup OUT-470
authorThomas
Wed, 18 Jul 2018 17:03:48 +0200
branchOUT-470
changeset 2301 91cd910b2f72
parent 2300 3b84e6c09dfc
child 2302 f28d54e6e71f
Some cleanup
UI/FormRegionPrivacyStatus.Designer.cs
UI/FormRegionPrivacyStatus.cs
--- a/UI/FormRegionPrivacyStatus.Designer.cs	Wed Jul 18 16:37:42 2018 +0200
+++ b/UI/FormRegionPrivacyStatus.Designer.cs	Wed Jul 18 17:03:48 2018 +0200
@@ -43,41 +43,25 @@
         {
             this.components = new System.ComponentModel.Container();
             this.TimerRefresh = new System.Windows.Forms.Timer(this.components);
-            this.PanelPrivacyStatus = new System.Windows.Forms.Panel();
             this.ElementHostFormControl = new System.Windows.Forms.Integration.ElementHost();
-            this.FormControlPrivacyStatusChild = new pEp.UI.FormControlPrivacyStatus();
-            this.PanelPrivacyStatus.SuspendLayout();
             this.SuspendLayout();
             // 
-            // PanelPrivacyStatus
-            // 
-            this.PanelPrivacyStatus.BackColor = System.Drawing.Color.Transparent;
-            this.PanelPrivacyStatus.Controls.Add(this.ElementHostFormControl);
-            this.PanelPrivacyStatus.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.PanelPrivacyStatus.Location = new System.Drawing.Point(0, 0);
-            this.PanelPrivacyStatus.Name = "PanelPrivacyStatus";
-            this.PanelPrivacyStatus.Size = new System.Drawing.Size(500, 36);
-            this.PanelPrivacyStatus.TabIndex = 0;
-            // 
             // ElementHostFormControl
             // 
-            this.ElementHostFormControl.Dock = System.Windows.Forms.DockStyle.Fill;
             this.ElementHostFormControl.Location = new System.Drawing.Point(0, 0);
             this.ElementHostFormControl.Name = "ElementHostFormControl";
-            this.ElementHostFormControl.Size = new System.Drawing.Size(500, 36);
+            this.ElementHostFormControl.Size = new System.Drawing.Size(200, 100);
             this.ElementHostFormControl.TabIndex = 0;
-            this.ElementHostFormControl.Child = this.FormControlPrivacyStatusChild;
+            this.ElementHostFormControl.Child = null;
             // 
             // FormRegionPrivacyStatus
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.Controls.Add(this.PanelPrivacyStatus);
             this.Name = "FormRegionPrivacyStatus";
             this.Size = new System.Drawing.Size(500, 36);
             this.FormRegionShowing += new System.EventHandler(this.FormRegionPrivacyStatus_FormRegionShowing);
             this.FormRegionClosed += new System.EventHandler(this.FormRegionPrivacyStatus_FormRegionClosed);
-            this.PanelPrivacyStatus.ResumeLayout(false);
             this.ResumeLayout(false);
 
         }
@@ -101,9 +85,7 @@
         #endregion
 
         private System.Windows.Forms.Timer TimerRefresh;
-        private System.Windows.Forms.Panel PanelPrivacyStatus;
         private System.Windows.Forms.Integration.ElementHost ElementHostFormControl;
-        private UI.FormControlPrivacyStatus FormControlPrivacyStatusChild;
 
         public partial class FormRegionPrivacyStatusFactory : Microsoft.Office.Tools.Outlook.IFormRegionFactory
         {
--- a/UI/FormRegionPrivacyStatus.cs	Wed Jul 18 16:37:42 2018 +0200
+++ b/UI/FormRegionPrivacyStatus.cs	Wed Jul 18 17:03:48 2018 +0200
@@ -441,35 +441,11 @@
                 }
                 finally
                 {
-                    if (application != null)
-                    {
-                        //Marshal.ReleaseComObject(application);
-                        application = null;
-                    }
-
-                    if (currentInspector != null)
-                    {
-                        // Marshal.ReleaseComObject(currentInspector);
-                        currentInspector = null;
-                    }
-
-                    if (newInspector != null)
-                    {
-                        // Marshal.ReleaseComObject(newInspector);
-                        newInspector = null;
-                    }
-
-                    if (tempMailItem != null)
-                    {
-                        // Marshal.ReleaseComObject(tempMailItem);
-                        tempMailItem = null;
-                    }
-
-                    if (omi != null)
-                    {
-                        // Marshal.ReleaseComObject(omi);
-                        omi = null;
-                    }
+                    application = null;
+                    currentInspector = null;
+                    newInspector = null;
+                    omi = null;
+                    tempMailItem = null;
                 }
             }
 
@@ -574,7 +550,10 @@
                             }
                         }
                     }
-                    catch { }
+                    catch (Exception ex)
+                    {
+                        Log.Error("SetIsEnabled: Error occured. " + ex.ToString());
+                    }
                     finally
                     {
                         currAccount = null;
@@ -584,18 +563,6 @@
                         sendingAccount = null;
                     }
 
-                    // Set reader upgrade link visibility
-                    if ((Globals.RELEASE_MODE == Globals.ReleaseMode.Reader) &&
-                        (this.cryptableMailItem != null) &&
-                        (this.cryptableMailItem.IsDraft))
-                    {
-                        this.FormControlPrivacyStatusChild.DisplayState.UpgradeLinkIsVisible = true;
-                    }
-                    else
-                    {
-                        this.FormControlPrivacyStatusChild.DisplayState.UpgradeLinkIsVisible = false;
-                    }
-
                     // Connect refresh timer
                     this.TimerRefresh.Tick += TimerRefresh_Tick;
                     this.isStarted = true;
@@ -913,22 +880,6 @@
         }
 
         /// <summary>
-        /// Event handler for when the form region is expanded or collapsed.
-        /// </summary>
-        private void FormRegionPrivacyStatus_Expanded(object sender, EventArgs e)
-        {
-            /* This Outlook form region has a bug where clicking the '+' button to expand will also
-             * raise a click event on the privacy status button. Basically, Outlook would fire the click event 
-             * (FormControlPrivacyStatusChild_PrivacyViewClick) immediately after the region is expanded even though at 
-             * the time it was clicked it was collapsed and the click already captured by the expander '+' button.
-             * This code here works around that issue by disabling the manager form when the form region is collapsed.
-             * Since the click event occurs BEFORE the expanded event, this will disable opening the manage privacy status
-             * form in this situation.
-             */
-            this.isManagerFormEnabled = this.OutlookFormRegion.IsExpanded;
-        }
-
-        /// <summary>
         /// Event handler called after the refresh timer has elapsed.
         /// </summary>
         private void TimerRefresh_Tick(object sender, EventArgs e)
@@ -1056,7 +1007,6 @@
                         {
                             try
                             {
-                                this.FormControlPrivacyStatusChild.DisplayState.Rating = e.ProcessedRating;
                                 this.SetRating(e.ProcessedRating);
                                 Log.Verbose("MailItem_ProcessingComplete: Status bar updated with rating " + Enum.GetName(typeof(pEpRating), e.ProcessedRating));
                             }
@@ -1496,22 +1446,5 @@
                 this.handshakeDialog = null;
             }
         }
-
-        /// <summary>
-        /// Event handler for when the pEp website hyperlink is clicked.
-        /// </summary>
-        private void LinkLabelUpgrade_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
-        {
-            try
-            {
-                Process.Start(Globals.PEP_WEBSITE_UPGRADE_LINK);
-            }
-            catch (Exception ex)
-            {
-                Log.Error("LinkLabelUpgrade_LinkClicked: Unable to open website link, " + ex.ToString());
-            }
-
-            return;
-        }
     }
 }