Skip to content

Commit 537f622

Browse files
Tests
1 parent 7e1647d commit 537f622

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ You don't need any interop code for the `.GetForCurrentView()` methods.
77
- The library does currently not support any Uwp-Frame related apis
88
- Therefore not frame customization
99
- Creating a new window is only possible with the library apis
10+
- Pickers still need `IInitializeWithWindow` (See #11)
1011

1112
## Setup
1213

@@ -71,15 +72,24 @@ Should contain all logic.
7172
```
7273

7374
#### `Program.cs`
74-
Currently the `App.OnLaunched` never get's called to you have to specify the MainPage in the call below.
75-
For more customization copy the content of `XamlApplicationWrapper.Run` in to your own code...
7675
```csharp
7776
public class Program
7877
{
7978
[STAThread]
8079
public static void Main(string[] args)
8180
{
82-
XamlApplicationWrapper.Run<App, MainPage>();
81+
FullTrustApplication.Start((param) => new App());
8382
}
8483
}
8584
```
85+
86+
## Examples
87+
#### Create New Window
88+
```csharp
89+
var view = FullTrustApplication.CreateNewView();
90+
_ = view.CoreWindow.Dispatcher.RunIdleAsync((x) =>
91+
{
92+
Window.Current.Content = new MainPage();
93+
Window.Current.Activate();
94+
});
95+
```

Test/UwpUI/MainPage.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<StackPanel Padding="10" HorizontalAlignment="Center">
2525
<Button Content="Save" x:Name="SaveButton" Click="SaveButton_Click" MinWidth="200" />
2626
<Button Content="Open" x:Name="OpenButton" Click="OpenButton_Click" MinWidth="200" />
27+
<Button Content="New Window" x:Name="NewWindowButton" Click="NewWindowButton_Click" MinWidth="200" />
2728
</StackPanel>
2829
</Border>
2930
<Grid Grid.Column="2">

Test/UwpUI/MainPage.xaml.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,15 @@ private void OpenButton_Click(object sender, RoutedEventArgs e)
3232
filePicker.ViewMode = PickerViewMode.Thumbnail;
3333
_ = filePicker.PickSingleFileAsync();
3434
}
35+
36+
private void NewWindowButton_Click(object sender, RoutedEventArgs e)
37+
{
38+
var view = FullTrustApplication.CreateNewView();
39+
_ = view.CoreWindow.Dispatcher.RunIdleAsync((x) =>
40+
{
41+
Window.Current.Content = new MainPage();
42+
Window.Current.Activate();
43+
});
44+
}
3545
}
3646
}

Test/UwpUI/UwpUI.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@
160160
<Version>2.8.0-prerelease.210927001</Version>
161161
</PackageReference>
162162
</ItemGroup>
163+
<ItemGroup>
164+
<ProjectReference Include="..\..\ShortDev.Uwp.FullTrust\ShortDev.Uwp.FullTrust.csproj">
165+
<Project>{b5454f0b-98b7-4639-bde4-0a0d1e0f5973}</Project>
166+
<Name>ShortDev.Uwp.FullTrust</Name>
167+
</ProjectReference>
168+
</ItemGroup>
163169
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
164170
<VisualStudioVersion>14.0</VisualStudioVersion>
165171
</PropertyGroup>

0 commit comments

Comments
 (0)