Skip to content

Commit 3028460

Browse files
authored
Merge pull request #13 from windows-toolkit/feature/sample-app
Sample app
2 parents 6bef853 + ca658af commit 3028460

File tree

123 files changed

+4843
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+4843
-9
lines changed

docs/mvvm/AsyncRelayCommand.md

Lines changed: 10 additions & 6 deletions

docs/mvvm/Ioc.md

Lines changed: 3 additions & 3 deletions

docs/mvvm/PuttingThingsTogether.md

Lines changed: 424 additions & 0 deletions
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30320.27
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvvmSampleUwp", "MvvmSampleUwp\MvvmSampleUwp.csproj", "{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|ARM = Debug|ARM
11+
Debug|ARM64 = Debug|ARM64
12+
Debug|x64 = Debug|x64
13+
Debug|x86 = Debug|x86
14+
Release|ARM = Release|ARM
15+
Release|ARM64 = Release|ARM64
16+
Release|x64 = Release|x64
17+
Release|x86 = Release|x86
18+
EndGlobalSection
19+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
20+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Debug|ARM.ActiveCfg = Debug|ARM
21+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Debug|ARM.Build.0 = Debug|ARM
22+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Debug|ARM.Deploy.0 = Debug|ARM
23+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Debug|ARM64.ActiveCfg = Debug|ARM64
24+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Debug|ARM64.Build.0 = Debug|ARM64
25+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Debug|ARM64.Deploy.0 = Debug|ARM64
26+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Debug|x64.ActiveCfg = Debug|x64
27+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Debug|x64.Build.0 = Debug|x64
28+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Debug|x64.Deploy.0 = Debug|x64
29+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Debug|x86.ActiveCfg = Debug|x86
30+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Debug|x86.Build.0 = Debug|x86
31+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Debug|x86.Deploy.0 = Debug|x86
32+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Release|ARM.ActiveCfg = Release|ARM
33+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Release|ARM.Build.0 = Release|ARM
34+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Release|ARM.Deploy.0 = Release|ARM
35+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Release|ARM64.ActiveCfg = Release|ARM64
36+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Release|ARM64.Build.0 = Release|ARM64
37+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Release|ARM64.Deploy.0 = Release|ARM64
38+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Release|x64.ActiveCfg = Release|x64
39+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Release|x64.Build.0 = Release|x64
40+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Release|x64.Deploy.0 = Release|x64
41+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Release|x86.ActiveCfg = Release|x86
42+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Release|x86.Build.0 = Release|x86
43+
{E667FBF4-30F2-49AC-8576-7A2B867F8F1A}.Release|x86.Deploy.0 = Release|x86
44+
EndGlobalSection
45+
GlobalSection(SolutionProperties) = preSolution
46+
HideSolutionNode = FALSE
47+
EndGlobalSection
48+
GlobalSection(ExtensibilityGlobals) = postSolution
49+
SolutionGuid = {707C727C-5ABD-4235-AEC4-3F2949BCA5DD}
50+
EndGlobalSection
51+
EndGlobal
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Application
2+
x:Class="MvvmSampleUwp.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
6+
RequestedTheme="Dark">
7+
<Application.Resources>
8+
<ResourceDictionary>
9+
10+
<!--Resource dictionaries-->
11+
<ResourceDictionary.MergedDictionaries>
12+
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/>
13+
<ResourceDictionary Source="Controls/InteractiveSample.xaml"/>
14+
</ResourceDictionary.MergedDictionaries>
15+
16+
<!--MarkdownTextBlock style-->
17+
<Style TargetType="controls:MarkdownTextBlock">
18+
<Setter Property="Background" Value="#60222222"/>
19+
<Setter Property="Padding" Value="8"/>
20+
<Setter Property="Header2FontWeight" Value="Bold" />
21+
<Setter Property="Header2FontSize" Value="20" />
22+
<Setter Property="Header2Margin" Value="0, 15, 0, 15" />
23+
<Setter Property="Header2Foreground" Value="{ThemeResource DefaultTextForegroundThemeBrush}" />
24+
</Style>
25+
</ResourceDictionary>
26+
</Application.Resources>
27+
</Application>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using Windows.ApplicationModel.Activation;
6+
using Windows.ApplicationModel.Core;
7+
using Windows.UI.Xaml;
8+
using Microsoft.Extensions.DependencyInjection;
9+
using Microsoft.Toolkit.Mvvm.DependencyInjection;
10+
using MvvmSampleUwp.Helpers;
11+
using MvvmSampleUwp.Services;
12+
using Refit;
13+
14+
namespace MvvmSampleUwp
15+
{
16+
/// <summary>
17+
/// Provides application-specific behavior to supplement the default <see cref="Application"/> class.
18+
/// </summary>
19+
sealed partial class App : Application
20+
{
21+
/// <summary>
22+
/// Initializes the singleton application object. This is the first line of authored code
23+
/// executed, and as such is the logical equivalent of main() or WinMain().
24+
/// </summary>
25+
public App()
26+
{
27+
this.InitializeComponent();
28+
}
29+
30+
/// <inheritdoc/>
31+
protected override void OnLaunched(LaunchActivatedEventArgs e)
32+
{
33+
// Ensure the UI is initialized
34+
if (Window.Current.Content is null)
35+
{
36+
Window.Current.Content = new Shell();
37+
38+
TitleBarHelper.StyleTitleBar();
39+
TitleBarHelper.ExpandViewIntoTitleBar();
40+
41+
// Register services
42+
Ioc.Default.ConfigureServices(services =>
43+
{
44+
services.AddSingleton<IFilesService, FilesService>();
45+
services.AddSingleton<ISettingsService, SettingsService>();
46+
services.AddSingleton(RestService.For<IRedditService>("https://www.reddit.com/"));
47+
});
48+
}
49+
50+
// Enable the prelaunch if needed, and activate the window
51+
if (e.PrelaunchActivated == false)
52+
{
53+
CoreApplication.EnablePrelaunch(true);
54+
55+
Window.Current.Activate();
56+
}
57+
}
58+
}
59+
}
2.33 KB
2.63 KB
3.44 KB
5.05 KB

0 commit comments

Comments
 (0)