This commit is contained in:
Mike Battista 2022-06-13 14:55:23 -07:00
Родитель 2806aff47d
Коммит e91449b4f2
164 изменённых файлов: 0 добавлений и 8056 удалений

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

@ -1,40 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26206.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MixedNavigationSample.CodeBehind", "MixedNavigationSample.CodeBehind\MixedNavigationSample.CodeBehind.csproj", "{B1444D8C-D360-4739-8D85-84848BD08F7A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution {B1444D8C-D360-4739-8D85-84848BD08F7A}.Debug|ARM.ActiveCfg = Debug|ARM
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Debug|ARM.Build.0 = Debug|ARM
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Debug|ARM.Deploy.0 = Debug|ARM
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Debug|x64.ActiveCfg = Debug|x64
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Debug|x64.Build.0 = Debug|x64
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Debug|x64.Deploy.0 = Debug|x64
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Debug|x86.ActiveCfg = Debug|x86
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Debug|x86.Build.0 = Debug|x86
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Debug|x86.Deploy.0 = Debug|x86
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Release|ARM.ActiveCfg = Release|ARM
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Release|ARM.Build.0 = Release|ARM
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Release|ARM.Deploy.0 = Release|ARM
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Release|x64.ActiveCfg = Release|x64
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Release|x64.Build.0 = Release|x64
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Release|x64.Deploy.0 = Release|x64
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Release|x86.ActiveCfg = Release|x86
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Release|x86.Build.0 = Release|x86
{B1444D8C-D360-4739-8D85-84848BD08F7A}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

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

@ -1,11 +0,0 @@
# top-most EditorConfig file
root = true
[*]
end_of_line = crlf
[*.{cs,xaml}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

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

@ -1,34 +0,0 @@
using System;
using System.Threading.Tasks;
namespace MixedNavigationSample.CodeBehind.Activation
{
// For more information on application activation see https://github.com/microsoft/TemplateStudio/blob/main/docs/UWP/activation.md
internal abstract class ActivationHandler
{
public abstract bool CanHandle(object args);
public abstract Task HandleAsync(object args);
}
internal abstract class ActivationHandler<T> : ActivationHandler
where T : class
{
protected abstract Task HandleInternalAsync(T args);
public override async Task HandleAsync(object args)
{
await HandleInternalAsync(args as T);
}
public override bool CanHandle(object args)
{
return args is T && CanHandleInternal(args as T);
}
protected virtual bool CanHandleInternal(T args)
{
return true;
}
}
}

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

@ -1,35 +0,0 @@
using System;
using System.Threading.Tasks;
using MixedNavigationSample.CodeBehind.Services;
using Windows.ApplicationModel.Activation;
namespace MixedNavigationSample.CodeBehind.Activation
{
internal class DefaultLaunchActivationHandler : ActivationHandler<LaunchActivatedEventArgs>
{
private readonly Type _navElement;
public DefaultLaunchActivationHandler(Type navElement)
{
_navElement = navElement;
}
protected override async Task HandleInternalAsync(LaunchActivatedEventArgs args)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
NavigationService.Navigate(_navElement, args.Arguments);
await Task.CompletedTask;
}
protected override bool CanHandleInternal(LaunchActivatedEventArgs args)
{
// None of the ActivationHandlers has handled the app activation
return NavigationService.Frame.Content == null;
}
}
}

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

@ -1,14 +0,0 @@
<Application
x:Class="MixedNavigationSample.CodeBehind.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Styles/TextBlock.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

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

@ -1,66 +0,0 @@
using System;
using MixedNavigationSample.CodeBehind.Services;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
namespace MixedNavigationSample.CodeBehind
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public sealed partial class App : Application
{
private Lazy<ActivationService> _activationService;
private ActivationService ActivationService
{
get { return _activationService.Value; }
}
/// <summary>
/// Initializes a new instance of the <see cref="App"/> class.
/// This is the first line of authored code executed, and as such
/// is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
InitializeComponent();
// Deferred execution until used. Check https://msdn.microsoft.com/library/dd642331(v=vs.110).aspx for further info on Lazy<T> class.
_activationService = new Lazy<ActivationService>(CreateActivationService);
}
/// <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)
{
if (!e.PrelaunchActivated)
{
await ActivationService.ActivateAsync(e);
}
}
/// <summary>
/// Invoked when the application is activated by some means other than normal launching.
/// </summary>
/// <param name="args">Event data for the event.</param>
protected override async void OnActivated(IActivatedEventArgs args)
{
await ActivationService.ActivateAsync(args);
}
private ActivationService CreateActivationService()
{
//This is the default navigation for a NavigationPane project type
//return new ActivationService(this, typeof(Views.HomePage), new Views.ShellPage());
//We are going to initialize navigation to a StartPage
return new ActivationService(this, typeof(Views.StartPage));
}
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.5 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.9 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.1 KiB

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

@ -1,38 +0,0 @@
using System;
using Windows.UI.Xaml.Data;
namespace MixedNavigationSample.CodeBehind.Helpers
{
public class EnumToBooleanConverter : IValueConverter
{
public Type EnumType { get; set; }
public object Convert(object value, Type targetType, object parameter, string language)
{
if (parameter is string enumString)
{
if (!Enum.IsDefined(EnumType, value))
{
throw new ArgumentException("value must be an Enum!");
}
var enumValue = Enum.Parse(EnumType, enumString);
return enumValue.Equals(value);
}
throw new ArgumentException("parameter must be an Enum name!");
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
if (parameter is string enumString)
{
return Enum.Parse(EnumType, enumString);
}
throw new ArgumentException("parameter must be an Enum name!");
}
}
}

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

@ -1,26 +0,0 @@
using System;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace MixedNavigationSample.CodeBehind.Helpers
{
public static class Json
{
public static async Task<T> ToObjectAsync<T>(string value)
{
return await Task.Run<T>(() =>
{
return JsonConvert.DeserializeObject<T>(value);
});
}
public static async Task<string> StringifyAsync(object value)
{
return await Task.Run<string>(() =>
{
return JsonConvert.SerializeObject(value);
});
}
}
}

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

@ -1,17 +0,0 @@
using System;
using System.Runtime.InteropServices;
using Windows.ApplicationModel.Resources;
namespace MixedNavigationSample.CodeBehind.Helpers
{
internal static class ResourceExtensions
{
private static ResourceLoader _resLoader = new ResourceLoader();
public static string GetLocalized(this string resourceKey)
{
return _resLoader.GetString(resourceKey);
}
}
}

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

@ -1,115 +0,0 @@
using System;
using System.IO;
using System.Threading.Tasks;
using Windows.Storage;
using Windows.Storage.Streams;
namespace MixedNavigationSample.CodeBehind.Helpers
{
// Use these extension methods to store and retrieve local and roaming app data
// For more info regarding storing and retrieving app data see documentation at
// https://docs.microsoft.com/windows/uwp/app-settings/store-and-retrieve-app-data
public static class SettingsStorageExtensions
{
private const string FileExtension = ".json";
public static bool IsRoamingStorageAvailable(this ApplicationData appData)
{
return appData.RoamingStorageQuota == 0;
}
public static async Task SaveAsync<T>(this StorageFolder folder, string name, T content)
{
var file = await folder.CreateFileAsync(GetFileName(name), CreationCollisionOption.ReplaceExisting);
var fileContent = await Json.StringifyAsync(content);
await FileIO.WriteTextAsync(file, fileContent);
}
public static async Task<T> ReadAsync<T>(this StorageFolder folder, string name)
{
if (!File.Exists(Path.Combine(folder.Path, GetFileName(name))))
{
return default(T);
}
var file = await folder.GetFileAsync($"{name}.json");
var fileContent = await FileIO.ReadTextAsync(file);
return await Json.ToObjectAsync<T>(fileContent);
}
public static async Task SaveAsync<T>(this ApplicationDataContainer settings, string key, T value)
{
settings.Values[key] = await Json.StringifyAsync(value);
}
public static async Task<T> ReadAsync<T>(this ApplicationDataContainer settings, string key)
{
object obj = null;
if (settings.Values.TryGetValue(key, out obj))
{
return await Json.ToObjectAsync<T>((string)obj);
}
return default(T);
}
public static async Task<StorageFile> SaveFileAsync(this StorageFolder folder, byte[] content, string fileName, CreationCollisionOption options = CreationCollisionOption.ReplaceExisting)
{
if (content == null)
{
throw new ArgumentNullException("content");
}
if (string.IsNullOrEmpty(fileName))
{
throw new ArgumentException("File name is null or empty. Specify a valid file name", "fileName");
}
var storageFile = await folder.CreateFileAsync(fileName, options);
await FileIO.WriteBytesAsync(storageFile, content);
return storageFile;
}
public static async Task<byte[]> ReadFileAsync(this StorageFolder folder, string fileName)
{
var item = await folder.TryGetItemAsync(fileName).AsTask().ConfigureAwait(false);
if ((item != null) && item.IsOfType(StorageItemTypes.File))
{
var storageFile = await folder.GetFileAsync(fileName);
byte[] content = await storageFile.ReadBytesAsync();
return content;
}
return null;
}
public static async Task<byte[]> ReadBytesAsync(this StorageFile file)
{
if (file != null)
{
using (IRandomAccessStream stream = await file.OpenReadAsync())
{
using (var reader = new DataReader(stream.GetInputStreamAt(0)))
{
await reader.LoadAsync((uint)stream.Size);
var bytes = new byte[stream.Size];
reader.ReadBytes(bytes);
return bytes;
}
}
}
return null;
}
private static string GetFileName(string name)
{
return string.Concat(name, FileExtension);
}
}
}

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

@ -1,19 +0,0 @@
using System;
using System.Collections.Concurrent;
namespace MixedNavigationSample.CodeBehind.Helpers
{
internal static class Singleton<T>
where T : new()
{
private static ConcurrentDictionary<Type, T> _instances = new ConcurrentDictionary<Type, T>();
public static T Instance
{
get
{
return _instances.GetOrAdd(typeof(T), (t) => new T());
}
}
}
}

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

@ -1,252 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{B1444D8C-D360-4739-8D85-84848BD08F7A}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MixedNavigationSample.CodeBehind</RootNamespace>
<AssemblyName>MixedNavigationSample.CodeBehind</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.16299.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
<PackageCertificateKeyFile>MixedNavigationSample.CodeBehind_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>NU1603;2008;</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>NU1603;2008;</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>NU1603;2008;</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>NU1603;2008;</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>NU1603;2008;</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>NU1603;2008;</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.0.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Xaml.Behaviors.Uwp.Managed">
<Version>2.0.0</Version>
</PackageReference>
<!-- Nuget package references -->
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls">
<Version>2.0.0</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>10.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PRIResource Include="Strings\en-us\Resources.resw" />
</ItemGroup>
<ItemGroup>
<Compile Include="Activation\ActivationHandler.cs" />
<Compile Include="Services\ActivationService.cs" />
<Compile Include="Activation\DefaultLaunchActivationHandler.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="Styles\_Colors.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
<Page Include="Styles\_FontSizes.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
<Page Include="Styles\_Thickness.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
<Page Include="Styles\TextBlock.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\ResourceExtensions.cs" />
<Compile Include="Helpers\Singleton.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
</ItemGroup>
<ItemGroup>
<Content Include="Properties\Default.rd.xml" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<None Include=".editorconfig" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<Content Include="MixedNavigationSample.CodeBehind_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<Page Include="Views\HomePage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Views\HomePage.xaml.cs">
<DependentUpon>HomePage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Include="Views\StartPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Views\StartPage.xaml.cs">
<DependentUpon>StartPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\EnumToBooleanConverter.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="Views\SettingsPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Views\SettingsPage.xaml.cs">
<DependentUpon>SettingsPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Services\ThemeSelectorService.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\SettingsStorageExtensions.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\Json.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Services\NavigationService.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Views\ShellNavigationItem.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="Views\ShellPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Views\ShellPage.xaml.cs">
<DependentUpon>ShellPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

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

@ -1,58 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:genTemplate="http://schemas.microsoft.com/appx/developer/templatestudio"
IgnorableNamespaces="uap mp genTemplate">
<Identity
Name="434882CE-E8F1-4CAE-B685-45DBD603B021"
Publisher="CN=mvega"
Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="434882CE-E8F1-4CAE-B685-45DBD603B021" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>MixedNavigationSample.CodeBehind</DisplayName>
<PublisherDisplayName>mvega</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="MixedNavigationSample.CodeBehind.App">
<uap:VisualElements
DisplayName="MixedNavigationSample.CodeBehind"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="MixedNavigationSample.CodeBehind"
BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
<genTemplate:Metadata>
<genTemplate:Item Name="generator" Value="Template Studio"/>
<genTemplate:Item Name="wizardVersion" Version="0.0.0.0" />
<genTemplate:Item Name="templatesVersion" Version="0.0.0.0" />
<genTemplate:Item Name="projectType" Value="SplitView" />
<genTemplate:Item Name="framework" Value="CodeBehind" />
</genTemplate:Metadata>
</Package>

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

@ -1,30 +0,0 @@
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MixedNavigationSample.CodeBehind")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MixedNavigationSample.CodeBehind")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

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

@ -1,31 +0,0 @@
<!--
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
developers. However, you can modify these parameters to modify the behavior of the .NET Native
optimizer.
Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919
To fully enable reflection for App1.MyClass and all of its public/private members
<Type Name="App1.MyClass" Dynamic="Required All"/>
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
<Namespace Name="DataClasses.ViewModels" Seralize="All" />
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
<!-- Add your application specific runtime directives here. -->
</Application>
</Directives>

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

@ -1,116 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MixedNavigationSample.CodeBehind.Activation;
using Windows.ApplicationModel.Activation;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace MixedNavigationSample.CodeBehind.Services
{
// For more information on application activation see https://github.com/microsoft/TemplateStudio/blob/main/docs/UWP/activation.md
internal class ActivationService
{
private readonly App _app;
private readonly UIElement _shell;
private readonly Type _defaultNavItem;
public ActivationService(App app, Type defaultNavItem, UIElement shell = null)
{
_app = app;
_shell = shell ?? new Frame();
_defaultNavItem = defaultNavItem;
}
public async Task ActivateAsync(object activationArgs)
{
if (IsInteractive(activationArgs))
{
// Initialize things like registering background task before the app is loaded
await InitializeAsync();
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (Window.Current.Content == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
Window.Current.Content = _shell;
NavigationService.NavigationFailed += (sender, e) =>
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
};
NavigationService.Navigated += Frame_Navigated;
if (SystemNavigationManager.GetForCurrentView() != null)
{
SystemNavigationManager.GetForCurrentView().BackRequested += ActivationService_BackRequested;
}
}
}
var activationHandler = GetActivationHandlers()
.FirstOrDefault(h => h.CanHandle(activationArgs));
if (activationHandler != null)
{
await activationHandler.HandleAsync(activationArgs);
}
if (IsInteractive(activationArgs))
{
var defaultHandler = new DefaultLaunchActivationHandler(_defaultNavItem);
if (defaultHandler.CanHandle(activationArgs))
{
await defaultHandler.HandleAsync(activationArgs);
}
// Ensure the current window is active
Window.Current.Activate();
// Tasks after activation
await StartupAsync();
}
}
private async Task InitializeAsync()
{
await ThemeSelectorService.InitializeAsync();
await Task.CompletedTask;
}
private async Task StartupAsync()
{
ThemeSelectorService.SetRequestedTheme();
await Task.CompletedTask;
}
private IEnumerable<ActivationHandler> GetActivationHandlers()
{
yield break;
}
private bool IsInteractive(object args)
{
return args is IActivatedEventArgs;
}
private void Frame_Navigated(object sender, NavigationEventArgs e)
{
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = NavigationService.CanGoBack ?
AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed;
}
private void ActivationService_BackRequested(object sender, BackRequestedEventArgs e)
{
if (NavigationService.CanGoBack)
{
NavigationService.GoBack();
e.Handled = true;
}
}
}
}

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

@ -1,86 +0,0 @@
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;
namespace MixedNavigationSample.CodeBehind.Services
{
public static class NavigationService
{
public static event NavigatedEventHandler Navigated;
public static event NavigationFailedEventHandler NavigationFailed;
private static Frame _frame;
public static Frame Frame
{
get
{
if (_frame == null)
{
_frame = Window.Current.Content as Frame;
RegisterFrameEvents();
}
return _frame;
}
set
{
UnregisterFrameEvents();
_frame = value;
RegisterFrameEvents();
}
}
public static bool CanGoBack => Frame.CanGoBack;
public static bool CanGoForward => Frame.CanGoForward;
public static void GoBack() => Frame.GoBack();
public static void GoForward() => Frame.GoForward();
public static bool Navigate(Type pageType, object parameter = null, NavigationTransitionInfo infoOverride = null)
{
// Don't open the same page multiple times
if (Frame.Content?.GetType() != pageType)
{
return Frame.Navigate(pageType, parameter, infoOverride);
}
else
{
return false;
}
}
public static bool Navigate<T>(object parameter = null, NavigationTransitionInfo infoOverride = null)
where T : Page
=> Navigate(typeof(T), parameter, infoOverride);
private static void RegisterFrameEvents()
{
if (_frame != null)
{
_frame.Navigated += Frame_Navigated;
_frame.NavigationFailed += Frame_NavigationFailed;
}
}
private static void UnregisterFrameEvents()
{
if (_frame != null)
{
_frame.Navigated -= Frame_Navigated;
_frame.NavigationFailed -= Frame_NavigationFailed;
}
}
private static void Frame_NavigationFailed(object sender, NavigationFailedEventArgs e) => NavigationFailed?.Invoke(sender, e);
private static void Frame_Navigated(object sender, NavigationEventArgs e) => Navigated?.Invoke(sender, e);
}
}

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

@ -1,68 +0,0 @@
using System;
using System.Threading.Tasks;
using MixedNavigationSample.CodeBehind.Helpers;
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
namespace MixedNavigationSample.CodeBehind.Services
{
public static class ThemeSelectorService
{
private const string SettingsKey = "RequestedTheme";
public static event EventHandler<ElementTheme> OnThemeChanged = (sender, args) => { };
public static ElementTheme Theme { get; set; } = ElementTheme.Default;
private static readonly SolidColorBrush _baseBrush = Application.Current.Resources["ThemeControlForegroundBaseHighBrush"] as SolidColorBrush;
public static SolidColorBrush GetSystemControlForegroundForTheme()
{
return _baseBrush;
}
public static async Task InitializeAsync()
{
Theme = await LoadThemeFromSettingsAsync();
}
public static async Task SetThemeAsync(ElementTheme theme)
{
Theme = theme;
SetRequestedTheme();
await SaveThemeInSettingsAsync(Theme);
OnThemeChanged(null, Theme);
}
public static void SetRequestedTheme()
{
if (Window.Current.Content is FrameworkElement frameworkElement)
{
frameworkElement.RequestedTheme = Theme;
}
}
private static async Task<ElementTheme> LoadThemeFromSettingsAsync()
{
ElementTheme cacheTheme = ElementTheme.Default;
string themeName = await ApplicationData.Current.LocalSettings.ReadAsync<string>(SettingsKey);
if (!string.IsNullOrEmpty(themeName))
{
Enum.TryParse(themeName, out cacheTheme);
}
return cacheTheme;
}
private static async Task SaveThemeInSettingsAsync(ElementTheme theme)
{
await ApplicationData.Current.LocalSettings.SaveAsync(SettingsKey, theme.ToString());
}
}
}

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

@ -1,186 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Home_Title.Text" xml:space="preserve">
<value>Home</value>
<comment>Page title for Home</comment>
</data>
<data name="Start_Title.Text" xml:space="preserve">
<value>Start</value>
<comment>Page title for Start</comment>
</data>
<data name="Settings_Title.Text" xml:space="preserve">
<value>Settings</value>
<comment>Page title for Settings</comment>
</data>
<data name="Settings_Theme.Text" xml:space="preserve">
<value>Choose Theme</value>
<comment>Choose theme text for Settings</comment>
</data>
<data name="Settings_Theme_Dark.Content" xml:space="preserve">
<value>Dark</value>
<comment>Dark theme text for Settings</comment>
</data>
<data name="Settings_Theme_Default.Content" xml:space="preserve">
<value>Windows default</value>
<comment>Windows default theme text for Settings</comment>
</data>
<data name="Settings_Theme_Light.Content" xml:space="preserve">
<value>Light</value>
<comment>Light theme text for Settings</comment>
</data>
<data name="Settings_About.Text" xml:space="preserve">
<value>About this application</value>
<comment>About this application title for Settings</comment>
</data>
<data name="Settings_AboutDescription.Text" xml:space="preserve">
<value>Settings page placeholder text. Your app description goes here.</value>
<comment>About this application description for Settings</comment>
</data>
<data name="Settings_PrivacyTermsLink.Content" xml:space="preserve">
<value>Privacy Statement</value>
<comment>Privacy Statement link content for Settings</comment>
</data>
<data name="Settings_PrivacyTermsLink.NavigateUri" xml:space="preserve">
<value>https://YourPrivacyUrlGoesHere/</value>
<comment>Here is your Privacy Statement url for Settings</comment>
</data>
<data name="Settings_Personalization.Text" xml:space="preserve">
<value>Personalization</value>
<comment>Personalization text for Settings</comment>
</data>
<data name="Shell_Home" xml:space="preserve">
<value>Home</value>
<comment>Navigation view item name for Home</comment>
</data>
<data name="Shell_Start" xml:space="preserve">
<value>Start</value>
<comment>Navigation view item name for Start</comment>
</data>
<data name="Shell_Settings" xml:space="preserve">
<value>Settings</value>
<comment>Navigation view item name for Settings</comment>
</data>
<data name="Start_Description.Text" xml:space="preserve">
<value>This is the application start page. Click Start to navigate.</value>
</data>
<data name="Start_StartButton.Content" xml:space="preserve">
<value>Start</value>
</data>
</root>

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

@ -1,44 +0,0 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Styles/_Colors.xaml"/>
<ResourceDictionary Source="/Styles/_FontSizes.xaml"/>
<ResourceDictionary Source="/Styles/_Thickness.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!--Common texts-->
<Style x:Key="PageTitleStyle" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontWeight" Value="SemiLight"/>
<Setter Property="FontSize" Value="{StaticResource LargeFontSize}"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="TextWrapping" Value="NoWrap"/>
<Setter Property="Margin" Value="{StaticResource PageTitleMargin}"/>
</Style>
<Style x:Key="BodyTextStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="FontSize" Value="{StaticResource MediumFontSize}"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
<!--List texts-->
<Style x:Key="ListTitleStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="FontSize" Value="{StaticResource MediumFontSize}"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="TextWrapping" Value="NoWrap"/>
</Style>
<Style x:Key="ListSubTitleStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="Opacity" Value="0.6"/>
<Setter Property="FontSize" Value="{StaticResource MediumFontSize}"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="TextWrapping" Value="NoWrap"/>
</Style>
</ResourceDictionary>

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

@ -1,5 +0,0 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="ThemeControlForegroundBaseHighBrush" Color="{ThemeResource SystemBaseHighColor}" />
</ResourceDictionary>

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

@ -1,8 +0,0 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:Double x:Key="LargeFontSize">28</x:Double>
<x:Double x:Key="MediumFontSize">16</x:Double>
</ResourceDictionary>

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

@ -1,15 +0,0 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!--Custom size margins-->
<Thickness x:Key="PageTitleMargin">0,0,12,7</Thickness>
<Thickness x:Key="SettingsSubheaderMargin">0, 20, 0, 48</Thickness>
<!--Medium size margins-->
<Thickness x:Key="MediumLeftRightMargin">12,0,12,0</Thickness>
<Thickness x:Key="MediumLeftTopRightBottomMargin">12,12,12,12</Thickness>
<!--Small size margins-->
<Thickness x:Key="EightTopMargin">0, 8, 0, 0</Thickness>
</ResourceDictionary>

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

@ -1,48 +0,0 @@
<Page
x:Class="MixedNavigationSample.CodeBehind.Views.HomePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid
x:Name="ContentArea"
Margin="{StaticResource MediumLeftRightMargin}">
<Grid.RowDefinitions>
<RowDefinition x:Name="TitleRow" Height="48"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock
x:Name="TitlePage"
x:Uid="Home_Title"
Text="Navigation Item 2"
Style="{StaticResource PageTitleStyle}" />
<Grid
Grid.Row="1"
Background="{ThemeResource SystemControlPageBackgroundChromeLowBrush}">
<!--The SystemControlPageBackgroundChromeLowBrush background represents where you should place your content.
Place your content here.-->
</Grid>
<!-- Adaptive triggers -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="WindowStates">
<VisualState x:Name="WideState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="640"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="NarrowState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="TitlePage.Margin" Value="48,0,12,7"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</Page>

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

@ -1,31 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.UI.Xaml.Controls;
namespace MixedNavigationSample.CodeBehind.Views
{
public sealed partial class HomePage : Page, INotifyPropertyChanged
{
public HomePage()
{
InitializeComponent();
}
public event PropertyChangedEventHandler PropertyChanged;
private void Set<T>(ref T storage, T value, [CallerMemberName]string propertyName = null)
{
if (Equals(storage, value))
{
return;
}
storage = value;
OnPropertyChanged(propertyName);
}
private void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}

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

@ -1,102 +0,0 @@
<Page
x:Class="MixedNavigationSample.CodeBehind.Views.SettingsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:helper="using:MixedNavigationSample.CodeBehind.Helpers"
xmlns:xaml="using:Windows.UI.Xaml"
mc:Ignorable="d">
<Page.Resources>
<helper:EnumToBooleanConverter x:Key="EnumToBooleanConverter" EnumType="ElementTheme" />
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Margin="{StaticResource MediumLeftRightMargin}">
<Grid.RowDefinitions>
<RowDefinition Height="48"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
x:Uid="Settings_Title"
x:Name="TitlePage"
Style="{StaticResource PageTitleStyle}" />
<StackPanel Grid.Row="1">
<TextBlock
x:Uid="Settings_Personalization"
Style="{StaticResource SubtitleTextBlockStyle}" />
<StackPanel Margin="{StaticResource SettingsSubheaderMargin}">
<TextBlock
x:Uid="Settings_Theme"
Style="{StaticResource BodyTextStyle}" />
<StackPanel Margin="{StaticResource EightTopMargin}">
<RadioButton
x:Uid="Settings_Theme_Light"
GroupName="AppTheme"
Checked="ThemeChanged_CheckedAsync"
IsChecked="{x:Bind ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Light, Mode=TwoWay}">
<RadioButton.CommandParameter>
<xaml:ElementTheme>Light</xaml:ElementTheme>
</RadioButton.CommandParameter>
</RadioButton>
<RadioButton
x:Uid="Settings_Theme_Dark"
GroupName="AppTheme"
Checked="ThemeChanged_CheckedAsync"
IsChecked="{x:Bind ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Dark, Mode=TwoWay}">
<RadioButton.CommandParameter>
<xaml:ElementTheme>Dark</xaml:ElementTheme>
</RadioButton.CommandParameter>
</RadioButton>
<RadioButton
x:Uid="Settings_Theme_Default"
GroupName="AppTheme"
Checked="ThemeChanged_CheckedAsync"
IsChecked="{x:Bind ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Default, Mode=TwoWay}">
<RadioButton.CommandParameter>
<xaml:ElementTheme>Default</xaml:ElementTheme>
</RadioButton.CommandParameter>
</RadioButton>
</StackPanel>
</StackPanel>
<TextBlock
x:Uid="Settings_About"
Style="{StaticResource SubtitleTextBlockStyle}"/>
<StackPanel Margin="{StaticResource EightTopMargin}">
<TextBlock
Text="{x:Bind VersionDescription, Mode=OneWay}" />
<TextBlock
x:Uid="Settings_AboutDescription"
Margin="{StaticResource EightTopMargin}" />
<HyperlinkButton
x:Uid="Settings_PrivacyTermsLink"
Margin="{StaticResource EightTopMargin}" />
</StackPanel>
</StackPanel>
</Grid>
<!-- Adaptive triggers -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="WindowStates">
<VisualState x:Name="WideState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="640"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="NarrowState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="TitlePage.Margin" Value="48,0,12,7"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</Page>

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

@ -1,86 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using MixedNavigationSample.CodeBehind.Services;
using Windows.ApplicationModel;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace MixedNavigationSample.CodeBehind.Views
{
public sealed partial class SettingsPage : Page, INotifyPropertyChanged
{
//// TODO: Add other settings as necessary. For help see https://github.com/microsoft/TemplateStudio/blob/main/docs/pages/settings-codebehind.md
//// TODO: Change the URL for your privacy policy in the Resource File, currently set to https://YourPrivacyUrlGoesHere
private ElementTheme _elementTheme = ThemeSelectorService.Theme;
public ElementTheme ElementTheme
{
get { return _elementTheme; }
set { Set(ref _elementTheme, value); }
}
private string _versionDescription;
public string VersionDescription
{
get { return _versionDescription; }
set { Set(ref _versionDescription, value); }
}
public SettingsPage()
{
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
Initialize();
}
private void Initialize()
{
VersionDescription = GetVersionDescription();
}
private string GetVersionDescription()
{
var package = Package.Current;
var packageId = package.Id;
var version = packageId.Version;
return $"{package.DisplayName} - {version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
}
private async void ThemeChanged_CheckedAsync(object sender, RoutedEventArgs e)
{
var param = (sender as RadioButton)?.CommandParameter;
if (param != null)
{
await ThemeSelectorService.SetThemeAsync((ElementTheme)param);
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void Set<T>(ref T storage, T value, [CallerMemberName]string propertyName = null)
{
if (Equals(storage, value))
{
return;
}
storage = value;
OnPropertyChanged(propertyName);
}
private void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}

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

@ -1,157 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using MixedNavigationSample.CodeBehind.Services;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;
namespace MixedNavigationSample.CodeBehind.Views
{
public class ShellNavigationItem : INotifyPropertyChanged
{
public string Label { get; set; }
public Symbol Symbol { get; set; }
public Type PageType { get; set; }
private Visibility _selectedVis = Visibility.Collapsed;
public Visibility SelectedVis
{
get { return _selectedVis; }
set { Set(ref _selectedVis, value); }
}
public char SymbolAsChar
{
get { return (char)Symbol; }
}
private IconElement _iconElement = null;
public IconElement Icon
{
get
{
var foregroundBinding = new Binding
{
Source = this,
Path = new PropertyPath("SelectedForeground"),
Mode = BindingMode.OneWay,
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
};
if (_iconElement != null)
{
BindingOperations.SetBinding(_iconElement, IconElement.ForegroundProperty, foregroundBinding);
return _iconElement;
}
var fontIcon = new FontIcon { FontSize = 16, Glyph = SymbolAsChar.ToString() };
BindingOperations.SetBinding(fontIcon, FontIcon.ForegroundProperty, foregroundBinding);
return fontIcon;
}
}
private bool _isSelected;
public bool IsSelected
{
get
{
return _isSelected;
}
set
{
Set(ref _isSelected, value);
SelectedVis = value ? Visibility.Visible : Visibility.Collapsed;
SelectedForeground = IsSelected
? Application.Current.Resources["SystemControlForegroundAccentBrush"] as SolidColorBrush
: GetStandardTextColorBrush();
}
}
private SolidColorBrush _selectedForeground = null;
public SolidColorBrush SelectedForeground
{
get { return _selectedForeground ?? (_selectedForeground = GetStandardTextColorBrush()); }
set { Set(ref _selectedForeground, value); }
}
private ShellNavigationItem(string label, Symbol symbol, Type pageType)
: this(label, pageType)
{
Symbol = symbol;
}
private ShellNavigationItem(string label, IconElement icon, Type pageType)
: this(label, pageType)
{
_iconElement = icon;
}
private ShellNavigationItem(string label, Type pageType)
{
Label = label;
PageType = pageType;
ThemeSelectorService.OnThemeChanged += (s, e) =>
{
if (!IsSelected)
{
SelectedForeground = GetStandardTextColorBrush();
}
};
}
public static ShellNavigationItem FromType<T>(string label, Symbol symbol)
where T : Page
{
return new ShellNavigationItem(label, symbol, typeof(T));
}
public static ShellNavigationItem FromType<T>(string label, IconElement icon)
where T : Page
{
return new ShellNavigationItem(label, icon, typeof(T));
}
private SolidColorBrush GetStandardTextColorBrush()
{
return ThemeSelectorService.GetSystemControlForegroundForTheme();
}
public override string ToString()
{
return Label;
}
public event PropertyChangedEventHandler PropertyChanged;
private void Set<T>(ref T storage, T value, [CallerMemberName]string propertyName = null)
{
if (Equals(storage, value))
{
return;
}
storage = value;
OnPropertyChanged(propertyName);
}
private void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}

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

@ -1,131 +0,0 @@
<Page
x:Class="MixedNavigationSample.CodeBehind.Views.ShellPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="using:MixedNavigationSample.CodeBehind.Views"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
<Page.Resources>
<DataTemplate x:Key="NavigationMenuItemDataTemplate" x:DataType="local:ShellNavigationItem">
<Grid Width="320" Height="40" Background="{ThemeResource SystemControlBackgroundAltHighBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="48" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Rectangle
Width="6"
Height="24"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Fill="{ThemeResource SystemControlForegroundAccentBrush}"
Visibility="{x:Bind SelectedVis, Mode=OneWay}" />
<Viewbox
Child="{x:Bind Icon}"
ToolTipService.ToolTip="{x:Bind Label}"
Margin="16,12"
VerticalAlignment="Center" />
<TextBlock
Grid.Column="1"
Margin="0,9,0,11"
VerticalAlignment="Center"
Foreground="{x:Bind SelectedForeground, Mode=OneWay}"
Text="{x:Bind Label}"
Style="{StaticResource BodyTextBlockStyle}"
TextTrimming="None" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="ContentPresenter" />
</Storyboard>
</VisualState>
<VisualState x:Name="PointerOver">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="BorderBackground"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderBackground" Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListLowBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}" />
</ObjectAnimationUsingKeyFrames>
<PointerUpThemeAnimation Storyboard.TargetName="ContentPresenter" />
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="BorderBackground"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderBackground" Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListMediumBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}" />
</ObjectAnimationUsingKeyFrames>
<PointerDownThemeAnimation TargetName="ContentPresenter" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="DisabledStates">
<VisualState x:Name="Enabled" />
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="ContentBorder"
Storyboard.TargetProperty="Opacity"
To="{ThemeResource ListViewItemDisabledThemeOpacity}"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</DataTemplate>
</Page.Resources>
<controls:HamburgerMenu
x:Name="NavigationMenu"
DisplayMode="{x:Bind DisplayMode, Mode=OneWay}"
IsPaneOpen="{x:Bind IsPaneOpen, Mode=TwoWay}"
ItemTemplate="{StaticResource NavigationMenuItemDataTemplate}"
ItemsSource="{x:Bind PrimaryItems}"
OptionsItemTemplate="{StaticResource NavigationMenuItemDataTemplate}"
OptionsItemsSource="{x:Bind SecondaryItems}"
ItemClick="ItemClicked"
OptionsItemClick="ItemClicked"
PaneBackground="{ThemeResource SystemControlBackgroundAltHighBrush}"
PaneForeground="{ThemeResource SystemControlForegroundBaseHighBrush}"
>
<Grid Background="{ThemeResource SystemControlBackgroundAltHighBrush}">
<Frame x:Name="shellFrame"/>
</Grid>
<!-- Adaptive triggers -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="WindowStates" CurrentStateChanged="WindowStates_CurrentStateChanged">
<VisualState x:Name="PanoramicState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="1024"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="WideState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="640"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="NarrowState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</controls:HamburgerMenu>
</Page>

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

@ -1,192 +0,0 @@
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using MixedNavigationSample.CodeBehind.Helpers;
using MixedNavigationSample.CodeBehind.Services;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace MixedNavigationSample.CodeBehind.Views
{
public sealed partial class ShellPage : Page, INotifyPropertyChanged
{
private const string PanoramicStateName = "PanoramicState";
private const string WideStateName = "WideState";
private const string NarrowStateName = "NarrowState";
private const double WideStateMinWindowWidth = 640;
private const double PanoramicStateMinWindowWidth = 1024;
private bool _isPaneOpen;
public bool IsPaneOpen
{
get { return _isPaneOpen; }
set { Set(ref _isPaneOpen, value); }
}
private SplitViewDisplayMode _displayMode = SplitViewDisplayMode.CompactInline;
public SplitViewDisplayMode DisplayMode
{
get { return _displayMode; }
set { Set(ref _displayMode, value); }
}
private object _lastSelectedItem;
private ObservableCollection<ShellNavigationItem> _primaryItems = new ObservableCollection<ShellNavigationItem>();
public ObservableCollection<ShellNavigationItem> PrimaryItems
{
get { return _primaryItems; }
set { Set(ref _primaryItems, value); }
}
private ObservableCollection<ShellNavigationItem> _secondaryItems = new ObservableCollection<ShellNavigationItem>();
public ObservableCollection<ShellNavigationItem> SecondaryItems
{
get { return _secondaryItems; }
set { Set(ref _secondaryItems, value); }
}
public ShellPage()
{
InitializeComponent();
DataContext = this;
Initialize();
}
private void Initialize()
{
NavigationService.Frame = shellFrame;
NavigationService.Navigated += Frame_Navigated;
PopulateNavItems();
InitializeState(Window.Current.Bounds.Width);
}
private void InitializeState(double windowWith)
{
if (windowWith < WideStateMinWindowWidth)
{
GoToState(NarrowStateName);
}
else if (windowWith < PanoramicStateMinWindowWidth)
{
GoToState(WideStateName);
}
else
{
GoToState(PanoramicStateName);
}
}
private void PopulateNavItems()
{
_primaryItems.Clear();
_secondaryItems.Clear();
// TODO: Change the symbols for each item as appropriate for your app
// More on Segoe UI Symbol icons: https://docs.microsoft.com/windows/uwp/style/segoe-ui-symbol-font
// Or to use an IconElement instead of a Symbol see https://github.com/microsoft/TemplateStudio/blob/main/docs/UWP/projectTypes/navigationpane.md
// Edit String/en-US/Resources.resw: Add a menu item title for each page
_primaryItems.Add(ShellNavigationItem.FromType<HomePage>("Shell_Home".GetLocalized(), Symbol.Document));
_secondaryItems.Add(ShellNavigationItem.FromType<SettingsPage>("Shell_Settings".GetLocalized(), Symbol.Setting));
}
private void Frame_Navigated(object sender, NavigationEventArgs e)
{
var navigationItem = PrimaryItems?.FirstOrDefault(i => i.PageType == e?.SourcePageType);
if (navigationItem == null)
{
navigationItem = SecondaryItems?.FirstOrDefault(i => i.PageType == e?.SourcePageType);
}
if (navigationItem != null)
{
ChangeSelected(_lastSelectedItem, navigationItem);
_lastSelectedItem = navigationItem;
}
}
private void ChangeSelected(object oldValue, object newValue)
{
if (oldValue != null)
{
(oldValue as ShellNavigationItem).IsSelected = false;
}
if (newValue != null)
{
(newValue as ShellNavigationItem).IsSelected = true;
}
}
private void Navigate(object item)
{
var navigationItem = item as ShellNavigationItem;
if (navigationItem != null)
{
NavigationService.Navigate(navigationItem.PageType);
}
}
private void ItemClicked(object sender, ItemClickEventArgs e)
{
if (DisplayMode == SplitViewDisplayMode.CompactOverlay || DisplayMode == SplitViewDisplayMode.Overlay)
{
IsPaneOpen = false;
}
Navigate(e.ClickedItem);
}
private void OpenPane_Click(object sender, RoutedEventArgs e)
{
IsPaneOpen = !_isPaneOpen;
}
private void WindowStates_CurrentStateChanged(object sender, VisualStateChangedEventArgs e) => GoToState(e.NewState.Name);
private void GoToState(string stateName)
{
switch (stateName)
{
case PanoramicStateName:
DisplayMode = SplitViewDisplayMode.CompactInline;
break;
case WideStateName:
DisplayMode = SplitViewDisplayMode.CompactInline;
IsPaneOpen = false;
break;
case NarrowStateName:
DisplayMode = SplitViewDisplayMode.Overlay;
IsPaneOpen = false;
break;
default:
break;
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void Set<T>(ref T storage, T value, [CallerMemberName]string propertyName = null)
{
if (Equals(storage, value))
{
return;
}
storage = value;
OnPropertyChanged(propertyName);
}
private void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}

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

@ -1,48 +0,0 @@
<Page
x:Class="MixedNavigationSample.CodeBehind.Views.StartPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid
x:Name="ContentArea"
Margin="{StaticResource MediumLeftRightMargin}">
<Grid.RowDefinitions>
<RowDefinition x:Name="TitleRow" Height="48"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock
x:Name="TitlePage"
x:Uid="Start_Title"
Text="Navigation Item 2"
Style="{StaticResource PageTitleStyle}" />
<Grid Grid.Row="1" >
<StackPanel Margin="0,12">
<TextBlock x:Uid="Start_Description"/>
<Button x:Uid="Start_StartButton" Margin="0,18,0,0" Click="StartButton_Click"/>
</StackPanel>
</Grid>
<!-- Adaptive triggers -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="WindowStates">
<VisualState x:Name="WideState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="640"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="NarrowState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="TitlePage.Margin" Value="48,0,12,7"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</Page>

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

@ -1,41 +0,0 @@
using MixedNavigationSample.CodeBehind.Services;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.UI.Xaml.Controls;
namespace MixedNavigationSample.CodeBehind.Views
{
public sealed partial class StartPage : Page, INotifyPropertyChanged
{
public StartPage()
{
InitializeComponent();
}
public event PropertyChangedEventHandler PropertyChanged;
private void Set<T>(ref T storage, T value, [CallerMemberName]string propertyName = null)
{
if (Equals(storage, value))
{
return;
}
storage = value;
OnPropertyChanged(propertyName);
}
private void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
private void StartButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
//Navigating to a ShellPage, this will replaces NavigationService frame for an inner frame to change navigation handling.
NavigationService.Navigate<Views.ShellPage>();
//Navigating now to a HomePage, this will be the first navigation on a NavigationPane menu
NavigationService.Navigate<Views.HomePage>();
}
}
}

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

@ -1,40 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26206.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MixedNavigationSample.MVVMBasic", "MixedNavigationSample.MVVMBasic\MixedNavigationSample.MVVMBasic.csproj", "{C892F1B8-5318-453B-8C5F-817A59F9E35E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution {C892F1B8-5318-453B-8C5F-817A59F9E35E}.Debug|ARM.ActiveCfg = Debug|ARM
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Debug|ARM.Build.0 = Debug|ARM
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Debug|ARM.Deploy.0 = Debug|ARM
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Debug|x64.ActiveCfg = Debug|x64
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Debug|x64.Build.0 = Debug|x64
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Debug|x64.Deploy.0 = Debug|x64
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Debug|x86.ActiveCfg = Debug|x86
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Debug|x86.Build.0 = Debug|x86
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Debug|x86.Deploy.0 = Debug|x86
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Release|ARM.ActiveCfg = Release|ARM
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Release|ARM.Build.0 = Release|ARM
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Release|ARM.Deploy.0 = Release|ARM
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Release|x64.ActiveCfg = Release|x64
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Release|x64.Build.0 = Release|x64
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Release|x64.Deploy.0 = Release|x64
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Release|x86.ActiveCfg = Release|x86
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Release|x86.Build.0 = Release|x86
{C892F1B8-5318-453B-8C5F-817A59F9E35E}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

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

@ -1,11 +0,0 @@
# top-most EditorConfig file
root = true
[*]
end_of_line = crlf
[*.{cs,xaml}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

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

@ -1,34 +0,0 @@
using System;
using System.Threading.Tasks;
namespace MixedNavigationSample.MVVMBasic.Activation
{
// For more information on application activation see https://github.com/microsoft/TemplateStudio/blob/main/docs/UWP/activation.md
internal abstract class ActivationHandler
{
public abstract bool CanHandle(object args);
public abstract Task HandleAsync(object args);
}
internal abstract class ActivationHandler<T> : ActivationHandler
where T : class
{
protected abstract Task HandleInternalAsync(T args);
public override async Task HandleAsync(object args)
{
await HandleInternalAsync(args as T);
}
public override bool CanHandle(object args)
{
return args is T && CanHandleInternal(args as T);
}
protected virtual bool CanHandleInternal(T args)
{
return true;
}
}
}

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

@ -1,35 +0,0 @@
using System;
using System.Threading.Tasks;
using MixedNavigationSample.MVVMBasic.Services;
using Windows.ApplicationModel.Activation;
namespace MixedNavigationSample.MVVMBasic.Activation
{
internal class DefaultLaunchActivationHandler : ActivationHandler<LaunchActivatedEventArgs>
{
private readonly Type _navElement;
public DefaultLaunchActivationHandler(Type navElement)
{
_navElement = navElement;
}
protected override async Task HandleInternalAsync(LaunchActivatedEventArgs args)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
NavigationService.Navigate(_navElement, args.Arguments);
await Task.CompletedTask;
}
protected override bool CanHandleInternal(LaunchActivatedEventArgs args)
{
// None of the ActivationHandlers has handled the app activation
return NavigationService.Frame.Content == null;
}
}
}

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

@ -1,14 +0,0 @@
<Application
x:Class="MixedNavigationSample.MVVMBasic.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Styles/TextBlock.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

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

@ -1,66 +0,0 @@
using System;
using MixedNavigationSample.MVVMBasic.Services;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
namespace MixedNavigationSample.MVVMBasic
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public sealed partial class App : Application
{
private Lazy<ActivationService> _activationService;
private ActivationService ActivationService
{
get { return _activationService.Value; }
}
/// <summary>
/// Initializes a new instance of the <see cref="App"/> class.
/// This is the first line of authored code executed, and as such
/// is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
InitializeComponent();
// Deferred execution until used. Check https://msdn.microsoft.com/library/dd642331(v=vs.110).aspx for further info on Lazy<T> class.
_activationService = new Lazy<ActivationService>(CreateActivationService);
}
/// <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)
{
if (!e.PrelaunchActivated)
{
await ActivationService.ActivateAsync(e);
}
}
/// <summary>
/// Invoked when the application is activated by some means other than normal launching.
/// </summary>
/// <param name="args">Event data for the event.</param>
protected override async void OnActivated(IActivatedEventArgs args)
{
await ActivationService.ActivateAsync(args);
}
private ActivationService CreateActivationService()
{
//This is the default navigation for a NavigationPane project type
//return new ActivationService(this, typeof(Views.HomePage), new Views.ShellPage());
//We are going to initialize navigation to a StartPage
return new ActivationService(this, typeof(Views.StartPage));
}
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.5 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.9 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.1 KiB

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

@ -1,38 +0,0 @@
using System;
using Windows.UI.Xaml.Data;
namespace MixedNavigationSample.MVVMBasic.Helpers
{
public class EnumToBooleanConverter : IValueConverter
{
public Type EnumType { get; set; }
public object Convert(object value, Type targetType, object parameter, string language)
{
if (parameter is string enumString)
{
if (!Enum.IsDefined(EnumType, value))
{
throw new ArgumentException("value must be an Enum!");
}
var enumValue = Enum.Parse(EnumType, enumString);
return enumValue.Equals(value);
}
throw new ArgumentException("parameter must be an Enum name!");
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
if (parameter is string enumString)
{
return Enum.Parse(EnumType, enumString);
}
throw new ArgumentException("parameter must be an Enum name!");
}
}
}

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

@ -1,26 +0,0 @@
using System;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace MixedNavigationSample.MVVMBasic.Helpers
{
public static class Json
{
public static async Task<T> ToObjectAsync<T>(string value)
{
return await Task.Run<T>(() =>
{
return JsonConvert.DeserializeObject<T>(value);
});
}
public static async Task<string> StringifyAsync(object value)
{
return await Task.Run<string>(() =>
{
return JsonConvert.SerializeObject(value);
});
}
}
}

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

@ -1,24 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace MixedNavigationSample.MVVMBasic.Helpers
{
public class Observable : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void Set<T>(ref T storage, T value, [CallerMemberName]string propertyName = null)
{
if (Equals(storage, value))
{
return;
}
storage = value;
OnPropertyChanged(propertyName);
}
protected void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}

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

@ -1,57 +0,0 @@
using System;
using System.Windows.Input;
namespace MixedNavigationSample.MVVMBasic.Helpers
{
public class RelayCommand : ICommand
{
private readonly Action _execute;
private readonly Func<bool> _canExecute;
public event EventHandler CanExecuteChanged;
public RelayCommand(Action execute)
: this(execute, null)
{
}
public RelayCommand(Action execute, Func<bool> canExecute)
{
_execute = execute ?? throw new ArgumentNullException("execute");
_canExecute = canExecute;
}
public bool CanExecute(object parameter) => _canExecute == null || _canExecute();
public void Execute(object parameter) => _execute();
public void OnCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty);
}
public class RelayCommand<T> : ICommand
{
private readonly Action<T> _execute;
private readonly Func<T, bool> _canExecute;
public event EventHandler CanExecuteChanged;
public RelayCommand(Action<T> execute)
: this(execute, null)
{
}
public RelayCommand(Action<T> execute, Func<T, bool> canExecute)
{
_execute = execute ?? throw new ArgumentNullException("execute");
_canExecute = canExecute;
}
public bool CanExecute(object parameter) => _canExecute == null || _canExecute((T)parameter);
public void Execute(object parameter) => _execute((T)parameter);
public void OnCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty);
}
}

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

@ -1,17 +0,0 @@
using System;
using System.Runtime.InteropServices;
using Windows.ApplicationModel.Resources;
namespace MixedNavigationSample.MVVMBasic.Helpers
{
internal static class ResourceExtensions
{
private static ResourceLoader _resLoader = new ResourceLoader();
public static string GetLocalized(this string resourceKey)
{
return _resLoader.GetString(resourceKey);
}
}
}

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

@ -1,115 +0,0 @@
using System;
using System.IO;
using System.Threading.Tasks;
using Windows.Storage;
using Windows.Storage.Streams;
namespace MixedNavigationSample.MVVMBasic.Helpers
{
// Use these extension methods to store and retrieve local and roaming app data
// For more info regarding storing and retrieving app data see documentation at
// https://docs.microsoft.com/windows/uwp/app-settings/store-and-retrieve-app-data
public static class SettingsStorageExtensions
{
private const string FileExtension = ".json";
public static bool IsRoamingStorageAvailable(this ApplicationData appData)
{
return appData.RoamingStorageQuota == 0;
}
public static async Task SaveAsync<T>(this StorageFolder folder, string name, T content)
{
var file = await folder.CreateFileAsync(GetFileName(name), CreationCollisionOption.ReplaceExisting);
var fileContent = await Json.StringifyAsync(content);
await FileIO.WriteTextAsync(file, fileContent);
}
public static async Task<T> ReadAsync<T>(this StorageFolder folder, string name)
{
if (!File.Exists(Path.Combine(folder.Path, GetFileName(name))))
{
return default(T);
}
var file = await folder.GetFileAsync($"{name}.json");
var fileContent = await FileIO.ReadTextAsync(file);
return await Json.ToObjectAsync<T>(fileContent);
}
public static async Task SaveAsync<T>(this ApplicationDataContainer settings, string key, T value)
{
settings.Values[key] = await Json.StringifyAsync(value);
}
public static async Task<T> ReadAsync<T>(this ApplicationDataContainer settings, string key)
{
object obj = null;
if (settings.Values.TryGetValue(key, out obj))
{
return await Json.ToObjectAsync<T>((string)obj);
}
return default(T);
}
public static async Task<StorageFile> SaveFileAsync(this StorageFolder folder, byte[] content, string fileName, CreationCollisionOption options = CreationCollisionOption.ReplaceExisting)
{
if (content == null)
{
throw new ArgumentNullException("content");
}
if (string.IsNullOrEmpty(fileName))
{
throw new ArgumentException("File name is null or empty. Specify a valid file name", "fileName");
}
var storageFile = await folder.CreateFileAsync(fileName, options);
await FileIO.WriteBytesAsync(storageFile, content);
return storageFile;
}
public static async Task<byte[]> ReadFileAsync(this StorageFolder folder, string fileName)
{
var item = await folder.TryGetItemAsync(fileName).AsTask().ConfigureAwait(false);
if ((item != null) && item.IsOfType(StorageItemTypes.File))
{
var storageFile = await folder.GetFileAsync(fileName);
byte[] content = await storageFile.ReadBytesAsync();
return content;
}
return null;
}
public static async Task<byte[]> ReadBytesAsync(this StorageFile file)
{
if (file != null)
{
using (IRandomAccessStream stream = await file.OpenReadAsync())
{
using (var reader = new DataReader(stream.GetInputStreamAt(0)))
{
await reader.LoadAsync((uint)stream.Size);
var bytes = new byte[stream.Size];
reader.ReadBytes(bytes);
return bytes;
}
}
}
return null;
}
private static string GetFileName(string name)
{
return string.Concat(name, FileExtension);
}
}
}

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

@ -1,19 +0,0 @@
using System;
using System.Collections.Concurrent;
namespace MixedNavigationSample.MVVMBasic.Helpers
{
internal static class Singleton<T>
where T : new()
{
private static ConcurrentDictionary<Type, T> _instances = new ConcurrentDictionary<Type, T>();
public static T Instance
{
get
{
return _instances.GetOrAdd(typeof(T), (t) => new T());
}
}
}
}

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

@ -1,270 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{C892F1B8-5318-453B-8C5F-817A59F9E35E}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MixedNavigationSample.MVVMBasic</RootNamespace>
<AssemblyName>MixedNavigationSample.MVVMBasic</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.16299.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
<PackageCertificateKeyFile>MixedNavigationSample.MVVMBasic_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>NU1603;2008;</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>NU1603;2008;</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>NU1603;2008;</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>NU1603;2008;</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>NU1603;2008;</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>NU1603;2008;</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.0.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Xaml.Behaviors.Uwp.Managed">
<Version>2.0.0</Version>
</PackageReference>
<!-- Nuget package references -->
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls">
<Version>2.0.0</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>10.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PRIResource Include="Strings\en-us\Resources.resw" />
</ItemGroup>
<ItemGroup>
<Compile Include="Activation\ActivationHandler.cs" />
<Compile Include="Services\ActivationService.cs" />
<Compile Include="Activation\DefaultLaunchActivationHandler.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="Styles\_Colors.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
<Page Include="Styles\_FontSizes.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
<Page Include="Styles\_Thickness.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
<Page Include="Styles\TextBlock.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\ResourceExtensions.cs" />
<Compile Include="Helpers\Singleton.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
</ItemGroup>
<ItemGroup>
<Content Include="Properties\Default.rd.xml" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<None Include=".editorconfig" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<Content Include="MixedNavigationSample.MVVMBasic_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<Page Include="Views\HomePage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Views\HomePage.xaml.cs">
<DependentUpon>HomePage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="ViewModels\HomeViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="Views\StartPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Views\StartPage.xaml.cs">
<DependentUpon>StartPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="ViewModels\StartViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\EnumToBooleanConverter.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="Views\SettingsPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Views\SettingsPage.xaml.cs">
<DependentUpon>SettingsPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="ViewModels\SettingsViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Services\ThemeSelectorService.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\SettingsStorageExtensions.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\Json.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Services\NavigationService.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\Observable.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\RelayCommand.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="ViewModels\ShellNavigationItem.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="ViewModels\ShellViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="Views\ShellPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Views\ShellPage.xaml.cs">
<DependentUpon>ShellPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

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

@ -1,58 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:genTemplate="http://schemas.microsoft.com/appx/developer/templatestudio"
IgnorableNamespaces="uap mp genTemplate">
<Identity
Name="BD14335A-BB1A-4CF0-8DE2-84F1321969F4"
Publisher="CN=mvega"
Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="BD14335A-BB1A-4CF0-8DE2-84F1321969F4" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>MixedNavigationSample.MVVMBasic</DisplayName>
<PublisherDisplayName>mvega</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="MixedNavigationSample.MVVMBasic.App">
<uap:VisualElements
DisplayName="MixedNavigationSample.MVVMBasic"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="MixedNavigationSample.MVVMBasic"
BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
<genTemplate:Metadata>
<genTemplate:Item Name="generator" Value="Template Studio"/>
<genTemplate:Item Name="wizardVersion" Version="0.0.0.0" />
<genTemplate:Item Name="templatesVersion" Version="0.0.0.0" />
<genTemplate:Item Name="projectType" Value="SplitView" />
<genTemplate:Item Name="framework" Value="MVVMBasic" />
</genTemplate:Metadata>
</Package>

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

@ -1,30 +0,0 @@
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MixedNavigationSample.MVVMBasic")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MixedNavigationSample.MVVMBasic")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

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

@ -1,31 +0,0 @@
<!--
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
developers. However, you can modify these parameters to modify the behavior of the .NET Native
optimizer.
Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919
To fully enable reflection for App1.MyClass and all of its public/private members
<Type Name="App1.MyClass" Dynamic="Required All"/>
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
<Namespace Name="DataClasses.ViewModels" Seralize="All" />
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Application>
<!--
An Assembly element with Name="*Application*" applies to all assemblies in
the application package. The asterisks are not wildcards.
-->
<Assembly Name="*Application*" Dynamic="Required All" />
<!-- Add your application specific runtime directives here. -->
</Application>
</Directives>

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

@ -1,116 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MixedNavigationSample.MVVMBasic.Activation;
using Windows.ApplicationModel.Activation;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace MixedNavigationSample.MVVMBasic.Services
{
// For more information on application activation see https://github.com/microsoft/TemplateStudio/blob/main/docs/UWP/activation.md
internal class ActivationService
{
private readonly App _app;
private readonly UIElement _shell;
private readonly Type _defaultNavItem;
public ActivationService(App app, Type defaultNavItem, UIElement shell = null)
{
_app = app;
_shell = shell ?? new Frame();
_defaultNavItem = defaultNavItem;
}
public async Task ActivateAsync(object activationArgs)
{
if (IsInteractive(activationArgs))
{
// Initialize things like registering background task before the app is loaded
await InitializeAsync();
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (Window.Current.Content == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
Window.Current.Content = _shell;
NavigationService.NavigationFailed += (sender, e) =>
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
};
NavigationService.Navigated += Frame_Navigated;
if (SystemNavigationManager.GetForCurrentView() != null)
{
SystemNavigationManager.GetForCurrentView().BackRequested += ActivationService_BackRequested;
}
}
}
var activationHandler = GetActivationHandlers()
.FirstOrDefault(h => h.CanHandle(activationArgs));
if (activationHandler != null)
{
await activationHandler.HandleAsync(activationArgs);
}
if (IsInteractive(activationArgs))
{
var defaultHandler = new DefaultLaunchActivationHandler(_defaultNavItem);
if (defaultHandler.CanHandle(activationArgs))
{
await defaultHandler.HandleAsync(activationArgs);
}
// Ensure the current window is active
Window.Current.Activate();
// Tasks after activation
await StartupAsync();
}
}
private async Task InitializeAsync()
{
await ThemeSelectorService.InitializeAsync();
await Task.CompletedTask;
}
private async Task StartupAsync()
{
ThemeSelectorService.SetRequestedTheme();
await Task.CompletedTask;
}
private IEnumerable<ActivationHandler> GetActivationHandlers()
{
yield break;
}
private bool IsInteractive(object args)
{
return args is IActivatedEventArgs;
}
private void Frame_Navigated(object sender, NavigationEventArgs e)
{
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = NavigationService.CanGoBack ?
AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed;
}
private void ActivationService_BackRequested(object sender, BackRequestedEventArgs e)
{
if (NavigationService.CanGoBack)
{
NavigationService.GoBack();
e.Handled = true;
}
}
}
}

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

@ -1,86 +0,0 @@
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;
namespace MixedNavigationSample.MVVMBasic.Services
{
public static class NavigationService
{
public static event NavigatedEventHandler Navigated;
public static event NavigationFailedEventHandler NavigationFailed;
private static Frame _frame;
public static Frame Frame
{
get
{
if (_frame == null)
{
_frame = Window.Current.Content as Frame;
RegisterFrameEvents();
}
return _frame;
}
set
{
UnregisterFrameEvents();
_frame = value;
RegisterFrameEvents();
}
}
public static bool CanGoBack => Frame.CanGoBack;
public static bool CanGoForward => Frame.CanGoForward;
public static void GoBack() => Frame.GoBack();
public static void GoForward() => Frame.GoForward();
public static bool Navigate(Type pageType, object parameter = null, NavigationTransitionInfo infoOverride = null)
{
// Don't open the same page multiple times
if (Frame.Content?.GetType() != pageType)
{
return Frame.Navigate(pageType, parameter, infoOverride);
}
else
{
return false;
}
}
public static bool Navigate<T>(object parameter = null, NavigationTransitionInfo infoOverride = null)
where T : Page
=> Navigate(typeof(T), parameter, infoOverride);
private static void RegisterFrameEvents()
{
if (_frame != null)
{
_frame.Navigated += Frame_Navigated;
_frame.NavigationFailed += Frame_NavigationFailed;
}
}
private static void UnregisterFrameEvents()
{
if (_frame != null)
{
_frame.Navigated -= Frame_Navigated;
_frame.NavigationFailed -= Frame_NavigationFailed;
}
}
private static void Frame_NavigationFailed(object sender, NavigationFailedEventArgs e) => NavigationFailed?.Invoke(sender, e);
private static void Frame_Navigated(object sender, NavigationEventArgs e) => Navigated?.Invoke(sender, e);
}
}

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

@ -1,68 +0,0 @@
using System;
using System.Threading.Tasks;
using MixedNavigationSample.MVVMBasic.Helpers;
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
namespace MixedNavigationSample.MVVMBasic.Services
{
public static class ThemeSelectorService
{
private const string SettingsKey = "RequestedTheme";
public static event EventHandler<ElementTheme> OnThemeChanged = (sender, args) => { };
public static ElementTheme Theme { get; set; } = ElementTheme.Default;
private static readonly SolidColorBrush _baseBrush = Application.Current.Resources["ThemeControlForegroundBaseHighBrush"] as SolidColorBrush;
public static SolidColorBrush GetSystemControlForegroundForTheme()
{
return _baseBrush;
}
public static async Task InitializeAsync()
{
Theme = await LoadThemeFromSettingsAsync();
}
public static async Task SetThemeAsync(ElementTheme theme)
{
Theme = theme;
SetRequestedTheme();
await SaveThemeInSettingsAsync(Theme);
OnThemeChanged(null, Theme);
}
public static void SetRequestedTheme()
{
if (Window.Current.Content is FrameworkElement frameworkElement)
{
frameworkElement.RequestedTheme = Theme;
}
}
private static async Task<ElementTheme> LoadThemeFromSettingsAsync()
{
ElementTheme cacheTheme = ElementTheme.Default;
string themeName = await ApplicationData.Current.LocalSettings.ReadAsync<string>(SettingsKey);
if (!string.IsNullOrEmpty(themeName))
{
Enum.TryParse(themeName, out cacheTheme);
}
return cacheTheme;
}
private static async Task SaveThemeInSettingsAsync(ElementTheme theme)
{
await ApplicationData.Current.LocalSettings.SaveAsync(SettingsKey, theme.ToString());
}
}
}

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

@ -1,186 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Home_Title.Text" xml:space="preserve">
<value>Home</value>
<comment>Page title for Home</comment>
</data>
<data name="Start_Title.Text" xml:space="preserve">
<value>Start</value>
<comment>Page title for Start</comment>
</data>
<data name="Settings_Title.Text" xml:space="preserve">
<value>Settings</value>
<comment>Page title for Settings</comment>
</data>
<data name="Settings_Theme.Text" xml:space="preserve">
<value>Choose Theme</value>
<comment>Choose theme text for Settings</comment>
</data>
<data name="Settings_Theme_Dark.Content" xml:space="preserve">
<value>Dark</value>
<comment>Dark theme text for Settings</comment>
</data>
<data name="Settings_Theme_Default.Content" xml:space="preserve">
<value>Windows default</value>
<comment>Windows default theme text for Settings</comment>
</data>
<data name="Settings_Theme_Light.Content" xml:space="preserve">
<value>Light</value>
<comment>Light theme text for Settings</comment>
</data>
<data name="Settings_About.Text" xml:space="preserve">
<value>About this application</value>
<comment>About this application title for Settings</comment>
</data>
<data name="Settings_AboutDescription.Text" xml:space="preserve">
<value>Settings page placeholder text. Your app description goes here.</value>
<comment>About this application description for Settings</comment>
</data>
<data name="Settings_PrivacyTermsLink.Content" xml:space="preserve">
<value>Privacy Statement</value>
<comment>Privacy Statement link content for Settings</comment>
</data>
<data name="Settings_PrivacyTermsLink.NavigateUri" xml:space="preserve">
<value>https://YourPrivacyUrlGoesHere/</value>
<comment>Here is your Privacy Statement url for Settings</comment>
</data>
<data name="Settings_Personalization.Text" xml:space="preserve">
<value>Personalization</value>
<comment>Personalization text for Settings</comment>
</data>
<data name="Shell_Home" xml:space="preserve">
<value>Home</value>
<comment>Navigation view item name for Home</comment>
</data>
<data name="Shell_Start" xml:space="preserve">
<value>Start</value>
<comment>Navigation view item name for Start</comment>
</data>
<data name="Shell_Settings" xml:space="preserve">
<value>Settings</value>
<comment>Navigation view item name for Settings</comment>
</data>
<data name="Start_Description.Text" xml:space="preserve">
<value>This is the application start page. Click Start to navigate.</value>
</data>
<data name="Start_StartButton.Content" xml:space="preserve">
<value>Start</value>
</data>
</root>

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

@ -1,44 +0,0 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Styles/_Colors.xaml"/>
<ResourceDictionary Source="/Styles/_FontSizes.xaml"/>
<ResourceDictionary Source="/Styles/_Thickness.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!--Common texts-->
<Style x:Key="PageTitleStyle" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontWeight" Value="SemiLight"/>
<Setter Property="FontSize" Value="{StaticResource LargeFontSize}"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="TextWrapping" Value="NoWrap"/>
<Setter Property="Margin" Value="{StaticResource PageTitleMargin}"/>
</Style>
<Style x:Key="BodyTextStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="FontSize" Value="{StaticResource MediumFontSize}"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
<!--List texts-->
<Style x:Key="ListTitleStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="FontSize" Value="{StaticResource MediumFontSize}"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="TextWrapping" Value="NoWrap"/>
</Style>
<Style x:Key="ListSubTitleStyle" TargetType="TextBlock">
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="Opacity" Value="0.6"/>
<Setter Property="FontSize" Value="{StaticResource MediumFontSize}"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Setter Property="TextWrapping" Value="NoWrap"/>
</Style>
</ResourceDictionary>

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

@ -1,5 +0,0 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="ThemeControlForegroundBaseHighBrush" Color="{ThemeResource SystemBaseHighColor}" />
</ResourceDictionary>

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

@ -1,8 +0,0 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:Double x:Key="LargeFontSize">28</x:Double>
<x:Double x:Key="MediumFontSize">16</x:Double>
</ResourceDictionary>

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

@ -1,15 +0,0 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!--Custom size margins-->
<Thickness x:Key="PageTitleMargin">0,0,12,7</Thickness>
<Thickness x:Key="SettingsSubheaderMargin">0, 20, 0, 48</Thickness>
<!--Medium size margins-->
<Thickness x:Key="MediumLeftRightMargin">12,0,12,0</Thickness>
<Thickness x:Key="MediumLeftTopRightBottomMargin">12,12,12,12</Thickness>
<!--Small size margins-->
<Thickness x:Key="EightTopMargin">0, 8, 0, 0</Thickness>
</ResourceDictionary>

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

@ -1,13 +0,0 @@
using System;
using MixedNavigationSample.MVVMBasic.Helpers;
namespace MixedNavigationSample.MVVMBasic.ViewModels
{
public class HomeViewModel : Observable
{
public HomeViewModel()
{
}
}
}

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

@ -1,70 +0,0 @@
using System;
using System.Windows.Input;
using MixedNavigationSample.MVVMBasic.Helpers;
using MixedNavigationSample.MVVMBasic.Services;
using Windows.ApplicationModel;
using Windows.UI.Xaml;
namespace MixedNavigationSample.MVVMBasic.ViewModels
{
public class SettingsViewModel : Observable
{
// TODO: Add other settings as necessary. For help see https://github.com/microsoft/TemplateStudio/blob/main/docs/pages/settings.md
private ElementTheme _elementTheme = ThemeSelectorService.Theme;
public ElementTheme ElementTheme
{
get { return _elementTheme; }
set { Set(ref _elementTheme, value); }
}
private string _versionDescription;
public string VersionDescription
{
get { return _versionDescription; }
set { Set(ref _versionDescription, value); }
}
private ICommand _switchThemeCommand;
public ICommand SwitchThemeCommand
{
get
{
if (_switchThemeCommand == null)
{
_switchThemeCommand = new RelayCommand<ElementTheme>(
async (param) =>
{
await ThemeSelectorService.SetThemeAsync(param);
});
}
return _switchThemeCommand;
}
}
public SettingsViewModel()
{
}
public void Initialize()
{
VersionDescription = GetVersionDescription();
}
private string GetVersionDescription()
{
var package = Package.Current;
var packageId = package.Id;
var version = packageId.Version;
return $"{package.DisplayName} - {version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
}
}
}

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

@ -1,142 +0,0 @@
using System;
using MixedNavigationSample.MVVMBasic.Helpers;
using MixedNavigationSample.MVVMBasic.Services;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;
namespace MixedNavigationSample.MVVMBasic.ViewModels
{
public class ShellNavigationItem : Observable
{
public string Label { get; set; }
public Symbol Symbol { get; set; }
public Type PageType { get; set; }
private Visibility _selectedVis = Visibility.Collapsed;
public Visibility SelectedVis
{
get { return _selectedVis; }
set { Set(ref _selectedVis, value); }
}
public char SymbolAsChar
{
get { return (char)Symbol; }
}
private IconElement _iconElement = null;
public IconElement Icon
{
get
{
var foregroundBinding = new Binding
{
Source = this,
Path = new PropertyPath("SelectedForeground"),
Mode = BindingMode.OneWay,
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
};
if (_iconElement != null)
{
BindingOperations.SetBinding(_iconElement, IconElement.ForegroundProperty, foregroundBinding);
return _iconElement;
}
var fontIcon = new FontIcon { FontSize = 16, Glyph = SymbolAsChar.ToString() };
BindingOperations.SetBinding(fontIcon, FontIcon.ForegroundProperty, foregroundBinding);
return fontIcon;
}
}
private bool _isSelected;
public bool IsSelected
{
get
{
return _isSelected;
}
set
{
Set(ref _isSelected, value);
SelectedVis = value ? Visibility.Visible : Visibility.Collapsed;
SelectedForeground = IsSelected
? Application.Current.Resources["SystemControlForegroundAccentBrush"] as SolidColorBrush
: GetStandardTextColorBrush();
}
}
private SolidColorBrush _selectedForeground = null;
public SolidColorBrush SelectedForeground
{
get { return _selectedForeground ?? (_selectedForeground = GetStandardTextColorBrush()); }
set { Set(ref _selectedForeground, value); }
}
public ShellNavigationItem(string label, Symbol symbol, Type pageType)
: this(label, pageType)
{
Symbol = symbol;
}
public ShellNavigationItem(string label, IconElement icon, Type pageType)
: this(label, pageType)
{
_iconElement = icon;
}
public ShellNavigationItem(string label, Type pageType)
{
Label = label;
PageType = pageType;
ThemeSelectorService.OnThemeChanged += (s, e) =>
{
if (!IsSelected)
{
SelectedForeground = GetStandardTextColorBrush();
}
};
}
public static ShellNavigationItem FromType<T>(string label, Symbol symbol)
where T : Page
{
return new ShellNavigationItem(label, symbol, typeof(T));
}
public static ShellNavigationItem FromType<T>(string label, IconElement icon)
where T : Page
{
return new ShellNavigationItem(label, icon, typeof(T));
}
private SolidColorBrush GetStandardTextColorBrush()
{
return ThemeSelectorService.GetSystemControlForegroundForTheme();
}
public override string ToString()
{
return Label;
}
}
}

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

@ -1,208 +0,0 @@
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Input;
using MixedNavigationSample.MVVMBasic.Helpers;
using MixedNavigationSample.MVVMBasic.Services;
using MixedNavigationSample.MVVMBasic.Views;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace MixedNavigationSample.MVVMBasic.ViewModels
{
public class ShellViewModel : Observable
{
private const string PanoramicStateName = "PanoramicState";
private const string WideStateName = "WideState";
private const string NarrowStateName = "NarrowState";
private const double WideStateMinWindowWidth = 640;
private const double PanoramicStateMinWindowWidth = 1024;
private bool _isPaneOpen;
public bool IsPaneOpen
{
get { return _isPaneOpen; }
set { Set(ref _isPaneOpen, value); }
}
private SplitViewDisplayMode _displayMode = SplitViewDisplayMode.CompactInline;
public SplitViewDisplayMode DisplayMode
{
get { return _displayMode; }
set { Set(ref _displayMode, value); }
}
private object _lastSelectedItem;
private ObservableCollection<ShellNavigationItem> _primaryItems = new ObservableCollection<ShellNavigationItem>();
public ObservableCollection<ShellNavigationItem> PrimaryItems
{
get { return _primaryItems; }
set { Set(ref _primaryItems, value); }
}
private ObservableCollection<ShellNavigationItem> _secondaryItems = new ObservableCollection<ShellNavigationItem>();
public ObservableCollection<ShellNavigationItem> SecondaryItems
{
get { return _secondaryItems; }
set { Set(ref _secondaryItems, value); }
}
private ICommand _openPaneCommand;
public ICommand OpenPaneCommand
{
get
{
if (_openPaneCommand == null)
{
_openPaneCommand = new RelayCommand(() => IsPaneOpen = !_isPaneOpen);
}
return _openPaneCommand;
}
}
private ICommand _itemSelected;
public ICommand ItemSelectedCommand
{
get
{
if (_itemSelected == null)
{
_itemSelected = new RelayCommand<ItemClickEventArgs>(ItemSelected);
}
return _itemSelected;
}
}
private ICommand _stateChangedCommand;
public ICommand StateChangedCommand
{
get
{
if (_stateChangedCommand == null)
{
_stateChangedCommand = new RelayCommand<Windows.UI.Xaml.VisualStateChangedEventArgs>(args => GoToState(args.NewState.Name));
}
return _stateChangedCommand;
}
}
private void InitializeState(double windowWith)
{
if (windowWith < WideStateMinWindowWidth)
{
GoToState(NarrowStateName);
}
else if (windowWith < PanoramicStateMinWindowWidth)
{
GoToState(WideStateName);
}
else
{
GoToState(PanoramicStateName);
}
}
private void GoToState(string stateName)
{
switch (stateName)
{
case PanoramicStateName:
DisplayMode = SplitViewDisplayMode.CompactInline;
break;
case WideStateName:
DisplayMode = SplitViewDisplayMode.CompactInline;
IsPaneOpen = false;
break;
case NarrowStateName:
DisplayMode = SplitViewDisplayMode.Overlay;
IsPaneOpen = false;
break;
default:
break;
}
}
public void Initialize(Frame frame)
{
NavigationService.Frame = frame;
NavigationService.Navigated += Frame_Navigated;
PopulateNavItems();
InitializeState(Window.Current.Bounds.Width);
}
private void PopulateNavItems()
{
_primaryItems.Clear();
_secondaryItems.Clear();
// TODO: Change the symbols for each item as appropriate for your app
// More on Segoe UI Symbol icons: https://docs.microsoft.com/windows/uwp/style/segoe-ui-symbol-font
// Or to use an IconElement instead of a Symbol see https://github.com/microsoft/TemplateStudio/blob/main/docs/UWP/projectTypes/navigationpane.md
// Edit String/en-US/Resources.resw: Add a menu item title for each page
_primaryItems.Add(ShellNavigationItem.FromType<HomePage>("Shell_Home".GetLocalized(), Symbol.Document));
_secondaryItems.Add(ShellNavigationItem.FromType<SettingsPage>("Shell_Settings".GetLocalized(), Symbol.Setting));
}
private void ItemSelected(ItemClickEventArgs args)
{
if (DisplayMode == SplitViewDisplayMode.CompactOverlay || DisplayMode == SplitViewDisplayMode.Overlay)
{
IsPaneOpen = false;
}
Navigate(args.ClickedItem);
}
private void Frame_Navigated(object sender, NavigationEventArgs e)
{
var navigationItem = PrimaryItems?.FirstOrDefault(i => i.PageType == e?.SourcePageType);
if (navigationItem == null)
{
navigationItem = SecondaryItems?.FirstOrDefault(i => i.PageType == e?.SourcePageType);
}
if (navigationItem != null)
{
ChangeSelected(_lastSelectedItem, navigationItem);
_lastSelectedItem = navigationItem;
}
}
private void ChangeSelected(object oldValue, object newValue)
{
if (oldValue != null)
{
(oldValue as ShellNavigationItem).IsSelected = false;
}
if (newValue != null)
{
(newValue as ShellNavigationItem).IsSelected = true;
}
}
private void Navigate(object item)
{
var navigationItem = item as ShellNavigationItem;
if (navigationItem != null)
{
NavigationService.Navigate(navigationItem.PageType);
}
}
}
}

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

@ -1,25 +0,0 @@
using System.Windows.Input;
using MixedNavigationSample.MVVMBasic.Helpers;
using MixedNavigationSample.MVVMBasic.Services;
namespace MixedNavigationSample.MVVMBasic.ViewModels
{
public class StartViewModel : Observable
{
public ICommand StartCommand { get; set; }
public StartViewModel()
{
StartCommand = new RelayCommand(OnStart);
}
private void OnStart()
{
//Navigating to a ShellPage, this will replaces NavigationService frame for an inner frame to change navigation handling.
NavigationService.Navigate<Views.ShellPage>();
//Navigating now to a HomePage, this will be the first navigation on a NavigationPane menu
NavigationService.Navigate<Views.HomePage>();
}
}
}

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

@ -1,47 +0,0 @@
<Page
x:Class="MixedNavigationSample.MVVMBasic.Views.HomePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid
x:Name="ContentArea"
Margin="{StaticResource MediumLeftRightMargin}">
<Grid.RowDefinitions>
<RowDefinition x:Name="TitleRow" Height="48"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock
x:Name="TitlePage"
x:Uid="Home_Title"
Style="{StaticResource PageTitleStyle}" />
<Grid
Grid.Row="1"
Background="{ThemeResource SystemControlPageBackgroundChromeLowBrush}">
<!--The SystemControlPageBackgroundChromeLowBrush background represents where you should place your content.
Place your content here.-->
</Grid>
<!-- Adaptive triggers -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="WindowStates">
<VisualState x:Name="WideState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="640"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="NarrowState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="TitlePage.Margin" Value="48,0,12,7"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</Page>

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

@ -1,18 +0,0 @@
using System;
using MixedNavigationSample.MVVMBasic.ViewModels;
using Windows.UI.Xaml.Controls;
namespace MixedNavigationSample.MVVMBasic.Views
{
public sealed partial class HomePage : Page
{
public HomeViewModel ViewModel { get; } = new HomeViewModel();
public HomePage()
{
InitializeComponent();
}
}
}

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

@ -1,103 +0,0 @@
<Page
x:Class="MixedNavigationSample.MVVMBasic.Views.SettingsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:helper="using:MixedNavigationSample.MVVMBasic.Helpers"
xmlns:xaml="using:Windows.UI.Xaml"
mc:Ignorable="d">
<Page.Resources>
<helper:EnumToBooleanConverter x:Key="EnumToBooleanConverter" EnumType="ElementTheme" />
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Margin="{StaticResource MediumLeftRightMargin}">
<Grid.RowDefinitions>
<RowDefinition Height="48"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
x:Uid="Settings_Title"
x:Name="TitlePage"
Style="{StaticResource PageTitleStyle}" />
<StackPanel Grid.Row="1">
<TextBlock
x:Uid="Settings_Personalization"
Style="{StaticResource SubtitleTextBlockStyle}" />
<StackPanel Margin="{StaticResource SettingsSubheaderMargin}">
<TextBlock
x:Uid="Settings_Theme"
Style="{StaticResource BodyTextStyle}" />
<StackPanel Margin="{StaticResource EightTopMargin}">
<RadioButton
x:Uid="Settings_Theme_Light"
GroupName="AppTheme"
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Light, Mode=TwoWay}"
Command="{x:Bind ViewModel.SwitchThemeCommand}">
<RadioButton.CommandParameter>
<xaml:ElementTheme>Light</xaml:ElementTheme>
</RadioButton.CommandParameter>
</RadioButton>
<RadioButton
x:Uid="Settings_Theme_Dark"
GroupName="AppTheme"
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Dark, Mode=TwoWay}"
Command="{x:Bind ViewModel.SwitchThemeCommand}">
<RadioButton.CommandParameter>
<xaml:ElementTheme>Dark</xaml:ElementTheme>
</RadioButton.CommandParameter>
</RadioButton>
<RadioButton
x:Uid="Settings_Theme_Default"
GroupName="AppTheme"
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Default, Mode=TwoWay}"
Command="{x:Bind ViewModel.SwitchThemeCommand}">
<RadioButton.CommandParameter>
<xaml:ElementTheme>Default</xaml:ElementTheme>
</RadioButton.CommandParameter>
</RadioButton>
</StackPanel>
</StackPanel>
<TextBlock
x:Uid="Settings_About"
Style="{StaticResource SubtitleTextBlockStyle}"/>
<StackPanel Margin="{StaticResource EightTopMargin}">
<TextBlock
Text="{x:Bind ViewModel.VersionDescription, Mode=OneWay}" />
<TextBlock
x:Uid="Settings_AboutDescription"
Margin="{StaticResource EightTopMargin}" />
<HyperlinkButton
x:Uid="Settings_PrivacyTermsLink"
Margin="{StaticResource EightTopMargin}" />
</StackPanel>
</StackPanel>
</Grid>
<!-- Adaptive triggers -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="WindowStates">
<VisualState x:Name="WideState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="640"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="NarrowState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="TitlePage.Margin" Value="48,0,12,7"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</Page>

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

@ -1,26 +0,0 @@
using System;
using MixedNavigationSample.MVVMBasic.ViewModels;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace MixedNavigationSample.MVVMBasic.Views
{
public sealed partial class SettingsPage : Page
{
public SettingsViewModel ViewModel { get; } = new SettingsViewModel();
//// TODO: Change the URL for your privacy policy in the Resource File, currently set to https://YourPrivacyUrlGoesHere
public SettingsPage()
{
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
ViewModel.Initialize();
}
}
}

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

@ -1,143 +0,0 @@
<Page
x:Class="MixedNavigationSample.MVVMBasic.Views.ShellPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:MixedNavigationSample.MVVMBasic.ViewModels"
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
<Page.Resources>
<DataTemplate x:Key="NavigationMenuItemDataTemplate" x:DataType="vm:ShellNavigationItem">
<Grid Width="320" Height="40" Background="{ThemeResource SystemControlBackgroundAltHighBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="48" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Rectangle
Width="6"
Height="24"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Fill="{ThemeResource SystemControlForegroundAccentBrush}"
Visibility="{x:Bind SelectedVis, Mode=OneWay}" />
<Viewbox
Child="{x:Bind Icon}"
ToolTipService.ToolTip="{x:Bind Label}"
Margin="16,12"
VerticalAlignment="Center" />
<TextBlock
Grid.Column="1"
Margin="0,9,0,11"
VerticalAlignment="Center"
Foreground="{x:Bind SelectedForeground, Mode=OneWay}"
Text="{x:Bind Label}"
Style="{StaticResource BodyTextBlockStyle}"
TextTrimming="None" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<Storyboard>
<PointerUpThemeAnimation Storyboard.TargetName="ContentPresenter" />
</Storyboard>
</VisualState>
<VisualState x:Name="PointerOver">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="BorderBackground"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderBackground" Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListLowBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}" />
</ObjectAnimationUsingKeyFrames>
<PointerUpThemeAnimation Storyboard.TargetName="ContentPresenter" />
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="BorderBackground"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderBackground" Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListMediumBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}" />
</ObjectAnimationUsingKeyFrames>
<PointerDownThemeAnimation TargetName="ContentPresenter" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="DisabledStates">
<VisualState x:Name="Enabled" />
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="ContentBorder"
Storyboard.TargetProperty="Opacity"
To="{ThemeResource ListViewItemDisabledThemeOpacity}"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</DataTemplate>
</Page.Resources>
<controls:HamburgerMenu
x:Name="NavigationMenu"
DisplayMode="{x:Bind ViewModel.DisplayMode, Mode=OneWay}"
IsPaneOpen="{x:Bind ViewModel.IsPaneOpen, Mode=TwoWay}"
ItemTemplate="{StaticResource NavigationMenuItemDataTemplate}"
ItemsSource="{x:Bind ViewModel.PrimaryItems}"
OptionsItemTemplate="{StaticResource NavigationMenuItemDataTemplate}"
OptionsItemsSource="{x:Bind ViewModel.SecondaryItems}"
PaneBackground="{ThemeResource SystemControlBackgroundAltHighBrush}"
PaneForeground="{ThemeResource SystemControlForegroundBaseHighBrush}"
>
<i:Interaction.Behaviors>
<ic:EventTriggerBehavior EventName="ItemClick">
<ic:InvokeCommandAction Command="{x:Bind ViewModel.ItemSelectedCommand}" />
</ic:EventTriggerBehavior>
<ic:EventTriggerBehavior EventName="OptionsItemClick">
<ic:InvokeCommandAction Command="{x:Bind ViewModel.ItemSelectedCommand}" />
</ic:EventTriggerBehavior>
</i:Interaction.Behaviors>
<Grid Background="{ThemeResource SystemControlBackgroundAltHighBrush}">
<Frame x:Name="shellFrame"/>
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="WindowStates">
<i:Interaction.Behaviors>
<ic:EventTriggerBehavior EventName="CurrentStateChanged">
<ic:InvokeCommandAction Command="{x:Bind ViewModel.StateChangedCommand}"/>
</ic:EventTriggerBehavior>
</i:Interaction.Behaviors>
<VisualState x:Name="PanoramicState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="1024"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="WideState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="640"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="NarrowState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</controls:HamburgerMenu>
</Page>

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

@ -1,20 +0,0 @@
using System;
using MixedNavigationSample.MVVMBasic.ViewModels;
using Windows.UI.Xaml.Controls;
namespace MixedNavigationSample.MVVMBasic.Views
{
public sealed partial class ShellPage : Page
{
public ShellViewModel ViewModel { get; } = new ShellViewModel();
public ShellPage()
{
InitializeComponent();
DataContext = ViewModel;
ViewModel.Initialize(shellFrame);
}
}
}

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

@ -1,47 +0,0 @@
<Page
x:Class="MixedNavigationSample.MVVMBasic.Views.StartPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid
x:Name="ContentArea"
Margin="{StaticResource MediumLeftRightMargin}">
<Grid.RowDefinitions>
<RowDefinition x:Name="TitleRow" Height="48"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock
x:Name="TitlePage"
x:Uid="Start_Title"
Style="{StaticResource PageTitleStyle}" />
<Grid Grid.Row="1" >
<StackPanel Margin="0,12">
<TextBlock x:Uid="Start_Description"/>
<Button x:Uid="Start_StartButton" Margin="0,18,0,0" Command="{x:Bind ViewModel.StartCommand}"/>
</StackPanel>
</Grid>
<!-- Adaptive triggers -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="WindowStates">
<VisualState x:Name="WideState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="640"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="NarrowState">
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="TitlePage.Margin" Value="48,0,12,7"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</Page>

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

@ -1,18 +0,0 @@
using System;
using MixedNavigationSample.MVVMBasic.ViewModels;
using Windows.UI.Xaml.Controls;
namespace MixedNavigationSample.MVVMBasic.Views
{
public sealed partial class StartPage : Page
{
public StartViewModel ViewModel { get; } = new StartViewModel();
public StartPage()
{
InitializeComponent();
}
}
}

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

@ -1,40 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26206.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MixedNavigationSample.MVVMLight", "MixedNavigationSample.MVVMLight\MixedNavigationSample.MVVMLight.csproj", "{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution {28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Debug|ARM.ActiveCfg = Debug|ARM
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Debug|ARM.Build.0 = Debug|ARM
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Debug|ARM.Deploy.0 = Debug|ARM
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Debug|x64.ActiveCfg = Debug|x64
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Debug|x64.Build.0 = Debug|x64
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Debug|x64.Deploy.0 = Debug|x64
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Debug|x86.ActiveCfg = Debug|x86
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Debug|x86.Build.0 = Debug|x86
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Debug|x86.Deploy.0 = Debug|x86
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Release|ARM.ActiveCfg = Release|ARM
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Release|ARM.Build.0 = Release|ARM
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Release|ARM.Deploy.0 = Release|ARM
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Release|x64.ActiveCfg = Release|x64
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Release|x64.Build.0 = Release|x64
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Release|x64.Deploy.0 = Release|x64
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Release|x86.ActiveCfg = Release|x86
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Release|x86.Build.0 = Release|x86
{28E24C9C-98CB-4880-9718-6F7D5DB05E7D}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

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

@ -1,11 +0,0 @@
# top-most EditorConfig file
root = true
[*]
end_of_line = crlf
[*.{cs,xaml}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

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

@ -1,34 +0,0 @@
using System;
using System.Threading.Tasks;
namespace MixedNavigationSample.MVVMLight.Activation
{
// For more information on application activation see https://github.com/microsoft/TemplateStudio/blob/main/docs/UWP/activation.md
internal abstract class ActivationHandler
{
public abstract bool CanHandle(object args);
public abstract Task HandleAsync(object args);
}
internal abstract class ActivationHandler<T> : ActivationHandler
where T : class
{
protected abstract Task HandleInternalAsync(T args);
public override async Task HandleAsync(object args)
{
await HandleInternalAsync(args as T);
}
public override bool CanHandle(object args)
{
return args is T && CanHandleInternal(args as T);
}
protected virtual bool CanHandleInternal(T args)
{
return true;
}
}
}

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

@ -1,43 +0,0 @@
using System;
using System.Threading.Tasks;
using MixedNavigationSample.MVVMLight.Services;
using Windows.ApplicationModel.Activation;
namespace MixedNavigationSample.MVVMLight.Activation
{
internal class DefaultLaunchActivationHandler : ActivationHandler<LaunchActivatedEventArgs>
{
private readonly string _navElement;
private NavigationServiceEx NavigationService
{
get
{
return Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance<NavigationServiceEx>();
}
}
public DefaultLaunchActivationHandler(Type navElement)
{
_navElement = navElement.FullName;
}
protected override async Task HandleInternalAsync(LaunchActivatedEventArgs args)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
NavigationService.Navigate(_navElement, args.Arguments);
await Task.CompletedTask;
}
protected override bool CanHandleInternal(LaunchActivatedEventArgs args)
{
// None of the ActivationHandlers has handled the app activation
return NavigationService.Frame.Content == null;
}
}
}

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

@ -1,16 +0,0 @@
<Application
x:Class="MixedNavigationSample.MVVMLight.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vms="using:MixedNavigationSample.MVVMLight.ViewModels"
>
<Application.Resources>
<ResourceDictionary>
<vms:ViewModelLocator x:Key="Locator" />
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Styles/TextBlock.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

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

@ -1,66 +0,0 @@
using System;
using MixedNavigationSample.MVVMLight.Services;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
namespace MixedNavigationSample.MVVMLight
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public sealed partial class App : Application
{
private Lazy<ActivationService> _activationService;
private ActivationService ActivationService
{
get { return _activationService.Value; }
}
/// <summary>
/// Initializes a new instance of the <see cref="App"/> class.
/// This is the first line of authored code executed, and as such
/// is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
InitializeComponent();
// Deferred execution until used. Check https://msdn.microsoft.com/library/dd642331(v=vs.110).aspx for further info on Lazy<T> class.
_activationService = new Lazy<ActivationService>(CreateActivationService);
}
/// <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)
{
if (!e.PrelaunchActivated)
{
await ActivationService.ActivateAsync(e);
}
}
/// <summary>
/// Invoked when the application is activated by some means other than normal launching.
/// </summary>
/// <param name="args">Event data for the event.</param>
protected override async void OnActivated(IActivatedEventArgs args)
{
await ActivationService.ActivateAsync(args);
}
private ActivationService CreateActivationService()
{
//This is the default navigation for a NavigationPane project type
//return new ActivationService(this, typeof(ViewModels.HomeViewModel), new Views.ShellPage());
//We are going to initialize navigation to a StartPage
return new ActivationService(this, typeof(ViewModels.StartViewModel));
}
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 7.5 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.9 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 3.1 KiB

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

@ -1,38 +0,0 @@
using System;
using Windows.UI.Xaml.Data;
namespace MixedNavigationSample.MVVMLight.Helpers
{
public class EnumToBooleanConverter : IValueConverter
{
public Type EnumType { get; set; }
public object Convert(object value, Type targetType, object parameter, string language)
{
if (parameter is string enumString)
{
if (!Enum.IsDefined(EnumType, value))
{
throw new ArgumentException("value must be an Enum!");
}
var enumValue = Enum.Parse(EnumType, enumString);
return enumValue.Equals(value);
}
throw new ArgumentException("parameter must be an Enum name!");
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
if (parameter is string enumString)
{
return Enum.Parse(EnumType, enumString);
}
throw new ArgumentException("parameter must be an Enum name!");
}
}
}

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

@ -1,26 +0,0 @@
using System;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace MixedNavigationSample.MVVMLight.Helpers
{
public static class Json
{
public static async Task<T> ToObjectAsync<T>(string value)
{
return await Task.Run<T>(() =>
{
return JsonConvert.DeserializeObject<T>(value);
});
}
public static async Task<string> StringifyAsync(object value)
{
return await Task.Run<string>(() =>
{
return JsonConvert.SerializeObject(value);
});
}
}
}

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

@ -1,17 +0,0 @@
using System;
using System.Runtime.InteropServices;
using Windows.ApplicationModel.Resources;
namespace MixedNavigationSample.MVVMLight.Helpers
{
internal static class ResourceExtensions
{
private static ResourceLoader _resLoader = new ResourceLoader();
public static string GetLocalized(this string resourceKey)
{
return _resLoader.GetString(resourceKey);
}
}
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше