예제 #1
0
		public ProcessResult ProcessRequestForProtectSimple(bool displayProgress, bool isCorporateAccount)
		{
			try
			{
				ShowProgress = displayProgress;
				m_bUpdateProcessResult = true;
				m_encryptionUi = m_uiManager.CreateContentEncryptionUi();

                m_bUseServerProfiles = isCorporateAccount && !OptionApi.GetBool("UseClientProfiles");

				var psd = new NewProtectSimpleDialog(m_bUseServerProfiles)
				{
				    MRUProfile = GetClientProfileMru(),
				    ShowInTaskbar = false
				};
			    m_policyClientProgressDialog = psd;
				m_policyClientProgressDialog.ShouldShowProgress = displayProgress;

				psd.ProtectSimpleProfiles = this.ProtectSimpleProfiles;

				if (psd.ShouldShowTheDialog)
				{
					psd.OnProcessProfile += OnProtectSimpleProcessProfile;

					if (IsSendForReview && IsLotusNotesMailClient)
					{
						Logger.LogInfo("Detected Lotus Notes - Showing window as Always on Top");
						psd.Topmost = true;
					}
					else
					{
						new System.Windows.Interop.WindowInteropHelper(psd).Owner = m_uiManager.ParentHwnd;
					}
		
					bool? dr = psd.ShowDialog();

					if (m_bUpdateProcessResult)
					{
						m_processResult = ProcessRequestErrors(dr, psd.DialogResultEx);
						if (m_processResult == ClientManager.ProcessResult.PROCESSED)
						{
							UpdateClientProfileMru(psd.MRUProfile);
						}
					}
				}
				else
				{
					m_processResult = ProcessResult.NO_ACTIONS;
				}
			}
			catch (Exception ex)
			{
				if (m_policyClientProgressDialog != null)
				{
					// m_policyClientProgressDialog in this case is pointing to Protect Simple Dialog, psd assigned above.
					// If an exception is thrown while the dialog is still on the screen, sometimes the dialog does not get
					// dismissed properly. Thats why we need to call close here.
					m_policyClientProgressDialog.Close();
				}

				Logger.LogError(ex);

				StringBuilder sb = new StringBuilder(Resources.CRITICAL_EXCEPTION);
				sb.Append(' ');
				sb.Append(Resources.CONTACT_SYSTEM_ADMIN);

				m_errors.Add(sb.ToString());
				m_exceptions.Add(ex);

				m_processResult = ProcessResult.EXCEPTION;
			}
			finally
			{
				StartOfficeApplicationTimeout();

				if (m_uiManager != null)
				{
					m_processResult = m_uiManager.HandleInvalidProcessResult(m_processResult, Errors, Exceptions);
				}

				ResetPolicyCache();

				if (m_encryptionUi != null)
				{
					m_encryptionUi.OnShowDialog -= new ShowDialogEvent(m_encryptionUi_OnShowDialog);
				}
			}

			return m_processResult;
		}
예제 #2
0
        // This is an attempt to reduce the time it takes to
        // display the Protect Simple dialog after the user clicks Send.
        internal void LoadDependenciesAndIntialiseProtectSimpleDialog()
        {
            Logger.LogDebug("Pre cache load and show of Protec Simple dialog: Start");
            try
            {
                Assembly currentAssembly = System.Reflection.Assembly.GetExecutingAssembly();
                AssemblyName[] refAssemblies = currentAssembly.GetReferencedAssemblies();

                foreach (var assemblyName in refAssemblies)
                {
                    Assembly.Load(assemblyName);
                }

                NewProtectSimpleDialog simpleDlg = new NewProtectSimpleDialog();
                simpleDlg.WindowState = System.Windows.WindowState.Minimized;
                simpleDlg.ShowInTaskbar = false;
                simpleDlg.Show();
                simpleDlg.Hide();
                simpleDlg.Close();                                    
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
            Logger.LogDebug("Pre cache load and show of Protec Simple dialog: End");
        }