Skip to content

Commit de1a05e

Browse files
skeleton codebase
1 parent eff0aae commit de1a05e

File tree

10 files changed

+81
-374
lines changed

10 files changed

+81
-374
lines changed

Samples/StyleTransfer/App.xaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<Application
2-
x:Class="VideoStreamDemo.App"
2+
x:Class="StyleTransfer.App"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5-
xmlns:local="using:VideoStreamDemo">
5+
xmlns:local="using:StyleTransfer">
6+
7+
<Application.Resources>
8+
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
9+
</Application.Resources>
610

711
</Application>

Samples/StyleTransfer/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
using Windows.UI.Xaml.Media;
1616
using Windows.UI.Xaml.Navigation;
1717

18-
namespace VideoStreamDemo
18+
namespace StyleTransfer
1919
{
2020
/// <summary>
2121
/// Provides application-specific behavior to supplement the default Application class.
Lines changed: 4 additions & 201 deletions
Original file line numberDiff line numberDiff line change
@@ -1,211 +1,14 @@
11
<Page
2-
x:Class="VideoStreamDemo.MainPage"
2+
x:Class="StyleTransfer.MainPage"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:StyleTransfer"
56
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
67
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7-
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
88
mc:Ignorable="d"
9-
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
10-
xmlns:local="clr-namespace:VideoStreamDemo;assembly=VideoStreamDemo"
11-
>
9+
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
1210

11+
<Grid>
1312

14-
<Page.Resources>
15-
<SolidColorBrush x:Key="TranslucentBlackBrush" Color="Black" Opacity="0.3"/>
16-
<Style x:Key="TextBlockStyling" TargetType="TextBlock">
17-
<Setter Property="Foreground" Value="Black"/>
18-
</Style>
19-
</Page.Resources>
20-
21-
22-
23-
24-
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
25-
<Grid>
26-
<Grid.RowDefinitions>
27-
<RowDefinition Height="80"/>
28-
<RowDefinition Height="300*"/>
29-
<RowDefinition Height="30"/>
30-
</Grid.RowDefinitions>
31-
32-
<!--Status and result display-->
33-
<StackPanel x:Name="UIStatusPanel" Background="#BFFFFFFF" VerticalAlignment="Top" Grid.Row="0">
34-
<ContentControl Name="UIModelControls">
35-
<StackPanel Orientation="Horizontal">
36-
<ToggleSwitch Name="UIToggleInferenceDevice"
37-
OnContent="GPU"
38-
OffContent="CPU"
39-
IsOn="{x:Bind ViewModel.InferenceDevice, Mode=TwoWay}"
40-
Margin="10,0,0,0"/>
41-
42-
<ListBox Name="UIStyleList" ItemsSource="{x:Bind ViewModel.modelFileNames}" SelectedItem="{x:Bind ViewModel.SelectedModel, Mode=TwoWay}">
43-
<ListBox.ItemsPanel>
44-
<ItemsPanelTemplate>
45-
<VirtualizingStackPanel Orientation="Horizontal"/>
46-
</ItemsPanelTemplate>
47-
</ListBox.ItemsPanel>
48-
</ListBox>
49-
</StackPanel>
50-
</ContentControl>
51-
52-
<!--Image preview and acquisition control-->
53-
<ContentControl Name="UIImageControls"
54-
VerticalAlignment="Stretch"
55-
HorizontalAlignment="Stretch"
56-
IsEnabled="False">
57-
58-
<StackPanel Orientation="Horizontal">
59-
60-
<Button Name="UIButtonLiveStream"
61-
ToolTipService.ToolTip="Camera preview">
62-
<Button.Content>
63-
<SymbolIcon Symbol="Video"/>
64-
</Button.Content>
65-
</Button>
66-
67-
<Button Name="UIButtonAcquireImage"
68-
ToolTipService.ToolTip="Take a photo"
69-
>
70-
<Button.Content>
71-
<SymbolIcon Symbol="Camera"/>
72-
</Button.Content>
73-
</Button>
74-
75-
<Button Name="UIButtonFilePick"
76-
ToolTipService.ToolTip="Select an image from a file">
77-
<Button.Content>
78-
<SymbolIcon Symbol="OpenFile"/>
79-
</Button.Content>
80-
</Button>
81-
82-
<Button Name="UIButtonInking"
83-
ToolTipService.ToolTip="Draw on a canvas"
84-
>
85-
<Button.Content>
86-
<SymbolIcon Symbol="Edit"/>
87-
</Button.Content>
88-
</Button>
89-
90-
<Button Name="UIButtonSaveImage"
91-
ToolTipService.ToolTip="Save the image result to a file"
92-
IsEnabled="false"
93-
VerticalAlignment="Bottom"
94-
95-
Background="#FF939393" >
96-
<Button.Content>
97-
<SymbolIcon Symbol="Save"/>
98-
</Button.Content>
99-
</Button>
100-
101-
</StackPanel>
102-
</ContentControl>
103-
</StackPanel>
104-
105-
<Grid Grid.Row="1">
106-
<Grid.ColumnDefinitions>
107-
<ColumnDefinition Width="200*"/>
108-
<ColumnDefinition Width="200*"/>
109-
</Grid.ColumnDefinitions>
110-
111-
<!-- Inking Option -->
112-
<Viewbox Stretch="Uniform">
113-
<StackPanel Name="UIInkControls"
114-
Visibility="Collapsed"
115-
Grid.Column="0">
116-
<InkToolbar TargetInkCanvas="{x:Bind UIInkCanvasInput}" VerticalAlignment="Top" />
117-
118-
<!--inking canvas-->
119-
<Viewbox Stretch="Uniform"
120-
MaxWidth="720"
121-
MaxHeight="720">
122-
<Grid BorderBrush="Black"
123-
BorderThickness="1">
124-
<Grid Name="UIInkGrid"
125-
Background="White"
126-
MinWidth="200"
127-
MinHeight="200"
128-
MaxWidth="720"
129-
MaxHeight="720">
130-
<InkCanvas Name="UIInkCanvasInput"/>
131-
</Grid>
132-
</Grid>
133-
</Viewbox>
134-
</StackPanel>
135-
</Viewbox>
136-
137-
<!-- Camera Preview -->
138-
<MediaPlayerElement Name="UIMediaPlayerElement"
139-
Stretch="Uniform"
140-
AreTransportControlsEnabled="False"
141-
Canvas.ZIndex="-1"
142-
MaxWidth="720"
143-
MaxHeight="720"
144-
Grid.Column="0"/>
145-
<!-- Image Preview -->
146-
<Image Name="UIInputImage"
147-
Grid.Column="0"
148-
Stretch="Uniform"
149-
MaxWidth="720"
150-
MaxHeight="720"/>
151-
152-
<!-- Result panel -->
153-
<Grid Grid.Column="1" VerticalAlignment="Stretch">
154-
155-
<Image Name="UIResultImage"
156-
Stretch="Uniform"
157-
MaxWidth="720"
158-
MaxHeight="720"/>
159-
160-
<ProgressRing Name="UIProcessingProgressRing"
161-
MaxWidth="720"
162-
MaxHeight="720"
163-
IsActive="false"
164-
Visibility="Collapsed"/>
165-
</Grid>
166-
</Grid>
167-
168-
<!-- Camera Selection Tools
169-
<StackPanel Name="UICameraSelectionControls" Orientation="vertical" Visibility="Visible" VerticalAlignment="Bottom" HorizontalAlignment="Left" Grid.Row="1">
170-
<TextBlock Text="Camera: " Style="{StaticResource TextBlockStyling}"/>
171-
<ComboBox Name="UICmbCamera" SelectionChanged="UICmbCamera_SelectionChanged" Foreground="White" >
172-
<ComboBox.Background>
173-
<SolidColorBrush Color="Black" Opacity="0.3"/>
174-
</ComboBox.Background>
175-
</ComboBox>
176-
<TextBlock Text="Preview resolution: " Style="{StaticResource TextBlockStyling}"/>
177-
<TextBlock Name="UITxtBlockPreviewProperties" Text="0x0" Style="{StaticResource TextBlockStyling}"/>
178-
</StackPanel>-->
179-
180-
<!-- Status bar -->
181-
<Border x:Name="UIStatusBorder" Grid.Row="2">
182-
<StackPanel Orientation="Horizontal">
183-
<TextBlock x:Name="StatusBlock"
184-
Text="Select a style to begin"
185-
FontWeight="Bold"
186-
Width="700"
187-
Margin="10,2,0,0"
188-
TextWrapping="Wrap" />
189-
<TextBlock
190-
Text="Capture FPS"
191-
Margin="10,2,0,0"
192-
FontWeight="Bold" />
193-
<TextBlock x:Name="CaptureFPS"
194-
Text="0 fps"
195-
Margin="10,2,0,0"
196-
TextWrapping="Wrap" />
197-
<TextBlock
198-
Text="Render FPS"
199-
Margin="10,2,0,0"
200-
FontWeight="Bold"/>
201-
<TextBlock x:Name="RenderFPS"
202-
Text="0 fps"
203-
Margin="10,2,0,0"
204-
TextWrapping="Wrap" />
205-
</StackPanel>
206-
</Border>
207-
208-
209-
</Grid>
21013
</Grid>
21114
</Page>
Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.ComponentModel;
43
using System.IO;
54
using System.Linq;
65
using System.Runtime.InteropServices.WindowsRuntime;
@@ -13,10 +12,11 @@
1312
using Windows.UI.Xaml.Input;
1413
using Windows.UI.Xaml.Media;
1514
using Windows.UI.Xaml.Navigation;
15+
using Microsoft.AI.MachineLearning;
1616

1717
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
1818

19-
namespace VideoStreamDemo
19+
namespace StyleTransfer
2020
{
2121
/// <summary>
2222
/// An empty page that can be used on its own or navigated to within a Frame.
@@ -26,32 +26,6 @@ public sealed partial class MainPage : Page
2626
public MainPage()
2727
{
2828
this.InitializeComponent();
29-
this.ViewModel = new PageViewModel();
3029
}
31-
32-
// Hacky version of button click- not currently hooked up to the media buttons, though.
33-
private void Button_Click(object sender, RoutedEventArgs e)
34-
{
35-
if (sender is Button b)
36-
{
37-
string name = b.Name;
38-
switch (name)
39-
{
40-
case "UIButtonLiveStream":
41-
ViewModel.SelectedSource = "LiveStream";
42-
break;
43-
case "UIButtonAcquireImage":
44-
ViewModel.SelectedSource = "AcquireImage";
45-
break;
46-
case "UIButtonFilePick":
47-
ViewModel.SelectedSource = "FilePick";
48-
break;
49-
case "UIButtonInking":
50-
ViewModel.SelectedSource = "Inking";
51-
break;
52-
}
53-
}
54-
}
55-
public PageViewModel ViewModel { get; set; }
5630
}
5731
}

Samples/StyleTransfer/Package.appxmanifest

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
IgnorableNamespaces="uap mp">
88

99
<Identity
10-
Name="73a09580-e832-4c5b-a072-d01f699297c0"
10+
Name="967b0fd3-32f7-4959-aafd-759d8517182a"
1111
Publisher="CN=t-limay"
1212
Version="1.0.0.0" />
1313

14-
<mp:PhoneIdentity PhoneProductId="73a09580-e832-4c5b-a072-d01f699297c0" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
14+
<mp:PhoneIdentity PhoneProductId="967b0fd3-32f7-4959-aafd-759d8517182a" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
1515

1616
<Properties>
17-
<DisplayName>VideoStreamDemo</DisplayName>
17+
<DisplayName>StyleTransfer</DisplayName>
1818
<PublisherDisplayName>t-limay</PublisherDisplayName>
1919
<Logo>Assets\StoreLogo.png</Logo>
2020
</Properties>
@@ -30,12 +30,12 @@
3030
<Applications>
3131
<Application Id="App"
3232
Executable="$targetnametoken$.exe"
33-
EntryPoint="VideoStreamDemo.App">
33+
EntryPoint="StyleTransfer.App">
3434
<uap:VisualElements
35-
DisplayName="VideoStreamDemo"
35+
DisplayName="StyleTransfer"
3636
Square150x150Logo="Assets\Square150x150Logo.png"
3737
Square44x44Logo="Assets\Square44x44Logo.png"
38-
Description="VideoStreamDemo"
38+
Description="StyleTransfer"
3939
BackgroundColor="transparent">
4040
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
4141
<uap:SplashScreen Image="Assets\SplashScreen.png" />

0 commit comments

Comments
 (0)