Esempio n. 1
0
        /// <summary>
        /// Constructor method.
        /// </summary>
        public ProcessesInteropAgent(IAppState appState = null)
        {
            _appState = appState ?? Locator.CurrentMutable.GetService <IAppState>();

            _winEventDelegate  = new WinEventDelegate(WinEventsHandler);
            _eventHookHandlers = Win32Api.AddEventsHook(_winEvents, _winEventDelegate);
            _shellViewHandle   = _appState.GetShellViewHandle();

            _integratedInstances = _appState.GetProcessInstances().CreateDerivedCollection(
                filter: instance => !instance.IsElevated,
                selector: instance => instance
                );

            _integratedInstances.ItemsAdded.Subscribe(instance =>
            {
                Integrate(instance);
            });
        }