Example #1
0
        public Task RunToolInContext(string packageFamilyName, string appId, string toolPath, string arguments = null, CancellationToken cancellationToken = default, IProgress <ProgressData> progress = default)
        {
            var proxyObject = new RunToolInContextDto
            {
                PackageFamilyName = packageFamilyName,
                AppId             = appId,
                Arguments         = arguments,
                ToolPath          = toolPath
            };

            return(this.client.Invoke(proxyObject, cancellationToken, progress));
        }
Example #2
0
        public async Task RunToolInContext(InstalledPackage package, string toolPath, string arguments = null, CancellationToken cancellationToken = default, IProgress <ProgressData> progress = default)
        {
            using IAppxFileReader reader = new FileInfoFileReaderAdapter(package.ManifestLocation);

            var maniReader = new AppxManifestReader();
            var manifest   = await maniReader.Read(reader, cancellationToken).ConfigureAwait(false);

            if (!manifest.Applications.Any())
            {
                throw new InvalidOperationException("Cannot start tool on a package without applications.");
            }

            var proxyObject = new RunToolInContextDto
            {
                PackageFamilyName = package.PackageFamilyName,
                AppId             = manifest.Applications[0].Id,
                Arguments         = arguments,
                ToolPath          = toolPath
            };

            await this.client.Invoke(proxyObject, cancellationToken, progress).ConfigureAwait(false);
        }