private void ShowAdvancedOptions(object protectSimpleDlg) { NewProtectSimpleDialog psd = protectSimpleDlg as NewProtectSimpleDialog; if (psd == null) { return; } MethodInfo startMethod = m_policyClientProgressDialog.GetType().GetMethod("Start"); if (startMethod != null) { startMethod.Invoke(m_policyClientProgressDialog, null); } IPolicyClientUIManager2 m_uiManager = (IPolicyClientUIManager2)UIManagerFactory.CreateInstance("Workshare.Policy.ClientManager.ProtectDialog.ProtectPolicyClientUIManager2, Workshare.Policy.ClientManager"); IPolicyClientProgressDialog DialogProgress = m_uiManager.CreatePolicyClientProgressDialog(); IBlockOwner dBlockOwner = DialogProgress as IBlockOwner; if (null != dBlockOwner) { dBlockOwner.SetOwner = new System.Windows.Interop.WindowInteropHelper(psd).Owner; dBlockOwner.BlockOwner = true; } DialogProgress.Description = "Please wait..."; DialogProgress.SubDescription = "Initializing"; DialogProgress.SetSteps(7); m_policyClientProgressDialog.Complete(); m_policyClientProgressDialog.Hide(); ProcessRequest( DialogProgress, ShowProgress, false ); DialogProgress.Complete(); DialogProgress.Close(); m_policyClientProgressDialog = psd; MethodInfo stopMethod = m_policyClientProgressDialog.GetType().GetMethod("Stop"); if (stopMethod != null) { stopMethod.Invoke(m_policyClientProgressDialog, null); } if (m_processResult == ProcessResult.CANCELLED) { psd.AllowedToGo = false; if (psd.Visibility != System.Windows.Visibility.Visible) { psd.ShowDialog(); } psd.EnableControls(); } else { // So if PES dialog has been cancelled, we need to update ProcessResult based on ProtectSimple dialog's DialogResult, later on, see below // else if PES dialog has been "Sent", we need to remember the ProcessResult, and dont mess with it. m_bUpdateProcessResult = false; if (m_processResult == ClientManager.ProcessResult.PROCESSED) { psd.UpdateMru(); UpdateClientProfileMru(psd.MRUProfile); } } }
void ProcessDesktopProfiles(object sender, EventArgs eventArgs) { NewProtectSimpleDialog psd = sender as NewProtectSimpleDialog; if (psd == null) { Logger.LogError("NewProtectSimpleDialog is null"); return; } string profileLocation = psd.SelectedProfile; m_profileLocation = profileLocation; if (psd.ShowAdvancedOptions) { ResetPolicyCache();// Clear any previously selected profiles AddProtectSimpleProfile(profileLocation);// Add selected profile, eg what the advanced protect dialog will show as triggered. // Proceed to show the protect standard (email security) dialog, and let things happen ShowAdvancedOptions(sender); return; } // if large attachments are there, then we can just do Send Link on them if (!AllowActionForLargeAttachments(m_profileLocation) && eventArgs is DoWorkEventArgs) { ((DoWorkEventArgs)eventArgs).Cancel = true; return; } // copy over large attachments, if any CopyLargeAttachments(); if (m_processResult == ProcessResult.EXCEPTION && eventArgs is DoWorkEventArgs) { ((DoWorkEventArgs)eventArgs).Cancel = true; return; } // Make sure that progress output is directed to the Protect Simple dialog, otherwise, if the advanced progress dialog // has been used, the user will see that pop up instead of showing progress within the Simple dialog itself. m_policyClientProgressDialog = psd; m_policyClientProgressDialog.SetDescription(Resources.INITIALISEPROTECTENGINE); m_policyClientProgressDialog.SetSubDescription(""); // Ok the Policy Protect Process Dialog has a start and end method on it so lets dynamically get // it as we can't get a direct reference to it. MethodInfo startMethod = m_policyClientProgressDialog.GetType().GetMethod("Start"); if (startMethod != null) { startMethod.Invoke(m_policyClientProgressDialog, null); } PrepareProtectSimpleResponse(profileLocation); MethodInfo stopMethod = m_policyClientProgressDialog.GetType().GetMethod("Stop"); if (stopMethod != null) { stopMethod.Invoke(m_policyClientProgressDialog, null); } if (m_uiResponse.BlockingActions.Count > 0) { m_processResult = ClientManager.ProcessResult.BLOCKED_BY_POLICY; m_bUpdateProcessResult = false; return; } if (!(m_processResult == ProcessResult.NO_ACTIONS || m_processResult == ProcessResult.NO_VIOLATIONS || m_processResult == ClientManager.ProcessResult.ERRORS)) { ProcessProtectSimpleResponse(m_policyClientProgressDialog); UserEventAnalyser.SendEvent(UserEventAnalyser.EventName.SimpleSend, new Dictionary<string, object>() { {"Profile Type", m_uiResponse.Request.PolicyType}, {"Profile Name", psd.SelectedProfileName} }); return; } // We can't update processResult as there is no processing to be done after this. // We need to retain this processResult so that OutlookHookWorker doesn't try to play with attachments m_bUpdateProcessResult = false; }