public virtual IPolicyClientDialog2 CreatePolicyClientDialog2() 
        {
            switch (m_caller)
            {
                case CallerEnum.Email:
                    m_policyClientDialog2 = new ProtectEmailDialog();
                    m_policyActionProgressDialog = m_policyClientDialog2.PolicyActionProgressDialog;
                    break;
                case CallerEnum.FileSystem:
                    m_policyClientDialog2 = new ProtectRemovableMediaDialog();
                    m_policyActionProgressDialog = m_policyClientDialog2.PolicyActionProgressDialog;
                    break;
                case CallerEnum.DeviceRemoved:
                    m_policyClientDialog2 = new ProtectRemovableMediaDialog();
                    m_policyActionProgressDialog = m_policyClientDialog2.PolicyActionProgressDialog;
                    break;

            }
            return m_policyClientDialog2;
        }
Exemplo n.º 2
0
		private DialogResult LoadDynamicDiscoveryDialog(bool processAsync)
		{
            
			m_policyClientDialog = m_uiManager.CreatePolicyClientDialog2();
			m_policyClientDialog.SetScanningProgress(Resources.PROGRESS_STATE_INITIALIZING);
			if (!processAsync)// Async processing will be carried out in another thread, so don't give the dialog a callback
			{
				m_policyClientDialog.ProcessResponseActions += responseDialog_ProcessResponseActions;
			}
			m_policyClientDialog.PreviewResponseAction += policyClientDialog_PreviewResponseAction;
			m_policyClientDialog.ProcessPrematureResponse += new ProcessPrematureResponseDelegate(policyClientDialog_OnProcessPrematureResponse);

			m_policyClientDialog.SetContentItems(GetContentItemInformation());

			// The worker thread will send the response to the dialog when it's ready
			StartScanningThread();

			PerformanceCounters.Instance.StopTimer(PerformanceCounters.CounterType.SendToDialogShow, 0);

		    m_policyClientDialog.HideWhenProcessingActions = false;
			IntPtr parentHwnd = m_uiManager.ParentHwnd;

            ResponseAnalyser.CollectAndStoreDefaultsEvents(m_response, ResponseAnalyser.EventType.Action);            

			DialogResult dialogResult = m_policyClientDialog.ShowDialog(new ParentWindow(parentHwnd));
			if (dialogResult == DialogResult.Cancel || dialogResult == DialogResult.Ignore)
			{
				m_engineThread.Abort(); // Engine thread will always complete execution otherwise.
			}
			else
			{
				// We only want to do this if the thread completed its execution as is done in case
				// of (enableDynamicDiscovery == false)
				if (m_processResult != ProcessResult.UNDEFINED)
				{
					return DialogResult.None;
				}
			}

			m_isInitialised = true;// Engine thread has done its stuff, so no need for us to call it again later(when async processing)
			return dialogResult;
		}
Exemplo n.º 3
0
		private DialogResult LoadStaticDiscoveryDialog(ref bool progressCreatedLocally, bool processAsync)
		{
			if (m_policyClientProgressDialog == null)
			{
				if (ShowProgress)
				{
					m_policyClientProgressDialog = m_uiManager.CreatePolicyClientProgressDialog();
					m_policyClientProgressDialog.SetDescription(Resources.PROGRESS_DESC_PROCESSING);
					progressCreatedLocally = true;
				}
			}

			// The progress dialog gets updated all over the place so rather than
			// trying to trap all of those events (and skip them if showprogress == false)
			// just set a local 'showprogress' within the dialog itself and let that code handle it.
			if (ShowProgress)
			{
				m_policyClientProgressDialog.ShouldShowProgress = ShowProgress;
				m_policyClientProgressDialog.SetSteps(6);
				UpdatePolicyClientProgress(Resources.PROGRESS_STATE_INITIALIZING);
			}

			StartScanningThread();
			// Stuff is happening here on the EngineWorker - thread
			while (!m_engineThread.Join(5))
			{
				// TODO: How long should we wait?  Maybe we need to have a timeout.
				Application.DoEvents();
			}

			if (m_processResult != ProcessResult.UNDEFINED)
			{
				if (ShowProgress)
				{
					m_policyClientProgressDialog.Complete();
					m_policyClientProgressDialog.Refresh();
					m_policyClientProgressDialog.Hide();
				}
				return DialogResult.None;
			}

            m_policyClientDialog = m_uiManager.CreatePolicyClientDialog2();

            if (!processAsync)// Async processing will be carried out in another thread, so don't give the dialog a callback
            {
                m_policyClientDialog.ProcessResponseActions += responseDialog_ProcessResponseActions;
            }
            m_policyClientDialog.PreviewResponseAction += policyClientDialog_PreviewResponseAction;

            m_policyClientDialog.SetResponse(m_uiResponse);
            if (ShowProgress)
            {
                m_policyClientProgressDialog.Complete();
                m_policyClientProgressDialog.Refresh();
            }

            if (m_policyClientProgressDialog != null && m_policyClientProgressDialog.Visible)
            {
                m_policyClientProgressDialog.Hide();
            }

            PerformanceCounters.Instance.StopTimer(PerformanceCounters.CounterType.SendToDialogShow, 0);

            m_isInitialised = true;// Engine thread has done its stuff, so no need for us to call it again later(when async processing)

		    m_policyClientDialog.HideWhenProcessingActions = false;

            IntPtr parentHwnd = m_uiManager.ParentHwnd;

            ResponseAnalyser.CollectAndStoreDefaultsEvents(m_response, ResponseAnalyser.EventType.Action);

            return m_policyClientDialog.ShowDialog(new ParentWindow(parentHwnd));		    
		}