Mono.UIAutomation.UiaDbusSource.UiaDbusAutomationSource.BindApplicationEventHandlers C# (CSharp) Method

BindApplicationEventHandlers() private method

private BindApplicationEventHandlers ( string busName ) : void
busName string
return void
		private void BindApplicationEventHandlers (string busName)
		{
			DCI.IApplication app = Bus.Session.GetObject<DCI.IApplication> (busName,
				new ObjectPath (DC.Constants.ApplicationPath));
			app.RootElementsChanged += OnRootElementsChanged;

			if (listenFocusChangeStarted)
				app.FocusChanged += delegate (string providerPath) {
					if (!string.IsNullOrEmpty (providerPath)) {
						lock (focusChangedHandlers) {
							foreach (var handler in focusChangedHandlers)
								handler (GetOrCreateElement (busName, providerPath), -1, -1);
						}
					}
				};

			var automationEventRequests = RootElementEventsManager.ActiveAutomationEventRequests;
			if (automationEventRequests.Length > 0) {
				foreach (var req in automationEventRequests)
					app.AddRootElementAutomationEventHandler (req.EventId, req.Scope, req.HandlerId);
				EnsureAutomationEventsSetUp (app, busName);
			}
			var propertyEventRequests = RootElementEventsManager.ActivePropertyEventRequests;
			if (propertyEventRequests.Length > 0) {
				foreach (var req in propertyEventRequests)
					app.AddRootElementAutomationPropertyChangedEventHandler (
						req.Scope, req.HandlerId, req.PropertyIds);
				EnsurePropertyEventsSetUp (app, busName);
			}
			var structureEventRequests = RootElementEventsManager.ActiveStructureEventRequests;
			if (structureEventRequests.Length > 0) {
				foreach (var req in structureEventRequests)
					app.AddRootElementStructureChangedEventHandler (
						req.Scope, req.HandlerId);
				EnsureStructureEventsSetUp (app, busName);
			}
		}