예제 #1
0
        /// <summary>
        /// Invoked when our application is activated in the background (most likely due to the application service).
        /// </summary>
        protected override void OnBackgroundActivated(BackgroundActivatedEventArgs args)
        {
            base.OnBackgroundActivated(args);

            // Make sure we've been invoked by the app service.
            if (!(args.TaskInstance.TriggerDetails is AppServiceTriggerDetails triggerDetails))
            {
                return;
            }

            // This line of code looks like it doesn't do anything, however it's critical. The call to GetDeferral() does
            // more than just return a deferral. It informs the system that the background task might continue to perform
            // after it returns. Without this call, the full-trust DesktopServicesApp.exe will be terminated early.
            BackgroundTaskDeferral deferral = args.TaskInstance.GetDeferral();

            BridgeClientService = new CommandBridgeClientService(triggerDetails.AppServiceConnection);

            RegistryReadService  = new RegistryReadService(BridgeClientService);
            RegistryWriteService = new RegistryWriteService(BridgeClientService);
        }
예제 #2
0
        //// ===========================================================================================================
        //// Constructors
        //// ===========================================================================================================

        public RegistryWriteService(ICommandBridgeClientService commandBridge)
        {
            _commandBridge = Param.VerifyNotNull(commandBridge, nameof(commandBridge));
        }