Use ms-rd protocol to auto launch remote desktop if needed for container Tasks (#114)

This commit is contained in:
Jake Friedman 2021-04-02 15:34:49 -07:00 коммит произвёл GitHub
Родитель b0d026ddd9
Коммит 4d19138fcc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
46 изменённых файлов: 1369 добавлений и 575 удалений

Просмотреть файл

@ -0,0 +1,10 @@
#### [Microsoft.FactoryOrchestrator.Client](./Microsoft-FactoryOrchestrator-Client.md 'Microsoft.FactoryOrchestrator.Client')
### [Microsoft.FactoryOrchestrator.Client](./Microsoft-FactoryOrchestrator-Client.md 'Microsoft.FactoryOrchestrator.Client').[FactoryOrchestratorClient](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient.md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient')
## FactoryOrchestratorClient.GetInstalledAppsDetailed() Method
Asynchronously Gets all installed apps on the OS. Requires Windows Device Portal.
```csharp
public System.Threading.Tasks.Task<System.Collections.Generic.List<Microsoft.FactoryOrchestrator.Core.PackageInfo>> GetInstalledAppsDetailed();
```
#### Returns
[System.Threading.Tasks.Task&lt;](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task-1 'System.Threading.Tasks.Task')[System.Collections.Generic.List&lt;](https://docs.microsoft.com/en-us/dotnet/api/System.Collections.Generic.List-1 'System.Collections.Generic.List')[Microsoft.FactoryOrchestrator.Core.PackageInfo](./../../CoreLibrary/Microsoft-FactoryOrchestrator-Core-PackageInfo 'Microsoft.FactoryOrchestrator.Core.PackageInfo')[&gt;](https://docs.microsoft.com/en-us/dotnet/api/System.Collections.Generic.List-1 'System.Collections.Generic.List')[&gt;](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task-1 'System.Threading.Tasks.Task')
The list of apps and their information, in PackageInfo objects.

Просмотреть файл

@ -0,0 +1,19 @@
#### [Microsoft.FactoryOrchestrator.Client](./Microsoft-FactoryOrchestrator-Client.md 'Microsoft.FactoryOrchestrator.Client')
### [Microsoft.FactoryOrchestrator.Client](./Microsoft-FactoryOrchestrator-Client.md 'Microsoft.FactoryOrchestrator.Client').[FactoryOrchestratorClient](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient.md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient')
## FactoryOrchestratorClient.RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase, System.Guid) Method
Asynchronously Runs a Task outside of a TaskList.
```csharp
public System.Threading.Tasks.Task<Microsoft.FactoryOrchestrator.Core.TaskRun> RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase task, System.Guid desiredTaskRunGuid);
```
#### Parameters
<a name='Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-RunTask(Microsoft-FactoryOrchestrator-Core-TaskBase_System-Guid)-task'></a>
`task` [Microsoft.FactoryOrchestrator.Core.TaskBase](./../../CoreLibrary/Microsoft-FactoryOrchestrator-Core-TaskBase 'Microsoft.FactoryOrchestrator.Core.TaskBase')
The Task to run.
<a name='Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-RunTask(Microsoft-FactoryOrchestrator-Core-TaskBase_System-Guid)-desiredTaskRunGuid'></a>
`desiredTaskRunGuid` [System.Guid](https://docs.microsoft.com/en-us/dotnet/api/System.Guid 'System.Guid')
The desired GUID for the returned TaskRun. It is not used if a TaskRun already exists with the same GUID.
#### Returns
[System.Threading.Tasks.Task&lt;](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task-1 'System.Threading.Tasks.Task')[Microsoft.FactoryOrchestrator.Core.TaskRun](./../../CoreLibrary/Microsoft-FactoryOrchestrator-Core-TaskRun 'Microsoft.FactoryOrchestrator.Core.TaskRun')[&gt;](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task-1 'System.Threading.Tasks.Task')
The TaskRun associated with the run.

Просмотреть файл

@ -0,0 +1,19 @@
#### [Microsoft.FactoryOrchestrator.Client](./Microsoft-FactoryOrchestrator-Client.md 'Microsoft.FactoryOrchestrator.Client')
### [Microsoft.FactoryOrchestrator.Client](./Microsoft-FactoryOrchestrator-Client.md 'Microsoft.FactoryOrchestrator.Client').[FactoryOrchestratorClient](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient.md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient')
## FactoryOrchestratorClient.RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase, System.Nullable&lt;System.Guid&gt;) Method
Asynchronously Runs a Task outside of a TaskList.
```csharp
public System.Threading.Tasks.Task<Microsoft.FactoryOrchestrator.Core.TaskRun> RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase task, System.Nullable<System.Guid> desiredTaskRunGuid=null);
```
#### Parameters
<a name='Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-RunTask(Microsoft-FactoryOrchestrator-Core-TaskBase_System-Nullable-System-Guid-)-task'></a>
`task` [Microsoft.FactoryOrchestrator.Core.TaskBase](./../../CoreLibrary/Microsoft-FactoryOrchestrator-Core-TaskBase 'Microsoft.FactoryOrchestrator.Core.TaskBase')
The Task to run.
<a name='Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-RunTask(Microsoft-FactoryOrchestrator-Core-TaskBase_System-Nullable-System-Guid-)-desiredTaskRunGuid'></a>
`desiredTaskRunGuid` [System.Nullable&lt;](https://docs.microsoft.com/en-us/dotnet/api/System.Nullable-1 'System.Nullable')[System.Guid](https://docs.microsoft.com/en-us/dotnet/api/System.Guid 'System.Guid')[&gt;](https://docs.microsoft.com/en-us/dotnet/api/System.Nullable-1 'System.Nullable')
The desired GUID for the returned TaskRun. It is not used if a TaskRun already exists with the same GUID.
#### Returns
[System.Threading.Tasks.Task&lt;](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task-1 'System.Threading.Tasks.Task')[Microsoft.FactoryOrchestrator.Core.TaskRun](./../../CoreLibrary/Microsoft-FactoryOrchestrator-Core-TaskRun 'Microsoft.FactoryOrchestrator.Core.TaskRun')[&gt;](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task-1 'System.Threading.Tasks.Task')
The TaskRun associated with the run.

Просмотреть файл

@ -0,0 +1,15 @@
#### [Microsoft.FactoryOrchestrator.Client](./Microsoft-FactoryOrchestrator-Client.md 'Microsoft.FactoryOrchestrator.Client')
### [Microsoft.FactoryOrchestrator.Client](./Microsoft-FactoryOrchestrator-Client.md 'Microsoft.FactoryOrchestrator.Client').[FactoryOrchestratorClient](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient.md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient')
## FactoryOrchestratorClient.TerminateApp(string) Method
Asynchronously Exits a UWP app. Requires Windows Device Portal.
```csharp
public System.Threading.Tasks.Task TerminateApp(string aumid);
```
#### Parameters
<a name='Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-TerminateApp(string)-aumid'></a>
`aumid` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')
The Application User Model ID (AUMID) of the app to exit.
#### Returns
[System.Threading.Tasks.Task](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task 'System.Threading.Tasks.Task')

Просмотреть файл

@ -49,6 +49,7 @@ Inheritance [System.Object](https://docs.microsoft.com/en-us/dotnet/api/System.O
- [GetFile(string, long, int, bool)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-GetFile(string_long_int_bool).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.GetFile(string, long, int, bool)')
- [GetFileFromDevice(string, string, bool)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-GetFileFromDevice(string_string_bool).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.GetFileFromDevice(string, string, bool)')
- [GetInstalledApps()](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-GetInstalledApps().md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.GetInstalledApps()')
- [GetInstalledAppsDetailed()](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-GetInstalledAppsDetailed().md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.GetInstalledAppsDetailed()')
- [GetIpAddressesAndNicNames()](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-GetIpAddressesAndNicNames().md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.GetIpAddressesAndNicNames()')
- [GetLastServiceError()](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-GetLastServiceError().md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.GetLastServiceError()')
- [GetLogFolder()](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-GetLogFolder().md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.GetLogFolder()')
@ -76,7 +77,7 @@ Inheritance [System.Object](https://docs.microsoft.com/en-us/dotnet/api/System.O
- [RunAllTaskLists()](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-RunAllTaskLists().md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.RunAllTaskLists()')
- [RunApp(string)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-RunApp(string).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.RunApp(string)')
- [RunExecutable(string, string, string, bool)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-RunExecutable(string_string_string_bool).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.RunExecutable(string, string, string, bool)')
- [RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-RunTask(Microsoft-FactoryOrchestrator-Core-TaskBase).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase)')
- [RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase, System.Nullable&lt;System.Guid&gt;)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-RunTask(Microsoft-FactoryOrchestrator-Core-TaskBase_System-Nullable-System-Guid-).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase, System.Nullable&lt;System.Guid&gt;)')
- [RunTask(System.Guid)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-RunTask(System-Guid).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.RunTask(System.Guid)')
- [RunTaskList(System.Guid, int)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-RunTaskList(System-Guid_int).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.RunTaskList(System.Guid, int)')
- [SaveAllTaskListsToXmlFile(string)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-SaveAllTaskListsToXmlFile(string).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.SaveAllTaskListsToXmlFile(string)')
@ -88,6 +89,7 @@ Inheritance [System.Object](https://docs.microsoft.com/en-us/dotnet/api/System.O
- [SetLogFolder(string, bool)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-SetLogFolder(string_bool).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.SetLogFolder(string, bool)')
- [SetTeExePath(string)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-SetTeExePath(string).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.SetTeExePath(string)')
- [ShutdownDevice(uint)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-ShutdownDevice(uint).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.ShutdownDevice(uint)')
- [TerminateApp(string)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-TerminateApp(string).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.TerminateApp(string)')
- [TryConnect(bool)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-TryConnect(bool).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.TryConnect(bool)')
- [TryDeleteLocalFile(string)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-TryDeleteLocalFile(string).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.TryDeleteLocalFile(string)')
- [UpdateTaskList(Microsoft.FactoryOrchestrator.Core.TaskList)](./Microsoft-FactoryOrchestrator-Client-FactoryOrchestratorClient-UpdateTaskList(Microsoft-FactoryOrchestrator-Core-TaskList).md 'Microsoft.FactoryOrchestrator.Client.FactoryOrchestratorClient.UpdateTaskList(Microsoft.FactoryOrchestrator.Core.TaskList)')

Просмотреть файл

@ -0,0 +1,9 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[AppPackages](./Microsoft-FactoryOrchestrator-Core-AppPackages.md 'Microsoft.FactoryOrchestrator.Core.AppPackages')
## AppPackages.Packages Property
Gets a list of the packages
```csharp
public System.Collections.Generic.List<Microsoft.FactoryOrchestrator.Core.PackageInfo> Packages { get; set; }
```
#### Property Value
[System.Collections.Generic.List&lt;](https://docs.microsoft.com/en-us/dotnet/api/System.Collections.Generic.List-1 'System.Collections.Generic.List')[PackageInfo](./Microsoft-FactoryOrchestrator-Core-PackageInfo.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo')[&gt;](https://docs.microsoft.com/en-us/dotnet/api/System.Collections.Generic.List-1 'System.Collections.Generic.List')

Просмотреть файл

@ -0,0 +1,10 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[AppPackages](./Microsoft-FactoryOrchestrator-Core-AppPackages.md 'Microsoft.FactoryOrchestrator.Core.AppPackages')
## AppPackages.ToString() Method
Presents a user readable representation of a list of AppPackages
```csharp
public override string ToString();
```
#### Returns
[System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')
User readable list of AppPackages.

Просмотреть файл

@ -0,0 +1,12 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
## AppPackages Class
Object representing a list of Application Packages
```csharp
public class AppPackages
```
Inheritance [System.Object](https://docs.microsoft.com/en-us/dotnet/api/System.Object 'System.Object') &#129106; AppPackages
### Properties
- [Packages](./Microsoft-FactoryOrchestrator-Core-AppPackages-Packages.md 'Microsoft.FactoryOrchestrator.Core.AppPackages.Packages')
### Methods
- [ToString()](./Microsoft-FactoryOrchestrator-Core-AppPackages-ToString().md 'Microsoft.FactoryOrchestrator.Core.AppPackages.ToString()')

Просмотреть файл

@ -0,0 +1,10 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[IFactoryOrchestratorService](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService.md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService')
## IFactoryOrchestratorService.GetInstalledAppsDetailed() Method
Gets all installed apps on the OS. Requires Windows Device Portal.
```csharp
System.Collections.Generic.List<Microsoft.FactoryOrchestrator.Core.PackageInfo> GetInstalledAppsDetailed();
```
#### Returns
[System.Collections.Generic.List&lt;](https://docs.microsoft.com/en-us/dotnet/api/System.Collections.Generic.List-1 'System.Collections.Generic.List')[PackageInfo](./Microsoft-FactoryOrchestrator-Core-PackageInfo.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo')[&gt;](https://docs.microsoft.com/en-us/dotnet/api/System.Collections.Generic.List-1 'System.Collections.Generic.List')
The list of apps and their information, in PackageInfo objects.

Просмотреть файл

@ -0,0 +1,19 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[IFactoryOrchestratorService](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService.md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService')
## IFactoryOrchestratorService.RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase, System.Guid) Method
Runs a Task outside of a TaskList.
```csharp
Microsoft.FactoryOrchestrator.Core.TaskRun RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase task, System.Guid desiredTaskRunGuid);
```
#### Parameters
<a name='Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-RunTask(Microsoft-FactoryOrchestrator-Core-TaskBase_System-Guid)-task'></a>
`task` [TaskBase](./Microsoft-FactoryOrchestrator-Core-TaskBase.md 'Microsoft.FactoryOrchestrator.Core.TaskBase')
The Task to run.
<a name='Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-RunTask(Microsoft-FactoryOrchestrator-Core-TaskBase_System-Guid)-desiredTaskRunGuid'></a>
`desiredTaskRunGuid` [System.Guid](https://docs.microsoft.com/en-us/dotnet/api/System.Guid 'System.Guid')
The desired GUID for the returned TaskRun. It is not used if a TaskRun already exists with the same GUID.
#### Returns
[TaskRun](./Microsoft-FactoryOrchestrator-Core-TaskRun.md 'Microsoft.FactoryOrchestrator.Core.TaskRun')
The TaskRun associated with the run.

Просмотреть файл

@ -0,0 +1,19 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[IFactoryOrchestratorService](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService.md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService')
## IFactoryOrchestratorService.RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase, System.Nullable&lt;System.Guid&gt;) Method
Runs a Task outside of a TaskList.
```csharp
Microsoft.FactoryOrchestrator.Core.TaskRun RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase task, System.Nullable<System.Guid> desiredTaskRunGuid=null);
```
#### Parameters
<a name='Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-RunTask(Microsoft-FactoryOrchestrator-Core-TaskBase_System-Nullable-System-Guid-)-task'></a>
`task` [TaskBase](./Microsoft-FactoryOrchestrator-Core-TaskBase.md 'Microsoft.FactoryOrchestrator.Core.TaskBase')
The Task to run.
<a name='Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-RunTask(Microsoft-FactoryOrchestrator-Core-TaskBase_System-Nullable-System-Guid-)-desiredTaskRunGuid'></a>
`desiredTaskRunGuid` [System.Nullable&lt;](https://docs.microsoft.com/en-us/dotnet/api/System.Nullable-1 'System.Nullable')[System.Guid](https://docs.microsoft.com/en-us/dotnet/api/System.Guid 'System.Guid')[&gt;](https://docs.microsoft.com/en-us/dotnet/api/System.Nullable-1 'System.Nullable')
The desired GUID for the returned TaskRun. It is not used if a TaskRun already exists with the same GUID.
#### Returns
[TaskRun](./Microsoft-FactoryOrchestrator-Core-TaskRun.md 'Microsoft.FactoryOrchestrator.Core.TaskRun')
The TaskRun associated with the run.

Просмотреть файл

@ -0,0 +1,12 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[IFactoryOrchestratorService](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService.md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService')
## IFactoryOrchestratorService.TerminateApp(string) Method
Exits a UWP app. Requires Windows Device Portal.
```csharp
void TerminateApp(string aumid);
```
#### Parameters
<a name='Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-TerminateApp(string)-aumid'></a>
`aumid` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')
The Application User Model ID (AUMID) of the app to exit.

Просмотреть файл

@ -22,6 +22,7 @@ public interface IFactoryOrchestratorService
- [GetDisabledPages()](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-GetDisabledPages().md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.GetDisabledPages()')
- [GetFile(string, long, int, bool)](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-GetFile(string_long_int_bool).md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.GetFile(string, long, int, bool)')
- [GetInstalledApps()](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-GetInstalledApps().md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.GetInstalledApps()')
- [GetInstalledAppsDetailed()](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-GetInstalledAppsDetailed().md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.GetInstalledAppsDetailed()')
- [GetIpAddressesAndNicNames()](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-GetIpAddressesAndNicNames().md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.GetIpAddressesAndNicNames()')
- [GetLastServiceError()](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-GetLastServiceError().md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.GetLastServiceError()')
- [GetLogFolder()](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-GetLogFolder().md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.GetLogFolder()')
@ -48,7 +49,7 @@ public interface IFactoryOrchestratorService
- [RunAllTaskLists()](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-RunAllTaskLists().md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.RunAllTaskLists()')
- [RunApp(string)](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-RunApp(string).md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.RunApp(string)')
- [RunExecutable(string, string, string, bool)](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-RunExecutable(string_string_string_bool).md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.RunExecutable(string, string, string, bool)')
- [RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase)](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-RunTask(Microsoft-FactoryOrchestrator-Core-TaskBase).md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase)')
- [RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase, System.Nullable&lt;System.Guid&gt;)](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-RunTask(Microsoft-FactoryOrchestrator-Core-TaskBase_System-Nullable-System-Guid-).md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.RunTask(Microsoft.FactoryOrchestrator.Core.TaskBase, System.Nullable&lt;System.Guid&gt;)')
- [RunTask(System.Guid)](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-RunTask(System-Guid).md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.RunTask(System.Guid)')
- [RunTaskList(System.Guid, int)](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-RunTaskList(System-Guid_int).md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.RunTaskList(System.Guid, int)')
- [SaveAllTaskListsToXmlFile(string)](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-SaveAllTaskListsToXmlFile(string).md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.SaveAllTaskListsToXmlFile(string)')
@ -56,5 +57,6 @@ public interface IFactoryOrchestratorService
- [SendFile(string, byte[], bool, bool)](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-SendFile(string_byte--_bool_bool).md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.SendFile(string, byte[], bool, bool)')
- [SetLogFolder(string, bool)](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-SetLogFolder(string_bool).md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.SetLogFolder(string, bool)')
- [SetTeExePath(string)](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-SetTeExePath(string).md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.SetTeExePath(string)')
- [TerminateApp(string)](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-TerminateApp(string).md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.TerminateApp(string)')
- [UpdateTaskList(Microsoft.FactoryOrchestrator.Core.TaskList)](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-UpdateTaskList(Microsoft-FactoryOrchestrator-Core-TaskList).md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.UpdateTaskList(Microsoft.FactoryOrchestrator.Core.TaskList)')
- [UpdateTaskRun(Microsoft.FactoryOrchestrator.Core.TaskRun)](./Microsoft-FactoryOrchestrator-Core-IFactoryOrchestratorService-UpdateTaskRun(Microsoft-FactoryOrchestrator-Core-TaskRun).md 'Microsoft.FactoryOrchestrator.Core.IFactoryOrchestratorService.UpdateTaskRun(Microsoft.FactoryOrchestrator.Core.TaskRun)')

Просмотреть файл

@ -0,0 +1,9 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageInfo](./Microsoft-FactoryOrchestrator-Core-PackageInfo.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo')
## PackageInfo.AppId Property
Gets package relative Id
```csharp
public string AppId { get; set; }
```
#### Property Value
[System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

Просмотреть файл

@ -0,0 +1,9 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageInfo](./Microsoft-FactoryOrchestrator-Core-PackageInfo.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo')
## PackageInfo.FamilyName Property
Gets package family name
```csharp
public string FamilyName { get; set; }
```
#### Property Value
[System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

Просмотреть файл

@ -0,0 +1,9 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageInfo](./Microsoft-FactoryOrchestrator-Core-PackageInfo.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo')
## PackageInfo.FullName Property
Gets package full name
```csharp
public string FullName { get; set; }
```
#### Property Value
[System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

Просмотреть файл

@ -0,0 +1,10 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageInfo](./Microsoft-FactoryOrchestrator-Core-PackageInfo.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo')
## PackageInfo.IsSideloaded() Method
Helper method to determine if the app was sideloaded and therefore can be used with e.g. GetFolderContentsAsync
```csharp
public bool IsSideloaded();
```
#### Returns
[System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')
True if the package is sideloaded.

Просмотреть файл

@ -0,0 +1,9 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageInfo](./Microsoft-FactoryOrchestrator-Core-PackageInfo.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo')
## PackageInfo.Name Property
Gets package name
```csharp
public string Name { get; set; }
```
#### Property Value
[System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

Просмотреть файл

@ -0,0 +1,16 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageInfo](./Microsoft-FactoryOrchestrator-Core-PackageInfo.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo')
## PackageInfo.PackageOrigin Property
Gets package origin, a measure of how the app was installed.
PackageOrigin_Unknown            = 0,
PackageOrigin_Unsigned           = 1,
PackageOrigin_Inbox              = 2,
PackageOrigin_Store              = 3,
PackageOrigin_DeveloperUnsigned  = 4,
PackageOrigin_DeveloperSigned    = 5,
PackageOrigin_LineOfBusiness     = 6
```csharp
public int PackageOrigin { get; set; }
```
#### Property Value
[System.Int32](https://docs.microsoft.com/en-us/dotnet/api/System.Int32 'System.Int32')

Просмотреть файл

@ -0,0 +1,9 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageInfo](./Microsoft-FactoryOrchestrator-Core-PackageInfo.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo')
## PackageInfo.Publisher Property
Gets package publisher
```csharp
public string Publisher { get; set; }
```
#### Property Value
[System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')

Просмотреть файл

@ -0,0 +1,10 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageInfo](./Microsoft-FactoryOrchestrator-Core-PackageInfo.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo')
## PackageInfo.ToString() Method
Get a string representation of the package
```csharp
public override string ToString();
```
#### Returns
[System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')
String representation

Просмотреть файл

@ -0,0 +1,9 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageInfo](./Microsoft-FactoryOrchestrator-Core-PackageInfo.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo')
## PackageInfo.Version Property
Gets package version
```csharp
public Microsoft.FactoryOrchestrator.Core.PackageVersion Version { get; set; }
```
#### Property Value
[PackageVersion](./Microsoft-FactoryOrchestrator-Core-PackageVersion.md 'Microsoft.FactoryOrchestrator.Core.PackageVersion')

Просмотреть файл

@ -0,0 +1,19 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
## PackageInfo Class
object representing the package information
```csharp
public class PackageInfo
```
Inheritance [System.Object](https://docs.microsoft.com/en-us/dotnet/api/System.Object 'System.Object') &#129106; PackageInfo
### Properties
- [AppId](./Microsoft-FactoryOrchestrator-Core-PackageInfo-AppId.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo.AppId')
- [FamilyName](./Microsoft-FactoryOrchestrator-Core-PackageInfo-FamilyName.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo.FamilyName')
- [FullName](./Microsoft-FactoryOrchestrator-Core-PackageInfo-FullName.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo.FullName')
- [Name](./Microsoft-FactoryOrchestrator-Core-PackageInfo-Name.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo.Name')
- [PackageOrigin](./Microsoft-FactoryOrchestrator-Core-PackageInfo-PackageOrigin.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo.PackageOrigin')
- [Publisher](./Microsoft-FactoryOrchestrator-Core-PackageInfo-Publisher.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo.Publisher')
- [Version](./Microsoft-FactoryOrchestrator-Core-PackageInfo-Version.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo.Version')
### Methods
- [IsSideloaded()](./Microsoft-FactoryOrchestrator-Core-PackageInfo-IsSideloaded().md 'Microsoft.FactoryOrchestrator.Core.PackageInfo.IsSideloaded()')
- [ToString()](./Microsoft-FactoryOrchestrator-Core-PackageInfo-ToString().md 'Microsoft.FactoryOrchestrator.Core.PackageInfo.ToString()')

Просмотреть файл

@ -0,0 +1,9 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageVersion](./Microsoft-FactoryOrchestrator-Core-PackageVersion.md 'Microsoft.FactoryOrchestrator.Core.PackageVersion')
## PackageVersion.Build Property
Gets version build
```csharp
public int Build { get; set; }
```
#### Property Value
[System.Int32](https://docs.microsoft.com/en-us/dotnet/api/System.Int32 'System.Int32')

Просмотреть файл

@ -0,0 +1,9 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageVersion](./Microsoft-FactoryOrchestrator-Core-PackageVersion.md 'Microsoft.FactoryOrchestrator.Core.PackageVersion')
## PackageVersion.Major Property
Gets package Major number
```csharp
public int Major { get; set; }
```
#### Property Value
[System.Int32](https://docs.microsoft.com/en-us/dotnet/api/System.Int32 'System.Int32')

Просмотреть файл

@ -0,0 +1,9 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageVersion](./Microsoft-FactoryOrchestrator-Core-PackageVersion.md 'Microsoft.FactoryOrchestrator.Core.PackageVersion')
## PackageVersion.Minor Property
Gets package minor number
```csharp
public int Minor { get; set; }
```
#### Property Value
[System.Int32](https://docs.microsoft.com/en-us/dotnet/api/System.Int32 'System.Int32')

Просмотреть файл

@ -0,0 +1,9 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageVersion](./Microsoft-FactoryOrchestrator-Core-PackageVersion.md 'Microsoft.FactoryOrchestrator.Core.PackageVersion')
## PackageVersion.Revision Property
Gets package revision
```csharp
public int Revision { get; set; }
```
#### Property Value
[System.Int32](https://docs.microsoft.com/en-us/dotnet/api/System.Int32 'System.Int32')

Просмотреть файл

@ -0,0 +1,10 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageVersion](./Microsoft-FactoryOrchestrator-Core-PackageVersion.md 'Microsoft.FactoryOrchestrator.Core.PackageVersion')
## PackageVersion.ToString() Method
Get a string representation of a version
```csharp
public override string ToString();
```
#### Returns
[System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')
String representation

Просмотреть файл

@ -0,0 +1,9 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[PackageVersion](./Microsoft-FactoryOrchestrator-Core-PackageVersion.md 'Microsoft.FactoryOrchestrator.Core.PackageVersion')
## PackageVersion.Version Property
Gets package version
```csharp
public System.Version Version { get; }
```
#### Property Value
[System.Version](https://docs.microsoft.com/en-us/dotnet/api/System.Version 'System.Version')

Просмотреть файл

@ -0,0 +1,16 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
## PackageVersion Class
Object representing a package version
```csharp
public class PackageVersion
```
Inheritance [System.Object](https://docs.microsoft.com/en-us/dotnet/api/System.Object 'System.Object') &#129106; PackageVersion
### Properties
- [Build](./Microsoft-FactoryOrchestrator-Core-PackageVersion-Build.md 'Microsoft.FactoryOrchestrator.Core.PackageVersion.Build')
- [Major](./Microsoft-FactoryOrchestrator-Core-PackageVersion-Major.md 'Microsoft.FactoryOrchestrator.Core.PackageVersion.Major')
- [Minor](./Microsoft-FactoryOrchestrator-Core-PackageVersion-Minor.md 'Microsoft.FactoryOrchestrator.Core.PackageVersion.Minor')
- [Revision](./Microsoft-FactoryOrchestrator-Core-PackageVersion-Revision.md 'Microsoft.FactoryOrchestrator.Core.PackageVersion.Revision')
- [Version](./Microsoft-FactoryOrchestrator-Core-PackageVersion-Version.md 'Microsoft.FactoryOrchestrator.Core.PackageVersion.Version')
### Methods
- [ToString()](./Microsoft-FactoryOrchestrator-Core-PackageVersion-ToString().md 'Microsoft.FactoryOrchestrator.Core.PackageVersion.ToString()')

Просмотреть файл

@ -46,6 +46,18 @@ The Factory Orchestrator Service container support is disabled by policy.
`NetworkAccessDisabled` 9
The Factory Orchestrator Service network access is disabled by policy.
<a name='Microsoft-FactoryOrchestrator-Core-ServiceEventType-TaskRunRedirectedToRunAsRDUser'></a>
`TaskRunRedirectedToRunAsRDUser` 10
The TaskRun has GUI and was redirected to RunAsRDUser.exe. It will not run until a remote user is logged in.
<a name='Microsoft-FactoryOrchestrator-Core-ServiceEventType-ContainerServiceError'></a>
`ContainerServiceError` 11
The Factory Orchestrator Service inside a connected container threw an exception.
<a name='Microsoft-FactoryOrchestrator-Core-ServiceEventType-ContainerTaskRunRedirectedToRunAsRDUser'></a>
`ContainerTaskRunRedirectedToRunAsRDUser` 12
The Factory Orchestrator Service inside a connected container has a TaskRun with GUI and it was redirected to RunAsRDUser.exe. It will not run until a remote user is logged in.
<a name='Microsoft-FactoryOrchestrator-Core-ServiceEventType-Unknown'></a>
`Unknown` 2147483647
An unknown Factory Orchestrator Service event occurred.

Просмотреть файл

@ -39,6 +39,6 @@ The Task is queued to run.
The Task is waiting for its result from a client.
<a name='Microsoft-FactoryOrchestrator-Core-TaskStatus-Unknown'></a>
`Unknown` 8
`Unknown` 2147483647
The Task state is unknown, likely due to a Service error.

Просмотреть файл

@ -0,0 +1,21 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[WDPHelpers](./Microsoft-FactoryOrchestrator-Core-WDPHelpers.md 'Microsoft.FactoryOrchestrator.Core.WDPHelpers')
## WDPHelpers.CloseAppWithWDP(string, string) Method
Closes a running app package application with Windows Device Portal.
```csharp
public static System.Threading.Tasks.Task CloseAppWithWDP(string app, string ipAddress="localhost");
```
#### Parameters
<a name='Microsoft-FactoryOrchestrator-Core-WDPHelpers-CloseAppWithWDP(string_string)-app'></a>
`app` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')
The app package to exit .
<a name='Microsoft-FactoryOrchestrator-Core-WDPHelpers-CloseAppWithWDP(string_string)-ipAddress'></a>
`ipAddress` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')
The ip address of the device to exit the app on.
#### Returns
[System.Threading.Tasks.Task](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task 'System.Threading.Tasks.Task')
#### Exceptions
[System.ArgumentException](https://docs.microsoft.com/en-us/dotnet/api/System.ArgumentException 'System.ArgumentException')

Просмотреть файл

@ -0,0 +1,10 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[WDPHelpers](./Microsoft-FactoryOrchestrator-Core-WDPHelpers.md 'Microsoft.FactoryOrchestrator.Core.WDPHelpers')
## WDPHelpers.GetInstalledAppPackagesAsync() Method
Gets the collection of applications installed on the device.
```csharp
public static System.Threading.Tasks.Task<Microsoft.FactoryOrchestrator.Core.AppPackages> GetInstalledAppPackagesAsync();
```
#### Returns
[System.Threading.Tasks.Task&lt;](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task-1 'System.Threading.Tasks.Task')[AppPackages](./Microsoft-FactoryOrchestrator-Core-AppPackages.md 'Microsoft.FactoryOrchestrator.Core.AppPackages')[&gt;](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task-1 'System.Threading.Tasks.Task')
AppPackages object containing the list of installed application packages.

Просмотреть файл

@ -0,0 +1,15 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core').[WDPHelpers](./Microsoft-FactoryOrchestrator-Core-WDPHelpers.md 'Microsoft.FactoryOrchestrator.Core.WDPHelpers')
## WDPHelpers.GetInstalledAppPackagesAsync(string) Method
Gets the collection of applications installed on the device.
```csharp
public static System.Threading.Tasks.Task<Microsoft.FactoryOrchestrator.Core.AppPackages> GetInstalledAppPackagesAsync(string ipAddress="localhost");
```
#### Parameters
<a name='Microsoft-FactoryOrchestrator-Core-WDPHelpers-GetInstalledAppPackagesAsync(string)-ipAddress'></a>
`ipAddress` [System.String](https://docs.microsoft.com/en-us/dotnet/api/System.String 'System.String')
The ip address of the device to query.
#### Returns
[System.Threading.Tasks.Task&lt;](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task-1 'System.Threading.Tasks.Task')[AppPackages](./Microsoft-FactoryOrchestrator-Core-AppPackages.md 'Microsoft.FactoryOrchestrator.Core.AppPackages')[&gt;](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task-1 'System.Threading.Tasks.Task')
AppPackages object containing the list of installed application packages.

Просмотреть файл

@ -1,6 +1,7 @@
#### [Microsoft.FactoryOrchestrator.Core](./Microsoft-FactoryOrchestrator-Core.md 'Microsoft.FactoryOrchestrator.Core')
## Microsoft.FactoryOrchestrator.Core Namespace
### Classes
- [AppPackages](./Microsoft-FactoryOrchestrator-Core-AppPackages.md 'Microsoft.FactoryOrchestrator.Core.AppPackages')
- [BatchFileTask](./Microsoft-FactoryOrchestrator-Core-BatchFileTask.md 'Microsoft.FactoryOrchestrator.Core.BatchFileTask')
- [CommandLineTask](./Microsoft-FactoryOrchestrator-Core-CommandLineTask.md 'Microsoft.FactoryOrchestrator.Core.CommandLineTask')
- [ExecutableTask](./Microsoft-FactoryOrchestrator-Core-ExecutableTask.md 'Microsoft.FactoryOrchestrator.Core.ExecutableTask')
@ -13,6 +14,8 @@
- [FactoryOrchestratorXML](./Microsoft-FactoryOrchestrator-Core-FactoryOrchestratorXML.md 'Microsoft.FactoryOrchestrator.Core.FactoryOrchestratorXML')
- [FactoryOrchestratorXmlException](./Microsoft-FactoryOrchestrator-Core-FactoryOrchestratorXmlException.md 'Microsoft.FactoryOrchestrator.Core.FactoryOrchestratorXmlException')
- [LockingList&lt;T&gt;](./Microsoft-FactoryOrchestrator-Core-LockingList-T-.md 'Microsoft.FactoryOrchestrator.Core.LockingList&lt;T&gt;')
- [PackageInfo](./Microsoft-FactoryOrchestrator-Core-PackageInfo.md 'Microsoft.FactoryOrchestrator.Core.PackageInfo')
- [PackageVersion](./Microsoft-FactoryOrchestrator-Core-PackageVersion.md 'Microsoft.FactoryOrchestrator.Core.PackageVersion')
- [PowerShellTask](./Microsoft-FactoryOrchestrator-Core-PowerShellTask.md 'Microsoft.FactoryOrchestrator.Core.PowerShellTask')
- [ServiceEvent](./Microsoft-FactoryOrchestrator-Core-ServiceEvent.md 'Microsoft.FactoryOrchestrator.Core.ServiceEvent')
- [TAEFTest](./Microsoft-FactoryOrchestrator-Core-TAEFTest.md 'Microsoft.FactoryOrchestrator.Core.TAEFTest')

Просмотреть файл

@ -1,77 +1,77 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
using Microsoft.FactoryOrchestrator.Client;
using Microsoft.FactoryOrchestrator.Core;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.Core;
using Windows.ApplicationModel.ExtendedExecution;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
using Microsoft.FactoryOrchestrator.Client;
using Microsoft.FactoryOrchestrator.Core;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.Core;
using Windows.ApplicationModel.ExtendedExecution;
using Windows.ApplicationModel.Resources;
using Windows.Foundation;
using Windows.Management.Deployment;
using Windows.UI.Core;
using Windows.UI.Core.Preview;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Navigation;
using TaskStatus = Microsoft.FactoryOrchestrator.Core.TaskStatus;
namespace Microsoft.FactoryOrchestrator.UWP
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application, IDisposable
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
this.UnhandledException += UnhandledExceptionHandler;
MainPageLastNavTag = null;
RunWaitingForResult = null;
Client = null;
connectionFailureSem = new SemaphoreSlim(1,1);
pollingFailureSem = new SemaphoreSlim(1,1);
IsServiceExecutingBootTasks = true;
IgnoreVersionMismatch = false;
OnConnectionPage = true;
}
private void UnhandledExceptionHandler(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
{
var exception = e.Exception;
if (exception.GetType() == typeof(FactoryOrchestratorConnectionException))
{
e.Handled = true;
OnConnectionFailure();
}
else if (exception.GetType() == typeof(FactoryOrchestratorVersionMismatchException))
{
e.Handled = true;
_ = OnVersionMismatchFailure((FactoryOrchestratorVersionMismatchException)exception);
}
else
{
e.Handled = false;
}
System.Diagnostics.Debug.WriteLine(exception);
}
using Windows.Foundation;
using Windows.Management.Deployment;
using Windows.UI.Core;
using Windows.UI.Core.Preview;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Navigation;
using TaskStatus = Microsoft.FactoryOrchestrator.Core.TaskStatus;
namespace Microsoft.FactoryOrchestrator.UWP
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application, IDisposable
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
this.UnhandledException += UnhandledExceptionHandler;
MainPageLastNavTag = null;
RunWaitingForResult = null;
Client = null;
connectionFailureSem = new SemaphoreSlim(1,1);
pollingFailureSem = new SemaphoreSlim(1,1);
IsServiceExecutingBootTasks = true;
IgnoreVersionMismatch = false;
OnConnectionPage = true;
}
private void UnhandledExceptionHandler(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
{
var exception = e.Exception;
if (exception.GetType() == typeof(FactoryOrchestratorConnectionException))
{
e.Handled = true;
OnConnectionFailure();
}
else if (exception.GetType() == typeof(FactoryOrchestratorVersionMismatchException))
{
e.Handled = true;
_ = OnVersionMismatchFailure((FactoryOrchestratorVersionMismatchException)exception);
}
else
{
e.Handled = false;
}
System.Diagnostics.Debug.WriteLine(exception);
}
private Frame PreLaunchSetUp()
{
var rootFrame = Window.Current.Content as Frame;
@ -94,8 +94,8 @@ namespace Microsoft.FactoryOrchestrator.UWP
rootFrame.CacheSize = 4;
return rootFrame;
}
}
protected override async void OnActivated(IActivatedEventArgs args)
{
#pragma warning disable CA1062 // Validate arguments of public methods
@ -133,19 +133,19 @@ namespace Microsoft.FactoryOrchestrator.UWP
}
}
}
}
internal async void OnServerPollerException(object source, ServerPollerExceptionHandlerEventArgs e)
{
var poller = source as ServerPoller;
if (e.Exception.GetType() == typeof(FactoryOrchestratorConnectionException))
{
OnConnectionFailure();
}
else if (poller.IsPolling)
}
internal async void OnServerPollerException(object source, ServerPollerExceptionHandlerEventArgs e)
{
var poller = source as ServerPoller;
if (e.Exception.GetType() == typeof(FactoryOrchestratorConnectionException))
{
pollingFailureSem.Wait();
OnConnectionFailure();
}
else if (poller.IsPolling)
{
pollingFailureSem.Wait();
try
{
if (e.Exception.GetType() == typeof(FactoryOrchestratorUnkownGuidException))
@ -197,19 +197,19 @@ namespace Microsoft.FactoryOrchestrator.UWP
// System.Exception is thrown if there is already a ContentDialog visible on the screen. Just ignore it
}
});
}
finally
}
finally
{
pollingFailureSem.Release();
}
}
}
System.Diagnostics.Debug.WriteLine(e.Exception);
}
public async void OnConnectionFailure()
System.Diagnostics.Debug.WriteLine(e.Exception);
}
public async void OnConnectionFailure()
{
connectionFailureSem.Wait();
connectionFailureSem.Wait();
try
{
if (!OnConnectionPage && !Client.IsConnected)
@ -279,12 +279,12 @@ namespace Microsoft.FactoryOrchestrator.UWP
}
resultTask.Cancel();
}
}
finally
}
}
finally
{
connectionFailureSem.Release();
}
}
}
/// <summary>
@ -293,7 +293,7 @@ namespace Microsoft.FactoryOrchestrator.UWP
/// <param name="e">The exception.</param>
/// <param name="navigateToConnectionPage">If set to <c>true</c> navigate to connection page if the user chooses to not exit.</param>
/// <returns></returns>
public async Task OnVersionMismatchFailure(FactoryOrchestratorVersionMismatchException e, bool navigateToConnectionPage = true)
public async Task OnVersionMismatchFailure(FactoryOrchestratorVersionMismatchException e, bool navigateToConnectionPage = true)
{
await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
{
@ -330,73 +330,73 @@ namespace Microsoft.FactoryOrchestrator.UWP
}
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override async void OnLaunched(LaunchActivatedEventArgs e)
{
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override async void OnLaunched(LaunchActivatedEventArgs e)
{
Frame rootFrame = PreLaunchSetUp();
#pragma warning disable CA1062 // Validate arguments of public methods
if (e.PrelaunchActivated == false)
#pragma warning restore CA1062 // Validate arguments of public methods
{
if (rootFrame.Content == null)
{
Client = new FactoryOrchestratorUWPClient(IPAddress.Loopback, 45684);
Client.OnConnected += OnIpcConnected;
if (await Client.TryConnect(IgnoreVersionMismatch))
{
OnConnectionPage = false;
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
else
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
Client = null;
rootFrame.Navigate(typeof(ConnectionPage), e.Arguments);
}
}
// Ensure the current window is active
Window.Current.Activate();
}
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
public void OnIpcConnected()
{
if (rootFrame.Content == null)
{
Client = new FactoryOrchestratorUWPClient(IPAddress.Loopback, 45684);
Client.OnConnected += OnIpcConnected;
if (await Client.TryConnect(IgnoreVersionMismatch))
{
OnConnectionPage = false;
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
else
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
Client = null;
rootFrame.Navigate(typeof(ConnectionPage), e.Arguments);
}
}
// Ensure the current window is active
Window.Current.Activate();
}
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
public void OnIpcConnected()
{
// disable so this doesnt fire again
Client.OnConnected -= OnIpcConnected;
Client.OnConnected -= OnIpcConnected;
lock (onConnectionLock)
{
if (Client.IpAddress == lastIp)
@ -418,7 +418,7 @@ namespace Microsoft.FactoryOrchestrator.UWP
// TODO: Only start these tasks once, so we can handle new IPC connection correctly. Likely need state cleanup too.
Task.Run(async () =>
{
while (true)
while (true)
{
await CheckForServiceEvents();
await Task.Delay(1000);
@ -427,17 +427,17 @@ namespace Microsoft.FactoryOrchestrator.UWP
Task.Run(async () =>
{
while (true)
while (true)
{
await HandleServiceEvents();
await Task.Delay(1000);
}
});
}
}
private async Task CheckForServiceEvents()
{
}
}
private async Task CheckForServiceEvents()
{
List<ServiceEvent> newEvents = new List<ServiceEvent>();
try
@ -460,107 +460,152 @@ namespace Microsoft.FactoryOrchestrator.UWP
{
await Task.Delay(1000);
}
}
// Handle events in a queue
if (newEvents.Count > 0)
{
eventSeen = true;
}
// Handle events in a queue
if (newEvents.Count > 0)
{
eventSeen = true;
lastEventIndex = newEvents[newEvents.Count - 1].EventIndex;
foreach (var evnt in newEvents)
{
serviceEventQueue.Enqueue(evnt);
}
}
}
private async Task HandleServiceEvents()
{
// Handle one event at a time, oldest first
while (serviceEventQueue.TryDequeue(out var evnt))
{
switch (evnt.ServiceEventType)
{
case ServiceEventType.ServiceStart:
IsServiceExecutingBootTasks = true;
OnServiceStart?.Invoke();
break;
case ServiceEventType.BootTasksComplete:
IsServiceExecutingBootTasks = false;
OnServiceDoneExecutingBootTasks?.Invoke();
break;
case ServiceEventType.WaitingForExternalTaskRun:
// Check if we are localhost, if so we are the DUT and need to run the UWP task for the server.
// If not, do nothing, as we are not the DUT.
if (Client.IsLocalHost)
{
// TODO: Performance: this should be in its own thread, so other service events can be handled
// Only allow one external run at a time
TaskRun run = null;
while (run == null)
{
try
{
run = await Client.QueryTaskRun((Guid)evnt.Guid);
}
}
}
private async Task HandleServiceEvents()
{
// Handle one event at a time, oldest first
while (serviceEventQueue.TryDequeue(out var evnt))
{
switch (evnt.ServiceEventType)
{
case ServiceEventType.ServiceStart:
IsServiceExecutingBootTasks = true;
OnServiceStart?.Invoke();
break;
case ServiceEventType.BootTasksComplete:
IsServiceExecutingBootTasks = false;
OnServiceDoneExecutingBootTasks?.Invoke();
break;
case ServiceEventType.WaitingForExternalTaskRun:
// Check if we are localhost, if so we are the DUT and will show UI for the External task.
// If not, do nothing, as we are not the DUT.
if (Client.IsLocalHost)
{
// TODO: Performance: this should be in its own thread, so other service events can be handled
// Only allow one external run at a time
TaskRun run = null;
while (run == null)
{
try
{
run = await Client.QueryTaskRun((Guid)evnt.Guid);
if (run == null)
{
return;
}
}
catch (FactoryOrchestratorConnectionException)
{
}
}
catch (FactoryOrchestratorConnectionException)
{
OnConnectionFailure();
while ((OnConnectionPage) || (!Client.IsConnected))
{
await Task.Delay(1000);
}
}
}
if (!run.TaskRunComplete)
{
await HandleExternalTaskRunAsync(run);
}
}
while ((OnConnectionPage) || (!Client.IsConnected))
{
await Task.Delay(1000);
}
}
}
if (!run.TaskRunComplete)
{
await HandleExternalTaskRunAsync(run);
}
}
break;
case ServiceEventType.ContainerConnected:
case ServiceEventType.ContainerConnected:
IsContainerRunning = true;
break;
case ServiceEventType.ContainerDisconnected:
IsContainerRunning = false;
case ServiceEventType.ContainerDisconnected:
IsContainerRunning = false;
break;
case ServiceEventType.ContainerDisabled:
IsContainerRunning = false;
IsContainerDisabled = true;
break;
default:
// Ignore other events
break;
}
}
}
private async Task HandleExternalTaskRunAsync(TaskRun run)
{
RunWaitingForResult = run;
// Navigate to result page
await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
((Frame)Window.Current.Content).Navigate(typeof(ExternalTestResultPage));
});
// TODO: Performance: Use signaling
// Block from handing a new system event until the current one is handled
// This is set by ExternalTestResultPage
while (!RunWaitingForResult.TaskRunComplete)
case ServiceEventType.ContainerDisabled:
IsContainerRunning = false;
IsContainerDisabled = true;
break;
case ServiceEventType.ContainerTaskRunRedirectedToRunAsRDUser:
// Check if we are localhost, if so we are the DUT and can try to initiate a RD connection via protocol for the server.
// If not, do nothing, as we are not the DUT.
if (Client.IsLocalHost)
{
// TODO: Performance: this should be in its own thread, so other service events can be handled
// Only allow one container run at a time
TaskRun run = null;
while (run == null)
{
try
{
run = await Client.QueryTaskRun((Guid)evnt.Guid);
if (run == null)
{
return;
}
}
catch (FactoryOrchestratorConnectionException)
{
OnConnectionFailure();
while ((OnConnectionPage) || (!Client.IsConnected))
{
await Task.Delay(1000);
}
}
}
if (!run.TaskRunComplete)
{
await HandleContainerTaskRunRedirectedToRunAsRDUserAsync();
}
}
break;
default:
// Ignore other events
break;
}
}
}
private async Task HandleContainerTaskRunRedirectedToRunAsRDUserAsync()
{
var containerIp = (await Client.GetContainerIpAddresses())[0];
// Try to initiate a RD connection via protocol
await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
{
await Task.Delay(2000);
}
RunWaitingForResult = null;
var result = await Windows.System.Launcher.LaunchUriAsync(new Uri($"ms-rd:factoryosconnect?ip={containerIp}&username=Abby"));
});
}
private async Task HandleExternalTaskRunAsync(TaskRun run)
{
RunWaitingForResult = run;
// Navigate to result page
await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
((Frame)Window.Current.Content).Navigate(typeof(ExternalTestResultPage));
});
// TODO: Performance: Use signaling
// Block from handing a new system event until the current one is handled
// This is set by ExternalTestResultPage
while (!RunWaitingForResult.TaskRunComplete)
{
await Task.Delay(2000);
}
RunWaitingForResult = null;
}
#region IDisposable Support
@ -588,22 +633,22 @@ namespace Microsoft.FactoryOrchestrator.UWP
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
public TaskRun RunWaitingForResult { get; private set; }
public string MainPageLastNavTag { get; set; }
public FactoryOrchestratorUWPClient Client { get; set; }
public bool OnConnectionPage { get; set; }
public bool IgnoreVersionMismatch { get; set; }
#endregion
public TaskRun RunWaitingForResult { get; private set; }
public string MainPageLastNavTag { get; set; }
public FactoryOrchestratorUWPClient Client { get; set; }
public bool OnConnectionPage { get; set; }
public bool IgnoreVersionMismatch { get; set; }
/// <summary>
/// <c>true if Service is executing boot TaskLists.</c>
/// </summary>
/// </summary>
public bool IsServiceExecutingBootTasks { get; private set; }
/// <summary>
/// Event raised when the Service is done executing boot tasks.
/// </summary>
public event ServiceDoneExecutingBootTasks OnServiceDoneExecutingBootTasks;
public event ServiceDoneExecutingBootTasks OnServiceDoneExecutingBootTasks;
/// <summary>
/// Event raised when the Service is starting and is executing boot tasks.
/// </summary>
@ -645,14 +690,14 @@ namespace Microsoft.FactoryOrchestrator.UWP
}
}
private bool _isContainerRunning = false;
private bool _isContainerDisabled = false;
private readonly SemaphoreSlim connectionFailureSem;
private readonly SemaphoreSlim pollingFailureSem;
private bool eventSeen = false;
private ulong lastEventIndex;
private readonly ConcurrentQueue<ServiceEvent> serviceEventQueue = new ConcurrentQueue<ServiceEvent>();
private bool _isContainerRunning = false;
private bool _isContainerDisabled = false;
private readonly SemaphoreSlim connectionFailureSem;
private readonly SemaphoreSlim pollingFailureSem;
private bool eventSeen = false;
private ulong lastEventIndex;
private readonly ConcurrentQueue<ServiceEvent> serviceEventQueue = new ConcurrentQueue<ServiceEvent>();
private ExtendedExecutionSession extendedExecution = null;
private readonly object onConnectionLock = new object();
private IPAddress lastIp = null;
@ -661,5 +706,5 @@ namespace Microsoft.FactoryOrchestrator.UWP
/// <summary>
/// Signature for OnServiceDoneExecutingBootTasks.
/// </summary>
public delegate void ServiceDoneExecutingBootTasks();
}
public delegate void ServiceDoneExecutingBootTasks();
}

Просмотреть файл

@ -36,6 +36,7 @@
<TextBlock x:Name="ContainerGuiWarningExample" x:Uid="ContainerGuiWarningExample" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" Visibility="Collapsed" TextWrapping="WrapWholeWords"/>
</StackPanel>
<TextBlock x:Name="OutputConst" Grid.Row="4" FontWeight="Bold" VerticalAlignment="Bottom" Padding="5,5,0,5" HorizontalAlignment="Left" x:Uid="OutputConst"/>
<Button x:Name="LaunchRD" x:Uid="LaunchRD" Click="LaunchRD_Click" Grid.Row="4" HorizontalAlignment="Center" Visibility="Collapsed"/>
<Button x:Name="ClearButton" x:Uid="ClearButton" Click="ClearButton_Click" Grid.Row="4" HorizontalAlignment="Right"/>
<ScrollViewer x:Name="ScrollView" HorizontalScrollBarVisibility="Auto" Grid.Row="6">
<StackPanel x:Name="OutputStack" Margin="5" VerticalAlignment="Top" Orientation="Vertical" SizeChanged="OutputStack_SizeChanged"/>

Просмотреть файл

@ -1,47 +1,52 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
using System;
using System.Collections.Generic;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Microsoft.FactoryOrchestrator.Client;
using Microsoft.FactoryOrchestrator.Core;
using System.Threading.Tasks;
using System.Threading;
using TaskStatus = Microsoft.FactoryOrchestrator.Core.TaskStatus;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
using System;
using System.Collections.Generic;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Microsoft.FactoryOrchestrator.Client;
using Microsoft.FactoryOrchestrator.Core;
using System.Threading.Tasks;
using System.Threading;
using TaskStatus = Microsoft.FactoryOrchestrator.Core.TaskStatus;
using Windows.UI.Core;
namespace Microsoft.FactoryOrchestrator.UWP
{
/// <summary>
/// A simple semi-interactive console.
/// </summary>
public sealed partial class ConsolePage : Page, IDisposable
{
public ConsolePage()
{
this.InitializeComponent();
this.NavigationCacheMode = NavigationCacheMode.Enabled;
_cmdSem = new SemaphoreSlim(1, 1);
_outSem = new SemaphoreSlim(1, 1);
_activeRunSem = new SemaphoreSlim(1, 1);
namespace Microsoft.FactoryOrchestrator.UWP
{
/// <summary>
/// A simple semi-interactive console.
/// </summary>
public sealed partial class ConsolePage : Page, IDisposable
{
public ConsolePage()
{
this.InitializeComponent();
this.NavigationCacheMode = NavigationCacheMode.Enabled;
_cmdSem = new SemaphoreSlim(1, 1);
_outSem = new SemaphoreSlim(1, 1);
_activeRunSem = new SemaphoreSlim(1, 1);
_newCmd = false;
_cmdHistory = new List<string>(20);
_cmdHistoryIndex = 0;
// Use a custom routed event handler to ensure we see ALL key events,
// without this, some are silently handled by the UI framework
CommandBox.AddHandler(UIElement.KeyDownEvent, new KeyEventHandler(CommandBox_KeyDown), true);
((App)Application.Current).PropertyChanged += ConsolePage_AppPropertyChanged;
((App)Application.Current).PropertyChanged += ConsolePage_AppPropertyChanged;
}
private async void ConsolePage_AppPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName.Equals("IsContainerRunning", StringComparison.Ordinal))
{
if (((App)Application.Current).IsContainerRunning)
{
_containerIp = (await Client.GetContainerIpAddresses().ConfigureAwait(false))[0];
}
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
if (((App)Application.Current).IsContainerRunning)
@ -71,14 +76,14 @@ namespace Microsoft.FactoryOrchestrator.UWP
}
}
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
Client = ((App)Application.Current).Client;
if ((_taskRunPoller != null) && (!_activeCmdTaskRun.TaskRunComplete))
{
// Only restart polling if the command is still running.
_taskRunPoller.StartPolling(Client);
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
Client = ((App)Application.Current).Client;
if ((_taskRunPoller != null) && (!_activeCmdTaskRun.TaskRunComplete))
{
// Only restart polling if the command is still running.
_taskRunPoller.StartPolling(Client);
}
if (((App)Application.Current).IsContainerDisabled)
@ -91,6 +96,7 @@ namespace Microsoft.FactoryOrchestrator.UWP
if (((App)Application.Current).IsContainerRunning)
{
ContainerCheckBox.IsEnabled = true;
_containerIp = (await Client.GetContainerIpAddresses())[0];
}
else
{
@ -102,29 +108,29 @@ namespace Microsoft.FactoryOrchestrator.UWP
try
{
_isWindows = await Client.GetOSPlatform() == PlatformID.Win32NT;
}
catch (FactoryOrchestratorVersionMismatchException)
}
catch (FactoryOrchestratorVersionMismatchException)
{
// Assume service is Windows and this API isn't implemented (Service version < 9.1.0)
_isWindows = true;
}
base.OnNavigatedTo(e);
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
if (_taskRunPoller != null)
{
_taskRunPoller.StopPolling();
}
base.OnNavigatedFrom(e);
}
private async void RunButton_Click(object sender, RoutedEventArgs e)
{
_cmdSem.Wait();
}
base.OnNavigatedTo(e);
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
if (_taskRunPoller != null)
{
_taskRunPoller.StopPolling();
}
base.OnNavigatedFrom(e);
}
private async void RunButton_Click(object sender, RoutedEventArgs e)
{
_cmdSem.Wait();
try
{
if (RunButtonIcon.Symbol == Symbol.Stop)
@ -143,52 +149,52 @@ namespace Microsoft.FactoryOrchestrator.UWP
// Asynchronously run the command
await ExecuteCommand(CommandBox.Text);
}
}
}
finally
}
}
finally
{
_cmdSem.Release();
}
}
private async void CommandBox_KeyDown(object sender, KeyRoutedEventArgs e)
{
// Send command if enter is pressed in command box
if (e.Key == Windows.System.VirtualKey.Enter)
{
if (!String.IsNullOrWhiteSpace(CommandBox.Text))
{
// Asynchronously run the command
await ExecuteCommand(CommandBox.Text);
}
}
if (e.Key == Windows.System.VirtualKey.Up)
{
if (_cmdHistoryIndex > 0)
{
}
}
private async void CommandBox_KeyDown(object sender, KeyRoutedEventArgs e)
{
// Send command if enter is pressed in command box
if (e.Key == Windows.System.VirtualKey.Enter)
{
if (!String.IsNullOrWhiteSpace(CommandBox.Text))
{
// Asynchronously run the command
await ExecuteCommand(CommandBox.Text);
}
}
if (e.Key == Windows.System.VirtualKey.Up)
{
if (_cmdHistoryIndex > 0)
{
CommandBox.Text = _cmdHistory[--_cmdHistoryIndex];
CommandBox.SelectionStart = CommandBox.Text.Length;
CommandBox.SelectionLength = 0;
}
}
if (e.Key == Windows.System.VirtualKey.Down)
{
CommandBox.SelectionLength = 0;
}
}
if (e.Key == Windows.System.VirtualKey.Down)
{
if ((_cmdHistoryIndex + 1 < _cmdHistory.Count))
{
{
CommandBox.Text = _cmdHistory[++_cmdHistoryIndex];
CommandBox.SelectionStart = CommandBox.Text.Length;
CommandBox.SelectionLength = 0;
}
}
}
/// <summary>
/// Runs a command using cmd.exe
/// </summary>
private async Task ExecuteCommand(string command)
{
// Update history & reset index
}
}
}
/// <summary>
/// Runs a command using cmd.exe
/// </summary>
private async Task ExecuteCommand(string command)
{
// Update history & reset index
if ((_cmdHistory.Count == 0) || (!_cmdHistory[_cmdHistory.Count - 1].Equals(command, StringComparison.CurrentCulture)))
{
_cmdHistory.Add(command);
@ -200,32 +206,32 @@ namespace Microsoft.FactoryOrchestrator.UWP
}
_cmdHistory.Add(command);
}
_cmdHistoryIndex = _cmdHistory.Count;
// Update UI
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
RunButtonIcon.Symbol = Symbol.Stop;
CommandBox.IsEnabled = false;
// Log command to console output
var textBlock = new TextBlock()
{
Text = $"{Environment.NewLine}>{command}{Environment.NewLine}",
FontWeight = Windows.UI.Text.FontWeights.Bold,
IsTextSelectionEnabled = true
};
OutputStack.Children.Add(textBlock);
});
// Execute command
_newCmd = true;
if (_taskRunPoller != null)
{
_taskRunPoller.StopPolling();
}
}
_cmdHistoryIndex = _cmdHistory.Count;
// Update UI
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
RunButtonIcon.Symbol = Symbol.Stop;
CommandBox.IsEnabled = false;
// Log command to console output
var textBlock = new TextBlock()
{
Text = $"{Environment.NewLine}>{command}{Environment.NewLine}",
FontWeight = Windows.UI.Text.FontWeights.Bold,
IsTextSelectionEnabled = true
};
OutputStack.Children.Add(textBlock);
});
// Execute command
_newCmd = true;
if (_taskRunPoller != null)
{
_taskRunPoller.StopPolling();
}
try
{
@ -252,87 +258,87 @@ namespace Microsoft.FactoryOrchestrator.UWP
_activeCmdTaskRun = await Client.RunExecutable(program, args, null, (bool)ContainerCheckBox.IsChecked);
}
}
finally
{
_activeRunSem.Release();
}
// Watch for new output
_taskRunPoller = new ServerPoller((Guid)_activeCmdTaskRun.Guid, typeof(TaskRun), 1000);
_taskRunPoller.OnUpdatedObject += OnUpdatedCmdStatusAsync;
_taskRunPoller.OnException += ((App)Application.Current).OnServerPollerException;
_taskRunPoller.StartPolling(Client);
}
/// <summary>
/// Checks if the commands is finished, updates output
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
private async void OnUpdatedCmdStatusAsync(object source, ServerPollerEventArgs e)
}
finally
{
_activeRunSem.Release();
}
// Watch for new output
_taskRunPoller = new ServerPoller((Guid)_activeCmdTaskRun.Guid, typeof(TaskRun), 1000);
_taskRunPoller.OnUpdatedObject += OnUpdatedCmdStatusAsync;
_taskRunPoller.OnException += ((App)Application.Current).OnServerPollerException;
_taskRunPoller.StartPolling(Client);
}
/// <summary>
/// Checks if the commands is finished, updates output
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
private async void OnUpdatedCmdStatusAsync(object source, ServerPollerEventArgs e)
{
_activeRunSem.Wait();
_activeCmdTaskRun = (TaskRun)e.Result;
_activeRunSem.Release();
if (_activeCmdTaskRun != null)
{
if (_activeCmdTaskRun.TaskRunComplete)
{
// The command finished, no need to poll more
_taskRunPoller.StopPolling();
}
while (_lastOutput != _activeCmdTaskRun.TaskOutput.Count)
{
var blocks = PrepareOutput();
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
try
_activeCmdTaskRun = (TaskRun)e.Result;
_activeRunSem.Release();
if (_activeCmdTaskRun != null)
{
if (_activeCmdTaskRun.TaskRunComplete)
{
// The command finished, no need to poll more
_taskRunPoller.StopPolling();
}
while (_lastOutput != _activeCmdTaskRun.TaskOutput.Count)
{
var blocks = PrepareOutput();
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
try
{
_outSem.Wait();
UpdateOutput(blocks);
}
finally
}
finally
{
_outSem.Release();
}
});
}
if (_activeCmdTaskRun.TaskRunComplete)
{
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
// Allow new commands to run
CommandBox.IsEnabled = true;
CommandBox.Text = "";
RunButtonIcon.Symbol = Symbol.Play;
});
}
}
}
private void ClearButton_Click(object sender, RoutedEventArgs e)
{
_outSem.Wait();
}
});
}
if (_activeCmdTaskRun.TaskRunComplete)
{
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
// Allow new commands to run
CommandBox.IsEnabled = true;
CommandBox.Text = "";
RunButtonIcon.Symbol = Symbol.Play;
});
}
}
}
private void ClearButton_Click(object sender, RoutedEventArgs e)
{
_outSem.Wait();
try
{
OutputStack.Children.Clear();
}
}
finally
{
_outSem.Release();
}
}
/// <summary>
/// Updates UI with latest console output
/// </summary>
private List<(string text, bool isError)> PrepareOutput()
}
/// <summary>
/// Updates UI with latest console output
/// </summary>
private List<(string text, bool isError)> PrepareOutput()
{
List<(string text, bool isError)> ret = new List<(string text, bool isError)>();
@ -408,54 +414,60 @@ namespace Microsoft.FactoryOrchestrator.UWP
ret.Add(tupl);
}
}
}
finally
{
_activeRunSem.Release();
}
return ret;
}
/// <summary>
/// Updates UI with latest console output
/// </summary>
private void UpdateOutput(List<(string text, bool isError)> blocks)
{
foreach (var (text, isError) in blocks)
{
var textBlock = new TextBlock()
{
Text = text,
IsTextSelectionEnabled = true
};
if (isError)
{
textBlock.FontWeight = Windows.UI.Text.FontWeights.Bold;
textBlock.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
}
if (OutputStack.Children.Count >= MaxBlocks)
{
OutputStack.Children.RemoveAt(0);
}
OutputStack.Children.Add(textBlock);
}
}
private void OutputStack_SizeChanged(object sender, SizeChangedEventArgs e)
{
// Scroll down when new output is received
StackPanel stack = (StackPanel)sender;
ScrollViewer scrollView = (ScrollViewer)stack.Parent;
scrollView.ChangeView(null, scrollView.ScrollableHeight, null, true);
finally
{
_activeRunSem.Release();
}
return ret;
}
/// <summary>
/// Updates UI with latest console output
/// </summary>
private void UpdateOutput(List<(string text, bool isError)> blocks)
{
foreach (var (text, isError) in blocks)
{
var textBlock = new TextBlock()
{
Text = text,
IsTextSelectionEnabled = true
};
if (isError)
{
textBlock.FontWeight = Windows.UI.Text.FontWeights.Bold;
textBlock.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
}
if (OutputStack.Children.Count >= MaxBlocks)
{
OutputStack.Children.RemoveAt(0);
}
OutputStack.Children.Add(textBlock);
}
}
private void OutputStack_SizeChanged(object sender, SizeChangedEventArgs e)
{
// Scroll down when new output is received
StackPanel stack = (StackPanel)sender;
ScrollViewer scrollView = (ScrollViewer)stack.Parent;
scrollView.ChangeView(null, scrollView.ScrollableHeight, null, true);
}
private void ContainerCheckBox_StateChanged(object sender, RoutedEventArgs e)
{
ContainerGuiWarning.Visibility = (bool)ContainerCheckBox.IsChecked ? Visibility.Visible : Visibility.Collapsed;
ContainerGuiWarningExample.Visibility = ContainerGuiWarning.Visibility;
LaunchRD.Visibility = ContainerGuiWarning.Visibility;
}
private async void LaunchRD_Click(object sender, RoutedEventArgs e)
{
var result = await Windows.System.Launcher.LaunchUriAsync(new Uri($"ms-rd:factoryosconnect?ip={_containerIp}&username=Abby"));
}
#region IDisposable Support
@ -484,22 +496,22 @@ namespace Microsoft.FactoryOrchestrator.UWP
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
private TaskRun _activeCmdTaskRun;
private bool _newCmd;
private int _lastOutput;
private ServerPoller _taskRunPoller;
private readonly SemaphoreSlim _cmdSem;
private readonly SemaphoreSlim _outSem;
private readonly SemaphoreSlim _activeRunSem;
#endregion
private TaskRun _activeCmdTaskRun;
private bool _newCmd;
private int _lastOutput;
private ServerPoller _taskRunPoller;
private readonly SemaphoreSlim _cmdSem;
private readonly SemaphoreSlim _outSem;
private readonly SemaphoreSlim _activeRunSem;
private FactoryOrchestratorUWPClient Client = ((App)Application.Current).Client;
private bool _isWindows;
private List<string> _cmdHistory;
private int _cmdHistoryIndex;
private const int MaxCmdHistory = 100;
private const int MaxBlocks = 10; // @500 lines per block this is 5000 lines or 10 commands maximum
private bool _isWindows;
private List<string> _cmdHistory;
private int _cmdHistoryIndex;
private string _containerIp;
private const int MaxCmdHistory = 100;
private const int MaxBlocks = 10; // @500 lines per block this is 5000 lines or 10 commands maximum
private const int MaxLinesPerBlock = 500;
}
}
}
}

Просмотреть файл

@ -740,6 +740,10 @@ On retry</value>
<value>Factory Orchestrator Service Information</value>
<comment>text field header for showing info that relate to what features are enabled / disabled in the Service.</comment>
</data>
<data name="LaunchRD.Content" xml:space="preserve">
<value>Show Container UI (exit with ALT+F4)</value>
<comment>button to launch remote desktop uwp app &amp; auto connect to the running container</comment>
</data>
<data name="CertHash.Text" xml:space="preserve">
<value>Certificate Hash:</value>
<comment>Hash value of the Certificate of the target machine.</comment>

Просмотреть файл

@ -68,6 +68,18 @@ namespace Microsoft.FactoryOrchestrator.Core
/// </summary>
NetworkAccessDisabled,
/// <summary>
/// The TaskRun has GUI and was redirected to RunAsRDUser.exe. It will not run until a remote user is logged in.
/// </summary>
TaskRunRedirectedToRunAsRDUser,
/// <summary>
/// The Factory Orchestrator Service inside a connected container threw an exception.
/// </summary>
ContainerServiceError,
/// <summary>
/// The Factory Orchestrator Service inside a connected container has a TaskRun with GUI and it was redirected to RunAsRDUser.exe. It will not run until a remote user is logged in.
/// </summary>
ContainerTaskRunRedirectedToRunAsRDUser,
/// <summary>
/// An unknown Factory Orchestrator Service event occurred.
/// </summary>
Unknown = int.MaxValue
@ -359,13 +371,19 @@ namespace Microsoft.FactoryOrchestrator.Core
/// </summary>
/// <param name="guid">The Task GUID.</param>
/// <returns></returns>
TaskBase QueryTask(Guid guid);
TaskBase QueryTask(Guid guid);
/// <summary>
/// Gets the AUMIDs of all installed apps on the OS. Requires Windows Device Portal.
/// </summary>
/// <returns>The list of app AUMIDs.</returns>
List<string> GetInstalledApps();
List<string> GetInstalledApps();
/// <summary>
/// Gets all installed apps on the OS. Requires Windows Device Portal.
/// </summary>
/// <returns>The list of apps and their information, in PackageInfo objects.</returns>
List<PackageInfo> GetInstalledAppsDetailed();
/// <summary>
/// Installs an app package on the Service's computer. The app package must already be on the Service's computer. Requires Windows Device Portal.
@ -426,6 +444,12 @@ namespace Microsoft.FactoryOrchestrator.Core
/// <returns></returns>
TaskRun RunApp(string aumid);
/// <summary>
/// Exits a UWP app. Requires Windows Device Portal.
/// </summary>
/// <param name="aumid">The Application User Model ID (AUMID) of the app to exit.</param>
/// <returns></returns>
void TerminateApp(string aumid);
/// <summary>
/// Runs a Task outside of a TaskList.
/// </summary>
/// <param name="taskGuid">The GUID of the Task to run.</param>
@ -435,8 +459,9 @@ namespace Microsoft.FactoryOrchestrator.Core
/// Runs a Task outside of a TaskList.
/// </summary>
/// <param name="task">The Task to run.</param>
/// <param name="desiredTaskRunGuid">The desired GUID for the returned TaskRun. It is not used if a TaskRun already exists with the same GUID.</param>
/// <returns>The TaskRun associated with the run.</returns>
TaskRun RunTask(TaskBase task);
TaskRun RunTask(TaskBase task, Guid? desiredTaskRunGuid = null);
// TaskRun APIs
/// <summary>

Просмотреть файл

@ -97,7 +97,7 @@ namespace Microsoft.FactoryOrchestrator.Core
/// <summary>
/// The Task state is unknown, likely due to a Service error.
/// </summary>
Unknown
Unknown = int.MaxValue
}
/// <summary>

Просмотреть файл

@ -255,6 +255,49 @@ namespace Microsoft.FactoryOrchestrator.Core
await Task.Delay(500);
status = await GetInstallStatusAsync(ipAddress);
}
}
/// <summary>
/// Closes a running app package application with Windows Device Portal.
/// </summary>
/// <param name="app">The app package to exit .</param>
/// <param name="ipAddress">The ip address of the device to exit the app on.</param>
/// <exception cref="ArgumentException">
/// </exception>
public static async Task CloseAppWithWDP(string app, string ipAddress = "localhost")
{
if (string.IsNullOrWhiteSpace(app))
{
throw new ArgumentException(Resources.WDPError, nameof(app));
}
var uri = BuildEndpoint(new Uri($"http://{ipAddress}"),
"api/taskmanager/app",
$"package={Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(app))}");
await WdpHttpClient.DeleteAsync(uri);
}
/// <summary>
/// Gets the collection of applications installed on the device.
/// </summary>
/// <param name="ipAddress">The ip address of the device to query.</param>
/// <returns>AppPackages object containing the list of installed application packages.</returns>
public static async Task<AppPackages> GetInstalledAppPackagesAsync(string ipAddress = "localhost")
{
Uri uri = BuildEndpoint(
new Uri($"http://{ipAddress}"),
"api/app/packagemanager/packages");
var resp = await WdpHttpClient.GetAsync(uri).ConfigureAwait(false);
if (!resp.IsSuccessStatusCode)
{
throw new InvalidOperationException(Resources.WDPNotRunningError);
}
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(AppPackages));
return (AppPackages)serializer.ReadObject(await resp.Content.ReadAsStreamAsync());
}
}
@ -418,4 +461,154 @@ namespace Microsoft.FactoryOrchestrator.Core
[DataMember(Name = "Success")]
public bool Success { get; private set; }
}
}
/// <summary>
/// Object representing a list of Application Packages
/// </summary>
[DataContract]
public class AppPackages
{
/// <summary>
/// Gets a list of the packages
/// </summary>
[DataMember(Name = "InstalledPackages")]
public List<PackageInfo> Packages { get; private set; }
/// <summary>
/// Presents a user readable representation of a list of AppPackages
/// </summary>
/// <returns>User readable list of AppPackages.</returns>
public override string ToString()
{
string output = "Packages:\n";
foreach (PackageInfo package in this.Packages)
{
output += package;
}
return output;
}
}
/// <summary>
/// object representing the package information
/// </summary>
[DataContract]
public class PackageInfo
{
/// <summary>
/// Gets package name
/// </summary>
[DataMember(Name = "Name")]
public string Name { get; private set; }
/// <summary>
/// Gets package family name
/// </summary>
[DataMember(Name = "PackageFamilyName")]
public string FamilyName { get; private set; }
/// <summary>
/// Gets package full name
/// </summary>
[DataMember(Name = "PackageFullName")]
public string FullName { get; private set; }
/// <summary>
/// Gets package relative Id
/// </summary>
[DataMember(Name = "PackageRelativeId")]
public string AppId { get; private set; }
/// <summary>
/// Gets package publisher
/// </summary>
[DataMember(Name = "Publisher")]
public string Publisher { get; private set; }
/// <summary>
/// Gets package version
/// </summary>
[DataMember(Name = "Version")]
public PackageVersion Version { get; private set; }
/// <summary>
/// Gets package origin, a measure of how the app was installed.
/// PackageOrigin_Unknown            = 0,
/// PackageOrigin_Unsigned           = 1,
/// PackageOrigin_Inbox              = 2,
/// PackageOrigin_Store              = 3,
/// PackageOrigin_DeveloperUnsigned  = 4,
/// PackageOrigin_DeveloperSigned    = 5,
/// PackageOrigin_LineOfBusiness     = 6
/// </summary>
[DataMember(Name = "PackageOrigin")]
public int PackageOrigin { get; private set; }
/// <summary>
/// Helper method to determine if the app was sideloaded and therefore can be used with e.g. GetFolderContentsAsync
/// </summary>
/// <returns> True if the package is sideloaded. </returns>
public bool IsSideloaded()
{
return this.PackageOrigin == 4 || this.PackageOrigin == 5;
}
/// <summary>
/// Get a string representation of the package
/// </summary>
/// <returns>String representation</returns>
public override string ToString()
{
return string.Format(CultureInfo.CurrentCulture, "\t{0}\n\t\t{1}\n", this.FullName, this.AppId);
}
}
/// <summary>
/// Object representing a package version
/// </summary>
[DataContract]
public class PackageVersion
{
/// <summary>
/// Gets version build
/// </summary>
[DataMember(Name = "Build")]
public int Build { get; private set; }
/// <summary>
/// Gets package Major number
/// </summary>
[DataMember(Name = "Major")]
public int Major { get; private set; }
/// <summary>
/// Gets package minor number
/// </summary>
[DataMember(Name = "Minor")]
public int Minor { get; private set; }
/// <summary>
/// Gets package revision
/// </summary>
[DataMember(Name = "Revision")]
public int Revision { get; private set; }
/// <summary>
/// Gets package version
/// </summary>
public Version Version
{
get { return new Version(this.Major, this.Minor, this.Build, this.Revision); }
}
/// <summary>
/// Get a string representation of a version
/// </summary>
/// <returns>String representation</returns>
public override string ToString()
{
return Version.ToString();
}
}
}

Просмотреть файл

@ -863,12 +863,16 @@ namespace Microsoft.FactoryOrchestrator.Server
{
// Program is Win32 GUI, if RunAsRDUser is present, redirect to it.
// This allows the program to run as a user account and show its GUI.
// This likely means the Task is being run by a container.
if (File.Exists(Path.Combine(Environment.SystemDirectory, "RunAsRDUser.exe")))
{
taskRun.TaskOutput.Add(string.Format(CultureInfo.CurrentCulture, Resources.RedirectingToRunAsRDUser, taskRun.TaskPath));
var currentPath = taskRun.TaskPath;
taskRun.TaskPath = Path.Combine(Environment.SystemDirectory, "RunAsRDUser.exe");
taskRun.Arguments = $"{currentPath} {taskRun.Arguments}";
// Let the service know we require a logged in remote user account to show GUI
OnTaskManagerEvent?.Invoke(this, new TaskManagerEventArgs(TaskManagerEventType.TaskRunRedirectedToRunAsRDUser, taskRun.Guid, TaskStatus.Running));
}
else
{
@ -1313,7 +1317,7 @@ namespace Microsoft.FactoryOrchestrator.Server
return run;
}
public TaskRun RunTask(TaskBase task)
public TaskRun RunTask(TaskBase task, Guid? desiredTaskRunGuid = null)
{
if (task == null)
{
@ -1331,7 +1335,15 @@ namespace Microsoft.FactoryOrchestrator.Server
{
task.TimesRetried = 0;
}
var run = CreateTaskRunForTask(task, LogFolder);
if (desiredTaskRunGuid != null)
{
if (UpdateTaskRunGuid(run.Guid, (Guid)desiredTaskRunGuid))
{
run = GetTaskRunByGuid((Guid)desiredTaskRunGuid);
}
}
// TODO: Properly dispose of this token when the task completes.
// The overall RunningBackgroundTasks & RunningTaskRunTokens logic could use some improvements.
@ -1774,7 +1786,8 @@ namespace Microsoft.FactoryOrchestrator.Server
WaitingForExternalTaskRunStarted,
WaitingForExternalTaskRunFinished,
TaskRunStarted,
TaskRunFinished
TaskRunFinished,
TaskRunRedirectedToRunAsRDUser
}
public class TaskManagerEventArgs : EventArgs

Просмотреть файл

@ -11,7 +11,7 @@ using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography.X509Certificates;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
@ -27,6 +27,12 @@ using Microsoft.Win32;
using PeterKottas.DotNetCore.WindowsService;
using PeterKottas.DotNetCore.WindowsService.Interfaces;
using TaskStatus = Microsoft.FactoryOrchestrator.Core.TaskStatus;
using System.Runtime.InteropServices;
using Microsoft.FactoryOrchestrator.Client;
using System.Globalization;
using JKang.IpcServiceFramework.Hosting;
using Microsoft.Extensions.Hosting;
using System.Threading;
namespace Microsoft.FactoryOrchestrator.Service
{
@ -103,8 +109,8 @@ namespace Microsoft.FactoryOrchestrator.Service
{
// optionally configure logging
builder.SetMinimumLevel(LogLevel.Trace);
}).Build();
}).Build();
public static void Main(string[] args)
{
#if DEBUG
@ -904,7 +910,7 @@ namespace Microsoft.FactoryOrchestrator.Service
}
}
public TaskRun RunTask(TaskBase task)
public TaskRun RunTask(TaskBase task, Guid? desiredTaskRunGuid = null)
{
try
{
@ -915,7 +921,7 @@ namespace Microsoft.FactoryOrchestrator.Service
throw new FactoryOrchestratorException(Resources.BootTasksExecutingError);
}
var run = FOService.Instance.TaskExecutionManager.RunTask(task);
var run = FOService.Instance.TaskExecutionManager.RunTask(task, desiredTaskRunGuid);
FOService.Instance.ServiceLogger.LogDebug($"{Resources.Finish}: RunTask {task}");
return run.DeepCopy();
}
@ -953,6 +959,39 @@ namespace Microsoft.FactoryOrchestrator.Service
}
}
public void TerminateApp(string aumid)
{
try
{
FOService.Instance.ServiceLogger.LogDebug($"{Resources.Start}: TerminateApp {aumid}");
if (FOService.Instance.IsExecutingBootTasks)
{
throw new FactoryOrchestratorException(Resources.BootTasksExecutingError);
}
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
throw new FactoryOrchestratorException(string.Format(CultureInfo.CurrentCulture, Resources.WindowsOnlyError, "TerminateApp"));
}
var apps = WDPHelpers.GetInstalledAppPackagesAsync().Result;
var app = apps.Packages.Where(x => x.AppId.Equals(aumid, StringComparison.OrdinalIgnoreCase)).DefaultIfEmpty(null).FirstOrDefault();
if (app != null)
{
WDPHelpers.CloseAppWithWDP(app.FullName).Wait();
}
FOService.Instance.ServiceLogger.LogDebug($"{Resources.Finish}: TerminateApp {aumid}");
}
catch (Exception e)
{
FOService.Instance.LogServiceEvent(new ServiceEvent(ServiceEventType.ServiceError, null, e.AllExceptionsToString()));
throw;
}
}
public byte[] GetFile(string sourceFilename, long offset, int count, bool getFromContainer = false)
{
try
@ -1171,20 +1210,9 @@ namespace Microsoft.FactoryOrchestrator.Service
}
// Get installed packages on the system
var response = WDPHelpers.WdpHttpClient.GetAsync(new Uri("http://localhost/api/app/packagemanager/packages")).Result;
var apps = WDPHelpers.GetInstalledAppPackagesAsync().Result;
if (!response.IsSuccessStatusCode)
{
throw new InvalidOperationException(Resources.WDPNotRunningError);
}
List<string> aumids = new List<string>();
var output = response.Content.ReadAsStringAsync().Result;
var matches = Regex.Matches(output, "\"PackageRelativeId\" : \"(.+?)\"");
foreach (Match match in matches)
{
aumids.Add(match.Groups[1].Value);
}
List<string> aumids = apps.Packages.Select(x => x.AppId).ToList();
FOService.Instance.ServiceLogger.LogDebug($"{Resources.Finish}: GetInstalledApps");
return aumids;
@ -1196,6 +1224,30 @@ namespace Microsoft.FactoryOrchestrator.Service
}
}
public List<PackageInfo> GetInstalledAppsDetailed()
{
try
{
FOService.Instance.ServiceLogger.LogDebug($"{Resources.Start}: GetInstalledAppsDetailed");
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
throw new FactoryOrchestratorException(string.Format(CultureInfo.CurrentCulture, Resources.WindowsOnlyError, "GetInstalledAppsDetailed"));
}
// Get installed packages on the system
var apps = WDPHelpers.GetInstalledAppPackagesAsync().Result;
FOService.Instance.ServiceLogger.LogDebug($"{Resources.Finish}: GetInstalledAppsDetailed");
return apps.Packages;
}
catch (Exception e)
{
FOService.Instance.LogServiceEvent(new ServiceEvent(ServiceEventType.ServiceError, null, e.AllExceptionsToString()));
throw;
}
}
public void EnableLocalLoopbackForApp(string aumid)
{
try
@ -1434,6 +1486,8 @@ namespace Microsoft.FactoryOrchestrator.Service
// Unix only. Windows uses volatile registry.
private readonly string _volatileServiceStatusFilename = Path.Combine(Path.GetTempPath(), "FactoryOrchestratorVolatileServiceStatus.xml");
private FactoryOrchestratorClient _containerClient;
private ulong _lastContainerEventIndex;
private HashSet<Guid> _containerGUITaskRuns;
// TaskManager_Server instances
private TaskManager _taskExecutionManager;
@ -1496,7 +1550,7 @@ namespace Microsoft.FactoryOrchestrator.Service
public bool DisableFileTransferPage { get; private set; }
public bool IsNetworkAccessEnabled { get => _networkAccessEnabled && !_networkAccessDisabled; }
public int NetworkPort { get; private set; }
public X509Certificate2 SSLCertificate { get; private set; }
public X509Certificate2 SSLCertificate { get; private set; }
public bool RunInitialTaskListsOnFirstBoot { get; private set; }
public bool IsContainerSupportEnabled { get; private set; }
@ -1565,7 +1619,7 @@ namespace Microsoft.FactoryOrchestrator.Service
public static string GetOEMVersionString()
{
if (!_isWindows)
{
{
throw new PlatformNotSupportedException(string.Format(CultureInfo.CurrentCulture, Resources.WindowsOnlyError, "GetOEMVersionString"));
}
@ -1749,6 +1803,11 @@ namespace Microsoft.FactoryOrchestrator.Service
}
break;
}
case TaskManagerEventType.TaskRunRedirectedToRunAsRDUser:
{
serviceEvent = new ServiceEvent(ServiceEventType.TaskRunRedirectedToRunAsRDUser, e.Guid, string.Format(CultureInfo.CurrentCulture, Resources.WaitingForExternalTaskRun, e.Guid));
break;
}
case TaskManagerEventType.WaitingForExternalTaskRunFinished:
serviceEvent = new ServiceEvent(ServiceEventType.DoneWaitingForExternalTaskRun, e.Guid, string.Format(CultureInfo.CurrentCulture, Resources.DoneWaitingForExternalTaskRun, e.Guid, e.Status));
break;
@ -1816,7 +1875,7 @@ namespace Microsoft.FactoryOrchestrator.Service
}
hostRun.TaskOutput.Add($"----------- {Resources.StartContainerOutput} (stdout, stderr) -----------");
var containerRun = await _containerClient.RunTask(containerTask);
var containerRun = await _containerClient.RunTask(containerTask, hostRun.Guid);
containerRun = await _containerClient.QueryTaskRun(containerRun.Guid);
int latestIndex = 0;
while (!containerRun.TaskRunComplete)
@ -1871,6 +1930,29 @@ namespace Microsoft.FactoryOrchestrator.Service
hostRun.TaskStatus = containerRun.TaskStatus;
hostRun.TaskOutput.Add($"----------- {Resources.EndContainerOutput} -----------");
}
if (_containerGUITaskRuns.Contains(containerRun.Guid))
{
_containerGUITaskRuns.Remove(containerRun.Guid);
if (_containerGUITaskRuns.Count == 0)
{
try
{
// Exit URDC if we launched it.
var rdApp = (await WDPHelpers.GetInstalledAppPackagesAsync()).Packages.Where(x => x.FullName.StartsWith("Microsoft.RemoteDesktop", StringComparison.OrdinalIgnoreCase)).DefaultIfEmpty(null).FirstOrDefault();
if (rdApp != null)
{
await WDPHelpers.CloseAppWithWDP(rdApp.FullName);
}
}
catch (Exception)
{
// Ignore failure to exit RD
}
}
}
}
catch (Exception e)
{
@ -1922,8 +2004,26 @@ namespace Microsoft.FactoryOrchestrator.Service
if (IsContainerConnected && previousContainerStatus)
{
// We were connected already. Verify it is still working properly.
await _containerClient.GetServiceVersionString();
// We were connected already. Check for any new container service events and log new host server events if any are found.
var containerEvents = await _containerClient.GetServiceEvents(_lastContainerEventIndex);
foreach (var containerEvent in containerEvents)
{
_lastContainerEventIndex = containerEvent.EventIndex;
switch (containerEvent.ServiceEventType)
{
case ServiceEventType.ServiceError:
LogServiceEvent(new ServiceEvent(ServiceEventType.ContainerServiceError, containerEvent.Guid, containerEvent.Message));
break;
case ServiceEventType.TaskRunRedirectedToRunAsRDUser:
LogServiceEvent(new ServiceEvent(ServiceEventType.ContainerTaskRunRedirectedToRunAsRDUser, containerEvent.Guid, containerEvent.Message));
_containerGUITaskRuns.Add((Guid)containerEvent.Guid);
break;
default:
// ignore other events
break;
}
}
}
else
{
@ -2381,6 +2481,8 @@ namespace Microsoft.FactoryOrchestrator.Service
ContainerIpAddress = null;
_containerHeartbeatToken = null;
_containerClient = null;
_lastContainerEventIndex = 0;
_containerGUITaskRuns = new HashSet<Guid>();
LoadOEMCustomizations();
@ -2902,11 +3004,11 @@ namespace Microsoft.FactoryOrchestrator.Service
catch (Exception)
{
NetworkPort = 45684;
}
string sslCertificateFile;
}
string sslCertificateFile;
try
{
{
sslCertificateFile = (string)(GetAppSetting(_sslCertificateFile) ?? new ArgumentNullException());
}
catch (Exception)
@ -2914,23 +3016,23 @@ namespace Microsoft.FactoryOrchestrator.Service
sslCertificateFile = "";
}
if(string.IsNullOrEmpty(sslCertificateFile))
{
var assm = Assembly.GetExecutingAssembly();
string defaultCertName = "FactoryServer.pfx";
using (Stream cs = assm.GetManifestResourceStream(assm.GetName().Name + "." + defaultCertName))
{
Byte[] raw = new Byte[cs.Length];
for (Int32 i = 0; i < cs.Length; ++i)
raw[i] = (Byte)cs.ReadByte();
SSLCertificate = new X509Certificate2(raw);
}
if(string.IsNullOrEmpty(sslCertificateFile))
{
var assm = Assembly.GetExecutingAssembly();
string defaultCertName = "FactoryServer.pfx";
using (Stream cs = assm.GetManifestResourceStream(assm.GetName().Name + "." + defaultCertName))
{
Byte[] raw = new Byte[cs.Length];
for (Int32 i = 0; i < cs.Length; ++i)
raw[i] = (Byte)cs.ReadByte();
SSLCertificate = new X509Certificate2(raw);
}
}
else
{
SSLCertificate = new X509Certificate2(sslCertificateFile);
else
{
SSLCertificate = new X509Certificate2(sslCertificateFile);
}
return true;

Просмотреть файл

@ -3,7 +3,7 @@
<!-- Assembly, App, Package version for all non-OSS files. Uses SemVer. -->
<PropertyGroup Label="Version">
<VersionPrefix>9.1.0</VersionPrefix>
<VersionPrefix>10.0.0</VersionPrefix>
</PropertyGroup>
<!-- Common packaging properties -->