Ejemplo n.º 1
0
 public AppLifecycleManager(string metadataDir)
 {
     _nativeAppLauncherClient = new NativeAppLauncherClient(metadataDir, _jsonSerializer);
     _appsDto = AppsDto.Load(Path.Combine(metadataDir, "apps.json"));
     _client  = ClientFactory.Instance.Create(
         new ClientOptionsBuilder()
         .WithDefaultConfiguration(Directory.GetCurrentDirectory())
         .WithApplicationId("interop.AppLifecycleManager")
         .WithProvidedService("interop.AppLifecycleService",
                              s => s.WithUnaryMethod <ActivateAppRequest, ActivateAppResponse>("ActivateApp", ActivateAppAsync))
         .Build());
     OnStop(_nativeAppLauncherClient.Stop);
     OnStop(_client.Disconnect);
 }
Ejemplo n.º 2
0
        protected override async Task <Task> StartProcessAsync(CancellationToken stopCancellationToken)
        {
            stopCancellationToken.ThrowIfCancellationRequested();
            _appsDto = AppsDto.Load(Path.Combine(_metadataDir, "apps.json"));
            _client  = ClientFactory.Instance.Create(
                new ClientOptionsBuilder()
                .WithDefaultConfiguration(_brokerWorkingDir)
                .WithApplicationId("interop.AppLifecycleManager")
                .Build());
            var startNativeAppLauncherTask = _startNativeAppLauncherTask.Value;
            await Task.WhenAll(_client.ConnectAsync(), startNativeAppLauncherTask).ConfigureAwait(false);

            var nativeAppLauncher = startNativeAppLauncherTask.GetResult();

            return(Task.WhenAll(_client.Completion, nativeAppLauncher.Completion));
        }