Merge remote-tracking branch 'upstream/dev' into Fluent-Design
This commit is contained in:
Коммит
9289c996d5
|
@ -21,6 +21,7 @@ namespace Microsoft.Templates.UI.ViewModels.NewProject
|
|||
{
|
||||
public class MainViewModel : BaseMainViewModel
|
||||
{
|
||||
private bool _needRestartConfiguration = false;
|
||||
public static MainViewModel Current;
|
||||
public MainView MainView;
|
||||
|
||||
|
@ -69,10 +70,12 @@ namespace Microsoft.Templates.UI.ViewModels.NewProject
|
|||
if (CheckProjectSetupChanged())
|
||||
{
|
||||
WizardStatus.SetStatus(StatusViewModel.Warning(string.Format(StringRes.ResetSelection, ProjectTemplates.ContextProjectType.DisplayName, ProjectTemplates.ContextFramework.DisplayName), true, 5));
|
||||
_needRestartConfiguration = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CleanStatus();
|
||||
_needRestartConfiguration = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,15 +136,15 @@ namespace Microsoft.Templates.UI.ViewModels.NewProject
|
|||
base.OnNext();
|
||||
if (CurrentStep == 1)
|
||||
{
|
||||
WizardStatus.WizardTitle = StringRes.ProjectPagesTitle;
|
||||
await ProjectTemplates.InitializeAsync();
|
||||
NavigationService.Navigate(new ProjectPagesView());
|
||||
if (CheckProjectSetupChanged())
|
||||
if (_needRestartConfiguration)
|
||||
{
|
||||
ResetSelection();
|
||||
Ordering.Panel.Children.Clear();
|
||||
CleanStatus();
|
||||
}
|
||||
WizardStatus.WizardTitle = StringRes.ProjectPagesTitle;
|
||||
await ProjectTemplates.InitializeAsync();
|
||||
NavigationService.Navigate(new ProjectPagesView());
|
||||
}
|
||||
else if (CurrentStep == 2)
|
||||
{
|
||||
|
|
|
@ -38,15 +38,17 @@ namespace Microsoft.Templates.UI.ViewModels.NewProject
|
|||
{
|
||||
DataService.LoadFrameworks(Frameworks, value.Name);
|
||||
FrameworkHeader = string.Format(StringRes.GroupFrameworkHeader_SF, Frameworks.Count);
|
||||
|
||||
SelectedFramework = Frameworks.FirstOrDefault(f => f.Name == _selectedFramework?.Name);
|
||||
if (SelectedFramework == null)
|
||||
if (_selectedFramework != null)
|
||||
{
|
||||
SelectedFramework = Frameworks.FirstOrDefault(f => f.Name == _selectedFramework.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedFramework = Frameworks.FirstOrDefault();
|
||||
}
|
||||
|
||||
var hasChanged = _selectedProjectType != null && _selectedProjectType.Name != value.Name;
|
||||
SetProperty(ref _selectedProjectType, value);
|
||||
if (_selectedProjectType != null && _selectedProjectType != value)
|
||||
if (hasChanged)
|
||||
{
|
||||
MainViewModel.Current.AlertProjectSetupChanged();
|
||||
}
|
||||
|
@ -62,16 +64,16 @@ namespace Microsoft.Templates.UI.ViewModels.NewProject
|
|||
get => _selectedFramework;
|
||||
set
|
||||
{
|
||||
var orgframework = _selectedFramework;
|
||||
|
||||
SetProperty(ref _selectedFramework, value);
|
||||
|
||||
if (value != null && orgframework != null && orgframework != _selectedFramework)
|
||||
if (value != null)
|
||||
{
|
||||
MainViewModel.Current.AlertProjectSetupChanged();
|
||||
bool hasChanged = _selectedFramework != null && _selectedFramework.Name != value.Name;
|
||||
SetProperty(ref _selectedFramework, value);
|
||||
if (hasChanged)
|
||||
{
|
||||
MainViewModel.Current.AlertProjectSetupChanged();
|
||||
}
|
||||
MainViewModel.Current.RebuildLicenses();
|
||||
}
|
||||
|
||||
MainViewModel.Current.RebuildLicenses();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -231,6 +231,11 @@ namespace Microsoft.Templates.Test
|
|||
case "MVVMLight":
|
||||
result = context.Factory.Run(() => BuildMVVMLightFixture.GetProjectTemplatesAsync(framework));
|
||||
break;
|
||||
|
||||
case "CaliburnMicro":
|
||||
result = context.Factory.Run(() => BuildCaliburnMicroFixture.GetProjectTemplatesAsync(framework));
|
||||
break;
|
||||
|
||||
default:
|
||||
result = context.Factory.Run(() => BuildFixture.GetProjectTemplatesAsync());
|
||||
break;
|
||||
|
@ -259,6 +264,10 @@ namespace Microsoft.Templates.Test
|
|||
case "MVVMLight":
|
||||
result = context.Factory.Run(() => BuildMVVMLightFixture.GetPageAndFeatureTemplatesAsync(framework));
|
||||
break;
|
||||
|
||||
case "CaliburnMicro":
|
||||
result = context.Factory.Run(() => BuildCaliburnMicroFixture.GetPageAndFeatureTemplatesAsync(framework));
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.Templates.Test
|
||||
{
|
||||
[CollectionDefinition("BuildCaliburnMicroCollection")]
|
||||
public class BuildCaliburnMicroCollection : ICollectionFixture<BuildCaliburnMicroFixture>
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Microsoft.TemplateEngine.Abstractions;
|
||||
using Microsoft.Templates.Core;
|
||||
using Microsoft.Templates.Core.Gen;
|
||||
using Microsoft.Templates.Core.Locations;
|
||||
using Microsoft.Templates.Fakes;
|
||||
using Microsoft.Templates.UI;
|
||||
|
||||
namespace Microsoft.Templates.Test
|
||||
{
|
||||
public sealed class BuildCaliburnMicroFixture : BaseGenAndBuildFixture, IDisposable
|
||||
{
|
||||
private string testExecutionTimeStamp = DateTime.Now.FormatAsDateHoursMinutes();
|
||||
public override string GetTestRunPath() => $"{Path.GetPathRoot(Environment.CurrentDirectory)}\\UIT\\CM\\{testExecutionTimeStamp}\\";
|
||||
|
||||
public TemplatesSource Source => new BuildCaliburnMicroTestTemplatesSource();
|
||||
|
||||
private static bool syncExecuted;
|
||||
|
||||
public static async Task<IEnumerable<object[]>> GetProjectTemplatesAsync(string frameworkFilter)
|
||||
{
|
||||
List<object[]> result = new List<object[]>();
|
||||
foreach (var language in ProgrammingLanguages.GetAllLanguages())
|
||||
{
|
||||
await InitializeTemplatesForLanguageAsync(new BuildCaliburnMicroTestTemplatesSource(), language);
|
||||
|
||||
var projectTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetTemplateType() == TemplateType.Project
|
||||
&& t.GetLanguage() == language);
|
||||
|
||||
foreach (var projectTemplate in projectTemplates)
|
||||
{
|
||||
var projectTypeList = projectTemplate.GetProjectTypeList();
|
||||
|
||||
foreach (var projectType in projectTypeList)
|
||||
{
|
||||
var frameworks = GenComposer.GetSupportedFx(projectType).Where(f => f == frameworkFilter);
|
||||
|
||||
foreach (var framework in frameworks)
|
||||
{
|
||||
result.Add(new object[] { projectType, framework, language });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Task<IEnumerable<object[]>> GetPageAndFeatureTemplatesAsync(string frameworkFilter)
|
||||
{
|
||||
List<object[]> result = new List<object[]>();
|
||||
foreach (var language in ProgrammingLanguages.GetAllLanguages())
|
||||
{
|
||||
await InitializeTemplatesForLanguageAsync(new BuildCaliburnMicroTestTemplatesSource(), language);
|
||||
await InitializeTemplatesForLanguageAsync(new BuildCaliburnMicroTestTemplatesSource(), language);
|
||||
|
||||
var projectTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetTemplateType() == TemplateType.Project
|
||||
&& t.GetLanguage() == language);
|
||||
|
||||
foreach (var projectTemplate in projectTemplates)
|
||||
{
|
||||
var projectTypeList = projectTemplate.GetProjectTypeList();
|
||||
|
||||
foreach (var projectType in projectTypeList)
|
||||
{
|
||||
var frameworks = GenComposer.GetSupportedFx(projectType).Where(f => f == frameworkFilter);
|
||||
|
||||
foreach (var framework in frameworks)
|
||||
{
|
||||
var itemTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetFrameworkList().Contains(framework)
|
||||
&& (t.GetTemplateType() == TemplateType.Page || t.GetTemplateType() == TemplateType.Feature)
|
||||
&& t.GetLanguage() == language
|
||||
&& !t.GetIsHidden());
|
||||
|
||||
foreach (var itemTemplate in itemTemplates)
|
||||
{
|
||||
result.Add(new object[]
|
||||
{ itemTemplate.Name, projectType, framework, itemTemplate.Identity, language });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static async Task InitializeTemplatesForLanguageAsync(TemplatesSource source, string language)
|
||||
{
|
||||
GenContext.Bootstrap(source, new FakeGenShell(language), language);
|
||||
|
||||
if (!syncExecuted)
|
||||
{
|
||||
await GenContext.ToolBox.Repo.SynchronizeAsync();
|
||||
syncExecuted = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
await GenContext.ToolBox.Repo.RefreshAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task InitializeFixtureAsync(string language, IContextProvider contextProvider)
|
||||
{
|
||||
GenContext.Current = contextProvider;
|
||||
|
||||
await InitializeTemplatesForLanguageAsync(Source, language);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Microsoft.Templates.Core;
|
||||
using Microsoft.Templates.Core.Gen;
|
||||
using Microsoft.Templates.Core.Locations;
|
||||
using Microsoft.Templates.Fakes;
|
||||
using Microsoft.Templates.UI;
|
||||
using Microsoft.VisualStudio.Threading;
|
||||
using Microsoft.TemplateEngine.Abstractions;
|
||||
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.Templates.Test
|
||||
{
|
||||
[Collection("BuildCaliburnMicroCollection")]
|
||||
[Trait("ExecutionSet", "BuildCaliburnMicro")]
|
||||
[Trait("ExecutionSet", "Build")]
|
||||
public class BuildCaliburnMicroProjectTests : BaseGenAndBuildTests
|
||||
{
|
||||
public BuildCaliburnMicroProjectTests(BuildCaliburnMicroFixture fixture)
|
||||
{
|
||||
_fixture = fixture;
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData("GetProjectTemplatesForBuildAsync", "CaliburnMicro")]
|
||||
[Trait("Type", "BuildProjects")]
|
||||
public async Task BuildEmptyProjectAsync(string projectType, string framework, string language)
|
||||
{
|
||||
Func<ITemplateInfo, bool> selector =
|
||||
t => t.GetTemplateType() == TemplateType.Project
|
||||
&& t.GetProjectTypeList().Contains(projectType)
|
||||
&& t.GetFrameworkList().Contains(framework)
|
||||
&& !t.GetIsHidden()
|
||||
&& t.GetLanguage() == language;
|
||||
|
||||
var projectName = $"{projectType}";
|
||||
|
||||
var projectPath = await AssertGenerateProjectAsync(selector, projectName, projectType, framework, language, null, false);
|
||||
|
||||
AssertBuildProjectAsync(projectPath, projectName);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData("GetProjectTemplatesForBuildAsync", "CaliburnMicro")]
|
||||
[Trait("Type", "BuildAllPagesAndFeatures")]
|
||||
public async Task BuildAllPagesAndFeaturesAsync(string projectType, string framework, string language)
|
||||
{
|
||||
Func<ITemplateInfo, bool> selector =
|
||||
t => t.GetTemplateType() == TemplateType.Project
|
||||
&& t.GetProjectTypeList().Contains(projectType)
|
||||
&& t.GetFrameworkList().Contains(framework)
|
||||
&& !t.GetIsHidden()
|
||||
&& t.GetLanguage() == language;
|
||||
|
||||
var projectName = $"{projectType}All";
|
||||
|
||||
var projectPath = await AssertGenerateProjectAsync(selector, projectName, projectType, framework, language, GenerationFixture.GetDefaultName, false);
|
||||
|
||||
AssertBuildProjectAsync(projectPath, projectName);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData("GetProjectTemplatesForBuildAsync", "CaliburnMicro")]
|
||||
[Trait("Type", "BuildRandomNames")]
|
||||
[Trait("ExecutionSet", "Minimum")]
|
||||
public async Task BuildAllPagesAndFeaturesRandomNamesAsync(string projectType, string framework, string language)
|
||||
{
|
||||
Func<ITemplateInfo, bool> selector =
|
||||
t => t.GetTemplateType() == TemplateType.Project
|
||||
&& t.GetProjectTypeList().Contains(projectType)
|
||||
&& t.GetFrameworkList().Contains(framework)
|
||||
&& !t.GetIsHidden()
|
||||
&& t.GetLanguage() == language;
|
||||
|
||||
var projectName = $"{projectType}AllRandom";
|
||||
|
||||
var projectPath = await AssertGenerateProjectAsync(selector, projectName, projectType, framework, language, GenerationFixture.GetRandomName, false);
|
||||
|
||||
AssertBuildProjectAsync(projectPath, projectName);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData("GetProjectTemplatesForBuildAsync", "CaliburnMicro")]
|
||||
[Trait("Type", "BuildRightClick")]
|
||||
public async Task BuildEmptyProjectWithAllRightClickItemsAsync(string projectType, string framework, string language)
|
||||
{
|
||||
var projectName = $"{projectType}AllRightClick";
|
||||
|
||||
var projectPath = await AssertGenerateRightClickAsync(projectName, projectType, framework, language, true, false);
|
||||
|
||||
AssertBuildProjectAsync(projectPath, projectName);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData("GetProjectTemplatesForBuildAsync", "CaliburnMicro")]
|
||||
[Trait("Type", "BuildRightClick")]
|
||||
public async Task BuildCompleteProjectWithAllRightClickItemsAsync(string projectType, string framework, string language)
|
||||
{
|
||||
var projectName = $"{projectType}AllRightClick2";
|
||||
|
||||
var projectPath = await AssertGenerateRightClickAsync(projectName, projectType, framework, language, false, false);
|
||||
|
||||
AssertBuildProjectAsync(projectPath, projectName);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData("GetPageAndFeatureTemplatesForBuildAsync", "CaliburnMicro")]
|
||||
[Trait("Type", "BuildOneByOneCaliburnMicro")]
|
||||
public async Task BuildCaliburnMicroOneByOneItemsAsync(string itemName, string projectType, string framework, string itemId, string language)
|
||||
{
|
||||
var result = await AssertGenerationOneByOneAsync(itemName, projectType, framework, itemId, language, false);
|
||||
|
||||
AssertBuildProjectAsync(result.ProjectPath, result.ProjecName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Microsoft.Templates.Core;
|
||||
using Microsoft.Templates.Core.Locations;
|
||||
using Microsoft.Templates.Core.Packaging;
|
||||
|
||||
namespace Microsoft.Templates.Test
|
||||
{
|
||||
public sealed class BuildCaliburnMicroTestTemplatesSource : TemplatesSource
|
||||
{
|
||||
public string LocalTemplatesVersion { get; private set; }
|
||||
|
||||
protected override bool VerifyPackageSignatures => false;
|
||||
|
||||
public override bool ForcedAcquisition => true;
|
||||
|
||||
public string Origin => $@"..\..\..\..\..\{SourceFolderName}";
|
||||
|
||||
public override string Id => "TestBuildCaliburnMicro";
|
||||
|
||||
protected override string AcquireMstx()
|
||||
{
|
||||
// Compress Content adding version return TemplatePackage path.
|
||||
var tempFolder = Path.Combine(GetTempFolder(), SourceFolderName);
|
||||
|
||||
Copy(Origin, tempFolder);
|
||||
|
||||
File.WriteAllText(Path.Combine(tempFolder, "version.txt"), LocalTemplatesVersion, Encoding.UTF8);
|
||||
|
||||
return TemplatePackage.Pack(tempFolder);
|
||||
}
|
||||
|
||||
private void Copy(string sourceFolder, string targetFolder)
|
||||
{
|
||||
Fs.SafeDeleteDirectory(targetFolder);
|
||||
Fs.CopyRecursive(sourceFolder, targetFolder);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@ namespace Microsoft.Templates.Test
|
|||
public sealed class BuildCodeBehindFixture : BaseGenAndBuildFixture, IDisposable
|
||||
{
|
||||
private string testExecutionTimeStamp = DateTime.Now.FormatAsDateHoursMinutes();
|
||||
public override string GetTestRunPath() => $"{Path.GetPathRoot(Environment.CurrentDirectory)}\\UIT\\CodeBehind\\{testExecutionTimeStamp}\\";
|
||||
public override string GetTestRunPath() => $"{Path.GetPathRoot(Environment.CurrentDirectory)}\\UIT\\CB\\{testExecutionTimeStamp}\\";
|
||||
|
||||
public TemplatesSource Source => new BuildCodeBehindTestTemplatesSource();
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Microsoft.Templates.Test
|
|||
public sealed class BuildMVVMBasicFixture : BaseGenAndBuildFixture, IDisposable
|
||||
{
|
||||
private string testExecutionTimeStamp = DateTime.Now.FormatAsDateHoursMinutes();
|
||||
public override string GetTestRunPath() => $"{Path.GetPathRoot(Environment.CurrentDirectory)}\\UIT\\MVVMBasic\\{testExecutionTimeStamp}\\";
|
||||
public override string GetTestRunPath() => $"{Path.GetPathRoot(Environment.CurrentDirectory)}\\UIT\\MB\\{testExecutionTimeStamp}\\";
|
||||
|
||||
public TemplatesSource Source => new BuildMVVMBasicTestTemplatesSource();
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Microsoft.Templates.Test
|
|||
public sealed class BuildMVVMLightFixture : BaseGenAndBuildFixture, IDisposable
|
||||
{
|
||||
private string testExecutionTimeStamp = DateTime.Now.FormatAsDateHoursMinutes();
|
||||
public override string GetTestRunPath() => $"{Path.GetPathRoot(Environment.CurrentDirectory)}\\UIT\\MVVMLight\\{testExecutionTimeStamp}\\";
|
||||
public override string GetTestRunPath() => $"{Path.GetPathRoot(Environment.CurrentDirectory)}\\UIT\\ML\\{testExecutionTimeStamp}\\";
|
||||
|
||||
public TemplatesSource Source => new BuildMVVMLightTestTemplatesSource();
|
||||
|
||||
|
|
|
@ -110,6 +110,14 @@ namespace Microsoft.Templates.Test
|
|||
await AssertGenerationOneByOneAsync(itemName, projectType, framework, itemId, language);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData("GetPageAndFeatureTemplatesAsync", "CaliburnMicro")]
|
||||
[Trait("Type", "GenerationOneByOneCaliburnMicro")]
|
||||
public async Task GenCaliburnMicroOneByOneItemsAsync(string itemName, string projectType, string framework, string itemId, string language)
|
||||
{
|
||||
await AssertGenerationOneByOneAsync(itemName, projectType, framework, itemId, language);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData("GetPageAndFeatureTemplatesForGenerationAsync", "MVVMBasic")]
|
||||
[Trait("Type", "GenerationOneByOneMVVMBasic")]
|
||||
|
|
|
@ -120,6 +120,10 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BuildCaliburnMicroTests\BuildCaliburnMicroCollection.cs" />
|
||||
<Compile Include="BuildCaliburnMicroTests\BuildCaliburnMicroFixture.cs" />
|
||||
<Compile Include="BuildCaliburnMicroTests\BuildCaliburnMicroProjectTests.cs" />
|
||||
<Compile Include="BuildCaliburnMicroTests\BuildCaliburnMicroTestTemplatesSource.cs" />
|
||||
<Compile Include="BuildCodeBehindTests\BuildCodeBehindCollection.cs" />
|
||||
<Compile Include="BuildMVVMBasic\BuildMVVMBasicCollection.cs" />
|
||||
<Compile Include="BuildMVVMBasic\BuildMVVMBasicFixture.cs" />
|
||||
|
|
|
@ -6,6 +6,7 @@ This document covers:
|
|||
|
||||
* [Modifying the menu items](#menu)
|
||||
* [Using the navigation pane with command bars](#commandbar)
|
||||
* [Have the menu item invoke code rather than navigate](#invokecode)
|
||||
|
||||
<a name="menu"></a>
|
||||
|
||||
|
@ -147,3 +148,110 @@ Events and commands are not shown in the above code but can easily be added like
|
|||
In all the above code examples the `Label` values have been hard-coded. This is to make the samples simpler. To use localized text, set the `x:Uid` value for the `AppBarButton` and add a corresponding resource entry for "{name}.Label".
|
||||
|
||||
The examples also only show a single `AppBarButton` being added. This is to keep the code sample as simple as possible but you can add any appropriate content to the bar, as [documented here](https://docs.microsoft.com/en-us/windows/uwp/controls-and-patterns/app-bars).
|
||||
|
||||
<a name="invokecode"></a>
|
||||
|
||||
## Have the menu item invoke code rather than navigate
|
||||
|
||||
Extending the app to add this functionality requires making two changes.
|
||||
|
||||
1. Change the ShellNavigationItem to be able to handle an `Action`.
|
||||
1. Change the ShellPage or ShellViewModel to invoke the action.
|
||||
|
||||
In **ShellNavigationItem.cs** add the following
|
||||
|
||||
```csharp
|
||||
public Action Action { get; private set; }
|
||||
|
||||
private ShellNavigationItem(string label, Symbol symbol, Action action)
|
||||
: this(label, null)
|
||||
{
|
||||
Symbol = symbol;
|
||||
Action = action;
|
||||
}
|
||||
|
||||
public static ShellNavigationItem ForAction(string label, Symbol symbol, Action action)
|
||||
{
|
||||
return new ShellNavigationItem(label, symbol, action);
|
||||
}
|
||||
```
|
||||
|
||||
### If using CodeBehind
|
||||
|
||||
In **ShellPage.xaml.cs** change the `Navigate` method to be like this.
|
||||
|
||||
```csharp
|
||||
private void Navigate(object item)
|
||||
{
|
||||
var navigationItem = item as ShellNavigationItem;
|
||||
if (navigationItem != null)
|
||||
{
|
||||
if (navigationItem.Action != null)
|
||||
{
|
||||
navigationItem.Action.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
NavigationService.Navigate(navigationItem.PageType);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### If using MVVM Basic
|
||||
|
||||
In **ShellPageViewModel** change the `Navigate` method to be like this.
|
||||
|
||||
```csharp
|
||||
private void Navigate(object item)
|
||||
{
|
||||
var navigationItem = item as ShellNavigationItem;
|
||||
if (navigationItem != null)
|
||||
{
|
||||
if (navigationItem.Action != null)
|
||||
{
|
||||
navigationItem.Action.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
NavigationService.Navigate(navigationItem.PageType);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### If using MVVM Light
|
||||
|
||||
In **ShellPageViewModel** change the `Navigate` method to be like this.
|
||||
|
||||
```csharp
|
||||
private void Navigate(object item)
|
||||
{
|
||||
var navigationItem = item as ShellNavigationItem;
|
||||
if (navigationItem != null)
|
||||
{
|
||||
if (navigationItem.Action != null)
|
||||
{
|
||||
navigationItem.Action.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
NavigationService.Navigate(navigationItem.ViewModelName);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You can then add a menu item that uses the above.
|
||||
e.g. In `PopulateNavItems()` add something like this:
|
||||
|
||||
```csharp
|
||||
_secondaryItems.Add(
|
||||
ShellNavigationItem.ForAction(
|
||||
"Rate this app",
|
||||
Symbol.OutlineStar,
|
||||
async () => {
|
||||
await new Windows.UI.Popups.MessageDialog("5 stars please").ShowAsync();
|
||||
// .. code to launch the review process, etc.
|
||||
}));
|
||||
```
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "feature",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind|CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "1",
|
||||
"wts.group": "BackgroundWork",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "feature",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind|CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "5",
|
||||
"wts.group": "UserInteraction",
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "feature",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind|CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "2",
|
||||
"wts.group": "UserInteraction",
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "feature",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind|CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "4",
|
||||
"wts.group": "UserInteraction",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "feature",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind|CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "1",
|
||||
"wts.defaultInstance": "SampleDataService",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "feature",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind|CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "1",
|
||||
"wts.group": "ApplicationLifecycle",
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace Param_ItemNamespace.Helpers
|
|||
|
||||
if (string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
throw new ArgumentException("File name is null or empty. Specify a valid file name", nameof(fileName));
|
||||
throw new ArgumentException("ExceptionSettingsStorageExtensionsFileNameIsNullOrEmpty".GetLocalized(), nameof(fileName));
|
||||
}
|
||||
|
||||
var storageFile = await folder.CreateFileAsync(fileName, options);
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<!--{**-->
|
||||
<!--This xml blocks include string resources for adding the SettingsStorage to your project.-->
|
||||
<!--**}-->
|
||||
|
||||
<root>
|
||||
<!--^^-->
|
||||
<!--{[{-->
|
||||
<data name="ExceptionSettingsStorageExtensionsFileNameIsNullOrEmpty" xml:space="preserve">
|
||||
<value>File name is null or empty. Specify a valid file name</value>
|
||||
<comment>File name is null or empty to save file in settings storage extensions</comment>
|
||||
</data>
|
||||
<!--}]}-->
|
||||
</root>
|
|
@ -11,7 +11,7 @@
|
|||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "feature",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind|CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "2",
|
||||
"wts.group": "UserInteraction",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "feature",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind|CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "2",
|
||||
"wts.group": "ApplicationLifecycle",
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "feature",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind|CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "1",
|
||||
"wts.group": "UserInteraction",
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//**}
|
||||
//{[{
|
||||
using Param_RootNamespace.Helpers;
|
||||
using Param_RootNamespace.Services;
|
||||
//}]}
|
||||
|
||||
namespace Param_RootNamespace.Activation
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
using System;
|
||||
//{[{
|
||||
using Param_RootNamespace.Helpers;
|
||||
using Param_RootNamespace.Services;
|
||||
//}]}
|
||||
|
||||
namespace Param_ItemNamespace.Services
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "feature",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind|CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "6",
|
||||
"wts.group": "UserInteraction",
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "page",
|
||||
"wts.framework": "MVVMBasic|MVVMLight",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "1",
|
||||
"wts.genGroup": "0",
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "page",
|
||||
"wts.framework": "MVVMBasic|MVVMLight",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "7",
|
||||
"wts.licenses": "[Telerik.UI-For-UWP](https://github.com/telerik/UI-For-UWP/blob/master/LICENSE.md)",
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "page",
|
||||
"wts.framework": "MVVMBasic|MVVMLight",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "6",
|
||||
"wts.licenses": "[Telerik.UI-For-UWP](https://github.com/telerik/UI-For-UWP/blob/master/LICENSE.md)",
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
The map page is based around the Windows Map Control. Code includes adding a Map Icon and getting a location from the Location Service and setting the map's center point.
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">
|
||||
<Canvas Width="48" Height="48">
|
||||
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Fill="#000000">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M31 9.946l-15-5L0 10.279V42.387l16-5.333 15 5 16-5.333V4.613ZM17 7.388l13 4.333V39.612L17 35.279ZM2 11.721 15 7.388V35.279L2 39.613ZM45 35.279 32 39.612V11.721L45 7.387Z" FillRule="NonZero"/>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Canvas>
|
||||
</Viewbox>
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"author": "Nigel Sampson",
|
||||
"classifications": [ "Universal" ],
|
||||
"name": "Map",
|
||||
"groupIdentity": "wts.Page.Map",
|
||||
"identity": "wts.Page.Map.CaliburnMicro",
|
||||
"description": "The map page is based around the Windows Map Control. Code includes adding a Map Icon and getting your location.",
|
||||
"tags": {
|
||||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "page",
|
||||
"wts.framework": "CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "9",
|
||||
"wts.genGroup": "0",
|
||||
"wts.rightClickEnabled":"true"
|
||||
},
|
||||
"sourceName": "MapPage",
|
||||
"preferNameDirectory": true,
|
||||
"PrimaryOutputs":
|
||||
[
|
||||
{ "path": ".\\Views\\IMapPageView.cs" },
|
||||
{ "path": ".\\Views\\MapPagePage.xaml" },
|
||||
{ "path": ".\\Views\\MapPagePage.xaml.cs" },
|
||||
{ "path": ".\\ViewModels\\MapPageViewModel.cs" },
|
||||
{ "path": ".\\Assets\\map.png" },
|
||||
{ "path": ".\\Services\\LocationService.cs" }
|
||||
],
|
||||
"symbols": {
|
||||
"wts.rootNamespace": {
|
||||
"type": "parameter",
|
||||
"replaces": "Param_RootNamespace"
|
||||
},
|
||||
"wts.itemNamespace": {
|
||||
"type": "parameter",
|
||||
"replaces": "Param_ItemNamespace"
|
||||
},
|
||||
"baseclass": {
|
||||
"type": "parameter",
|
||||
"replaces": "System.ComponentModel.INotifyPropertyChanged"
|
||||
},
|
||||
"setter": {
|
||||
"type": "parameter",
|
||||
"replaces": "Set"
|
||||
}
|
||||
}
|
||||
}
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 683 B |
|
@ -0,0 +1,10 @@
|
|||
<!--{**-->
|
||||
<!--This xml block adds the location capability to your project.-->
|
||||
<!--**}-->
|
||||
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
<!--{[{-->
|
||||
<DeviceCapability Name="location" />
|
||||
<!--}]}-->
|
||||
</Capabilities>
|
|
@ -0,0 +1,123 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Geolocation;
|
||||
|
||||
namespace Param_ItemNamespace.Services
|
||||
{
|
||||
public class LocationService
|
||||
{
|
||||
private Geolocator geolocator;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when the current position is updated.
|
||||
/// </summary>
|
||||
public event EventHandler<Geoposition> PositionChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the last known recorded position.
|
||||
/// </summary>
|
||||
public Geoposition CurrentPosition { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the location service with a default accuracy (100 meters) and movement threshold.
|
||||
/// </summary>
|
||||
/// <returns>True if the initialization was successful and the service can be used.</returns>
|
||||
public Task<bool> InitializeAsync()
|
||||
{
|
||||
return InitializeAsync(100);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the location service with the specified accuracy and default movement threshold.
|
||||
/// </summary>
|
||||
/// <param name="desiredAccuracyInMeters">The desired accuracy at which the service provides location updates.</param>
|
||||
/// <returns>True if the initialization was successful and the service can be used.</returns>
|
||||
public Task<bool> InitializeAsync(uint desiredAccuracyInMeters)
|
||||
{
|
||||
return InitializeAsync(desiredAccuracyInMeters, (double)desiredAccuracyInMeters / 2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the location service with the specified accuracy and movement threshold.
|
||||
/// </summary>
|
||||
/// <param name="desiredAccuracyInMeters">The desired accuracy at which the service provides location updates.</param>
|
||||
/// <param name="movementThreshold">The distance of movement, in meters, that is required for the service to raise the PositionChanged event.</param>
|
||||
/// <returns>True if the initialization was successful and the service can be used.</returns>
|
||||
public async Task<bool> InitializeAsync(uint desiredAccuracyInMeters, double movementThreshold)
|
||||
{
|
||||
// to find out more about getting location, go to https://docs.microsoft.com/en-us/windows/uwp/maps-and-location/get-location
|
||||
if (geolocator != null)
|
||||
{
|
||||
geolocator.PositionChanged -= GeolocatorOnPositionChanged;
|
||||
geolocator = null;
|
||||
}
|
||||
|
||||
var access = await Geolocator.RequestAccessAsync();
|
||||
|
||||
bool result;
|
||||
|
||||
switch (access)
|
||||
{
|
||||
case GeolocationAccessStatus.Allowed:
|
||||
geolocator = new Geolocator
|
||||
{
|
||||
DesiredAccuracyInMeters = desiredAccuracyInMeters,
|
||||
MovementThreshold = movementThreshold
|
||||
};
|
||||
result = true;
|
||||
break;
|
||||
case GeolocationAccessStatus.Unspecified:
|
||||
case GeolocationAccessStatus.Denied:
|
||||
default:
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the service listening for location updates.
|
||||
/// </summary>
|
||||
/// <returns>An object that is used to manage the asynchronous operation.</returns>
|
||||
public async Task StartListeningAsync()
|
||||
{
|
||||
if (geolocator == null)
|
||||
{
|
||||
throw new InvalidOperationException("The StartListening method cannot be called before the InitializeAsync method.");
|
||||
}
|
||||
|
||||
geolocator.PositionChanged += GeolocatorOnPositionChanged;
|
||||
|
||||
CurrentPosition = await geolocator.GetGeopositionAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the service listening for location updates.
|
||||
/// </summary>
|
||||
public void StopListening()
|
||||
{
|
||||
if (geolocator == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
geolocator.PositionChanged -= GeolocatorOnPositionChanged;
|
||||
}
|
||||
|
||||
private async void GeolocatorOnPositionChanged(Geolocator sender, PositionChangedEventArgs args)
|
||||
{
|
||||
if (args == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CurrentPosition = args.Position;
|
||||
|
||||
await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
|
||||
{
|
||||
PositionChanged?.Invoke(this, CurrentPosition);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<!--{**-->
|
||||
<!--This xml blocks include string resources for the MapPagePage to your project.-->
|
||||
<!--**}-->
|
||||
|
||||
<root>
|
||||
<!--^^-->
|
||||
<!--{[{-->
|
||||
<data name="Map_YourLocation" xml:space="preserve">
|
||||
<value>Your location</value>
|
||||
</data>
|
||||
<!--}]}-->
|
||||
</root>
|
|
@ -0,0 +1,111 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Storage.Streams;
|
||||
using Windows.UI.Xaml.Controls.Maps;
|
||||
using Param_ItemNamespace.Helpers;
|
||||
using Param_ItemNamespace.Services;
|
||||
using Param_ItemNamespace.Views;
|
||||
|
||||
namespace Param_ItemNamespace.ViewModels
|
||||
{
|
||||
public class MapPageViewModel : System.ComponentModel.INotifyPropertyChanged
|
||||
{
|
||||
// TODO WTS: Specify your preferred default zoom level
|
||||
private const double DefaultZoomLevel = 17;
|
||||
|
||||
private readonly LocationService locationService;
|
||||
|
||||
// TODO WTS: Specify your preferred default location if a geolock can't be found.
|
||||
private readonly BasicGeoposition defaultPosition = new BasicGeoposition()
|
||||
{
|
||||
Latitude = 47.609425,
|
||||
Longitude = -122.3417
|
||||
};
|
||||
|
||||
private double _zoomLevel;
|
||||
|
||||
public double ZoomLevel
|
||||
{
|
||||
get { return _zoomLevel; }
|
||||
set { Set(ref _zoomLevel, value); }
|
||||
}
|
||||
|
||||
private Geopoint _center;
|
||||
|
||||
public Geopoint Center
|
||||
{
|
||||
get { return _center; }
|
||||
set { Set(ref _center, value); }
|
||||
}
|
||||
|
||||
private string _mapServiceToken;
|
||||
|
||||
public string MapServiceToken
|
||||
{
|
||||
get { return _mapServiceToken; }
|
||||
set { Set(ref _mapServiceToken, value); }
|
||||
}
|
||||
|
||||
public MapPageViewModel()
|
||||
{
|
||||
locationService = new LocationService();
|
||||
Center = new Geopoint(defaultPosition);
|
||||
ZoomLevel = DefaultZoomLevel;
|
||||
}
|
||||
|
||||
protected override async void OnActivate()
|
||||
{
|
||||
base.OnActivate();
|
||||
|
||||
if (locationService != null)
|
||||
{
|
||||
locationService.PositionChanged += LocationServicePositionChanged;
|
||||
|
||||
var initializationSuccessful = await locationService.InitializeAsync();
|
||||
|
||||
if (initializationSuccessful)
|
||||
{
|
||||
await locationService.StartListeningAsync();
|
||||
}
|
||||
|
||||
if (initializationSuccessful && locationService.CurrentPosition != null)
|
||||
{
|
||||
Center = locationService.CurrentPosition.Coordinate.Point;
|
||||
}
|
||||
else
|
||||
{
|
||||
Center = new Geopoint(defaultPosition);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO WTS: Specify your map service token. If you don't have one, request at https://www.bingmapsportal.com/
|
||||
MapServiceToken = string.Empty;
|
||||
|
||||
var view = GetView() as IMapPageView;
|
||||
|
||||
view?.AddMapIcon(Center, "Map_YourLocation".GetLocalized());
|
||||
}
|
||||
|
||||
protected override void OnDeactivate(bool close)
|
||||
{
|
||||
base.OnDeactivate(close);
|
||||
|
||||
if (locationService != null)
|
||||
{
|
||||
locationService.PositionChanged -= LocationServicePositionChanged;
|
||||
locationService.StopListening();
|
||||
}
|
||||
}
|
||||
|
||||
private void LocationServicePositionChanged(object sender, Geoposition geoposition)
|
||||
{
|
||||
if (geoposition != null)
|
||||
{
|
||||
Center = geoposition.Coordinate.Point;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
using Windows.Devices.Geolocation;
|
||||
|
||||
namespace Param_ItemNamespace.Views
|
||||
{
|
||||
public interface IMapPageView
|
||||
{
|
||||
void AddMapIcon(Geopoint position, string title);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<Page
|
||||
x:Class="Param_ItemNamespace.Views.MapPagePage"
|
||||
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:maps="using:Windows.UI.Xaml.Controls.Maps"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<maps:MapControl
|
||||
x:Name="mapControl"
|
||||
ZoomLevel="{x:Bind ViewModel.ZoomLevel, Mode=OneWay}"
|
||||
Center="{x:Bind ViewModel.Center, Mode=OneWay}"/>
|
||||
<TickBar/>
|
||||
</Grid>
|
||||
</Page>
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Storage.Streams;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Maps;
|
||||
|
||||
namespace Param_ItemNamespace.Views
|
||||
{
|
||||
public sealed partial class MapPagePage : Page, IMapPageView
|
||||
{
|
||||
public MapPagePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void AddMapIcon(Geopoint position, string title)
|
||||
{
|
||||
var mapIcon = new MapIcon()
|
||||
{
|
||||
Location = position,
|
||||
NormalizedAnchorPoint = new Point(0.5, 1.0),
|
||||
Title = title,
|
||||
Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/map.png")),
|
||||
ZIndex = 0
|
||||
};
|
||||
|
||||
mapControl.MapElements.Add(mapIcon);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Param_ItemNamespace.Helpers;
|
||||
|
||||
namespace Param_ItemNamespace.Services
|
||||
{
|
||||
|
@ -84,7 +85,7 @@ namespace Param_ItemNamespace.Services
|
|||
{
|
||||
if (geolocator == null)
|
||||
{
|
||||
throw new InvalidOperationException("The StartListening method cannot be called before the InitializeAsync method.");
|
||||
throw new InvalidOperationException("ExceptionLocationServiceStartListeningCanNotBeCalled".GetLocalized());
|
||||
}
|
||||
|
||||
geolocator.PositionChanged += Geolocator_PositionChanged;
|
||||
|
|
|
@ -9,5 +9,9 @@
|
|||
<value>Your location</value>
|
||||
<comment>Your location text on map page</comment>
|
||||
</data>
|
||||
<data name="ExceptionLocationServiceStartListeningCanNotBeCalled" xml:space="preserve">
|
||||
<value>The StartListening method cannot be called before the InitializeAsync method.</value>
|
||||
<comment>Start listening cannot be called before the initialize in location service</comment>
|
||||
</data>
|
||||
<!--}]}-->
|
||||
</root>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Geolocation;
|
||||
using Param_ItemNamespace.Helpers;
|
||||
|
||||
namespace Param_ItemNamespace.Services
|
||||
{
|
||||
|
@ -84,7 +85,7 @@ namespace Param_ItemNamespace.Services
|
|||
{
|
||||
if (geolocator == null)
|
||||
{
|
||||
throw new InvalidOperationException("The StartListening method cannot be called before the InitializeAsync method.");
|
||||
throw new InvalidOperationException("ExceptionLocationServiceStartListeningCanNotBeCalled".GetLocalized());
|
||||
}
|
||||
|
||||
geolocator.PositionChanged += Geolocator_PositionChanged;
|
||||
|
|
|
@ -9,5 +9,9 @@
|
|||
<value>Your location</value>
|
||||
<comment>Your location text on map page</comment>
|
||||
</data>
|
||||
<data name="ExceptionLocationServiceStartListeningCanNotBeCalled" xml:space="preserve">
|
||||
<value>The StartListening method cannot be called before the InitializeAsync method.</value>
|
||||
<comment>Start listening cannot be called before the initialize in location service</comment>
|
||||
</data>
|
||||
<!--}]}-->
|
||||
</root>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
The master-detail page has a master pane and a details pane for content. When an item in the master list is selected, the details pane is updated. This pattern is frequently used for email and address books.
|
||||
|
||||
More information about the master-detail pattern can be found [docs.microsoft.com](https://docs.microsoft.com/en-us/windows/uwp/controls-and-patterns/master-details).
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">
|
||||
<Canvas Width="48" Height="48">
|
||||
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Fill="#000000">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M13 4H0V42H48V4ZM12 6V16H2V6ZM2 40V22H12V40Zm44 0H14V6H46ZM9 13H5V9H9Zm19-1H18V10H28ZM9 25v4H5V25ZM5 32H9v4H5ZM42 16H18V36H42ZM40 34H20V18H40Z" FillRule="NonZero"/>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Canvas>
|
||||
</Viewbox>
|
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
"author": "Nigel Sampson",
|
||||
"classifications": [
|
||||
"Universal"
|
||||
],
|
||||
"name": "Master/Detail",
|
||||
"groupIdentity": "wts.Page.MasterDetail",
|
||||
"identity": "wts.Page.MasterDetail.CaliburnMicro",
|
||||
"description": "The master-detail page has a master pane and a details pane for content.",
|
||||
"tags": {
|
||||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "page",
|
||||
"wts.framework": "CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "5",
|
||||
"wts.dependencies": "wts.Feat.SampleDataService",
|
||||
"wts.genGroup": "0",
|
||||
"wts.rightClickEnabled":"true"
|
||||
},
|
||||
"sourceName": "MasterDetailsItem",
|
||||
"preferNameDirectory": true,
|
||||
"PrimaryOutputs": [
|
||||
{
|
||||
"path": ".\\Views\\MasterDetailsItemPage.xaml"
|
||||
},
|
||||
{
|
||||
"path": ".\\Views\\MasterDetailsItemPage.xaml.cs"
|
||||
},
|
||||
{
|
||||
"path": ".\\Views\\MasterDetailsItemDetail\\DetailsView.xaml"
|
||||
},
|
||||
{
|
||||
"path": ".\\Views\\MasterDetailsItemDetail\\DetailsView.xaml.cs"
|
||||
},
|
||||
{
|
||||
"path": ".\\Views\\MasterDetailsItemDetail\\MasterView.xaml"
|
||||
},
|
||||
{
|
||||
"path": ".\\Views\\MasterDetailsItemDetail\\MasterView.xaml.cs"
|
||||
},
|
||||
{
|
||||
"path": ".\\ViewModels\\MasterDetailsItemViewModel.cs"
|
||||
},
|
||||
{
|
||||
"path": ".\\ViewModels\\MasterDetailsItemDetailViewModel.cs"
|
||||
}
|
||||
],
|
||||
"symbols": {
|
||||
"wts.rootNamespace": {
|
||||
"type": "parameter",
|
||||
"replaces": "Param_RootNamespace"
|
||||
},
|
||||
"wts.itemNamespace": {
|
||||
"type": "parameter",
|
||||
"replaces": "Param_ItemNamespace"
|
||||
},
|
||||
"baseclass": {
|
||||
"type": "parameter",
|
||||
"replaces": "System.ComponentModel.INotifyPropertyChanged"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<!--{**-->
|
||||
<!--This xml blocks include string resources for the MasterDetailsItemPage to your project.-->
|
||||
<!--**}-->
|
||||
|
||||
<root>
|
||||
<!--^^-->
|
||||
<!--{[{-->
|
||||
<data name="MasterDetailsItemPage_Title.Text" xml:space="preserve">
|
||||
<value>MasterDetailsItem</value>
|
||||
</data>
|
||||
<!--}]}-->
|
||||
</root>
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using Caliburn.Micro;
|
||||
using Param_ItemNamespace.Models;
|
||||
|
||||
namespace Param_ItemNamespace.ViewModels
|
||||
{
|
||||
public class MasterDetailsItemDetailViewModel : System.ComponentModel.INotifyPropertyChanged
|
||||
{
|
||||
public MasterDetailsItemDetailViewModel(SampleOrder item)
|
||||
{
|
||||
Item = item;
|
||||
}
|
||||
|
||||
public SampleOrder Item { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Caliburn.Micro;
|
||||
using Param_ItemNamespace.Services;
|
||||
|
||||
namespace Param_ItemNamespace.ViewModels
|
||||
{
|
||||
public class MasterDetailsItemViewModel : Conductor<MasterDetailsItemDetailViewModel>.Collection.OneActive
|
||||
{
|
||||
protected override async void OnInitialize()
|
||||
{
|
||||
base.OnInitialize();
|
||||
|
||||
await LoadDataAsync();
|
||||
}
|
||||
|
||||
public async Task LoadDataAsync()
|
||||
{
|
||||
Items.Clear();
|
||||
|
||||
var data = await SampleDataService.GetSampleModelDataAsync();
|
||||
|
||||
Items.AddRange(data.Select(d => new MasterDetailsItemDetailViewModel(d)));
|
||||
|
||||
ActiveItem = Items.First();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<UserControl
|
||||
x:Class="Param_ItemNamespace.Views.MasterDetailsItemDetail.DetailsView"
|
||||
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"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="400">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="48"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock
|
||||
x:Name="TitlePage"
|
||||
Text="{x:Bind ViewModel.Item.OrderId}"
|
||||
Style="{StaticResource PageTitleStyle}" />
|
||||
|
||||
<ScrollViewer
|
||||
Grid.Row="1"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ScrollViewer.VerticalScrollMode="Auto">
|
||||
|
||||
<!--The SystemControlPageBackgroundChromeLowBrush background represents where you should place your detail content.-->
|
||||
<Grid Background="{ThemeResource SystemControlPageBackgroundChromeLowBrush}">
|
||||
|
||||
<!--Replate this StackPanel with your detail content.-->
|
||||
<StackPanel Orientation="Vertical" Margin="{StaticResource MediumLeftTopRightBottomMargin}">
|
||||
<TextBlock Text="Order Date" Style="{StaticResource CaptionTextBlockStyle}" />
|
||||
<TextBlock Text="{x:Bind ViewModel.Item.OrderDate}" Style="{StaticResource BodyTextStyle}" />
|
||||
<TextBlock Text="Company" Style="{StaticResource CaptionTextBlockStyle}" />
|
||||
<TextBlock Text="{x:Bind ViewModel.Item.Company}" Style="{StaticResource BodyTextStyle}" />
|
||||
<TextBlock Text="Ship to" Style="{StaticResource CaptionTextBlockStyle}" />
|
||||
<TextBlock Text="{x:Bind ViewModel.Item.ShipTo}" Style="{StaticResource BodyTextStyle}" />
|
||||
<TextBlock Text="Order Total" Style="{StaticResource CaptionTextBlockStyle}" />
|
||||
<TextBlock Text="{x:Bind ViewModel.Item.OrderTotal}" Style="{StaticResource BodyTextStyle}" />
|
||||
<TextBlock Text="Status" Style="{StaticResource CaptionTextBlockStyle}" />
|
||||
<TextBlock Text="{x:Bind ViewModel.Item.Status}" Style="{StaticResource BodyTextStyle}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</UserControl>
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using Param_ItemNamespace.ViewModels;
|
||||
|
||||
namespace Param_ItemNamespace.Views.MasterDetailsItemDetail
|
||||
{
|
||||
public sealed partial class DetailsView
|
||||
{
|
||||
public DetailsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public MasterDetailsItemDetailViewModel ViewModel => DataContext as MasterDetailsItemDetailViewModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<UserControl
|
||||
x:Class="Param_ItemNamespace.Views.MasterDetailsItemDetail.MasterView"
|
||||
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"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="400">
|
||||
|
||||
<Grid Margin="{StaticResource MediumLeftTopRightBottomMargin}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Text="{x:Bind ViewModel.Item.OrderId}"
|
||||
Style="{StaticResource ListTitleStyle}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Text="{x:Bind ViewModel.Item.Company}"
|
||||
Style="{StaticResource ListSubTitleStyle}" />
|
||||
</Grid>
|
||||
</UserControl>
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using Param_ItemNamespace.ViewModels;
|
||||
|
||||
namespace Param_ItemNamespace.Views.MasterDetailsItemDetail
|
||||
{
|
||||
public sealed partial class MasterView
|
||||
{
|
||||
public MasterView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public MasterDetailsItemDetailViewModel ViewModel => DataContext as MasterDetailsItemDetailViewModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
<Page
|
||||
x:Class="Param_ItemNamespace.Views.MasterDetailsItemPage"
|
||||
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:model="using:Param_ItemNamespace.Models"
|
||||
xmlns:views="using:Param_ItemNamespace.Views"
|
||||
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:i="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:cm="using:Caliburn.Micro"
|
||||
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid
|
||||
x:Name="ContentArea"
|
||||
Padding="12,0,12,0">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition x:Name="TitleRow" Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock
|
||||
x:Name="TitlePage"
|
||||
x:Uid="MasterDetailsItemPage_Title"
|
||||
Style="{StaticResource PageTitleStyle}"/>
|
||||
|
||||
<controls:MasterDetailsView
|
||||
Grid.Row="1"
|
||||
ItemsSource="{x:Bind ViewModel.Items}"
|
||||
SelectedItem="{x:Bind ViewModel.ActiveItem}"
|
||||
BorderBrush="Transparent">
|
||||
<controls:MasterDetailsView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ContentControl cm:View.Model="{Binding}" cm:View.Context="MasterView" />
|
||||
</DataTemplate>
|
||||
</controls:MasterDetailsView.ItemTemplate>
|
||||
<controls:MasterDetailsView.DetailsTemplate>
|
||||
<DataTemplate>
|
||||
<ContentControl cm:View.Model="{Binding}" cm:View.Context="DetailsView" Margin="12,0,0,0"
|
||||
HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
|
||||
</DataTemplate>
|
||||
</controls:MasterDetailsView.DetailsTemplate>
|
||||
</controls:MasterDetailsView>
|
||||
|
||||
<!-- Adaptive triggers -->
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="WindowStates">
|
||||
<VisualState x:Name="WideState">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="640"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ContentArea.Padding" Value="12,0,12,0"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="NarrowState">
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="0"/>
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="TitleRow.Height" Value="48"/>
|
||||
<Setter Target="TitlePage.Visibility" Value="Visible"/>
|
||||
<Setter Target="Title.Visibility" Value="Collapsed"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</Grid>
|
||||
</Page>
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Param_ItemNamespace.Views
|
||||
{
|
||||
public sealed partial class MasterDetailsItemPage : Page
|
||||
{
|
||||
public MasterDetailsItemPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<!-- Nuget package references -->
|
||||
<!--{[{-->
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls">
|
||||
<Version>1.5.0</Version>
|
||||
</PackageReference>
|
||||
<!--}]}-->
|
|
@ -11,7 +11,7 @@
|
|||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "page",
|
||||
"wts.framework": "MVVMBasic|MVVMLight",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "4",
|
||||
"wts.genGroup": "0",
|
||||
|
@ -42,6 +42,10 @@
|
|||
"baseclass": {
|
||||
"type": "parameter",
|
||||
"replaces": "System.ComponentModel.INotifyPropertyChanged"
|
||||
},
|
||||
"setter": {
|
||||
"type": "parameter",
|
||||
"replaces": "Set"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace Param_ItemNamespace.ViewModels
|
|||
{
|
||||
public class MediaPlayerViewViewModel : System.ComponentModel.INotifyPropertyChanged
|
||||
{
|
||||
// TODO WTS: Set your video default and image here
|
||||
// TODO WTS: Specify your video default and image here
|
||||
private const string DefaultSource = "https://sec.ch9.ms/ch9/db15/43c9fbed-535e-4013-8a4a-a74cc00adb15/C9L12WinTemplateStudio_high.mp4";
|
||||
|
||||
// The poster image is displayed until the video is started
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
The settings page is the page where we recommend putting the configuration settings for your application such as setting a dark / light theme. This could also include any licenses, version number and your privacy terms.
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">
|
||||
<Canvas Width="48" Height="48">
|
||||
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Fill="#000000">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M29.414 4H8V44H40V14.586ZM30 7.414 36.586 14H30ZM10 42V6H28V16H38V42ZM31.106 24.654l-2.344.971a5.877 5.877 0 0 0-1.388-1.388l.971-2.344L26.188 21l-.95 2.293a5.8 5.8 0 0 0-2.219-.049L22.088 21l-2.158.894.911 2.2a5.874 5.874 0 0 0-1.6 1.534l-2.344-.971L16 26.812l2.293.95a5.794 5.794 0 0 0-.049 2.219L16 30.912l.894 2.158 2.2-.911a5.87 5.87 0 0 0 1.749 1.749l-.911 2.2L22.088 37l.93-2.244a5.8 5.8 0 0 0 2.219-.049L26.188 37l2.158-.894-.971-2.344a5.884 5.884 0 0 0 1.534-1.6l2.1.929.975-2.184-2.227-.923a5.794 5.794 0 0 0-.049-2.219L32 26.812ZM24 32.5A3.5 3.5 0 1 1 27.5 29 3.506 3.506 0 0 1 24 32.5Z" FillRule="NonZero"/>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Canvas>
|
||||
</Viewbox>
|
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"author": "Nigel Sampson",
|
||||
"classifications": [
|
||||
"Universal"
|
||||
],
|
||||
"name": "Settings",
|
||||
"groupIdentity": "wts.Page.Settings",
|
||||
"identity": "wts.Page.Settings.CaliburnMicro",
|
||||
"description": "The settings page is the page where we recommend putting the configuration settings for your app.",
|
||||
"tags": {
|
||||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "page",
|
||||
"wts.framework": "CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "2",
|
||||
"wts.dependencies":"wts.Feat.SettingsStorage",
|
||||
"wts.multipleInstance": "false",
|
||||
"wts.genGroup": "1",
|
||||
"wts.rightClickEnabled":"true"
|
||||
},
|
||||
"sourceName": "SettingsPage",
|
||||
"preferNameDirectory": true,
|
||||
"PrimaryOutputs": [
|
||||
{
|
||||
"path": ".\\Helpers\\EnumToBooleanConverter.cs"
|
||||
},
|
||||
{
|
||||
"path": ".\\Views\\SettingsPagePage.xaml"
|
||||
},
|
||||
{
|
||||
"path": ".\\Views\\SettingsPagePage.xaml.cs"
|
||||
},
|
||||
{
|
||||
"path": ".\\ViewModels\\SettingsPageViewModel.cs"
|
||||
},
|
||||
{
|
||||
"path": ".\\Services\\ThemeSelectorService.cs"
|
||||
}
|
||||
],
|
||||
"symbols": {
|
||||
"wts.rootNamespace": {
|
||||
"type": "parameter",
|
||||
"replaces": "Param_RootNamespace"
|
||||
},
|
||||
"wts.itemNamespace": {
|
||||
"type": "parameter",
|
||||
"replaces": "Param_ItemNamespace"
|
||||
},
|
||||
"baseclass": {
|
||||
"type": "parameter",
|
||||
"replaces": "System.ComponentModel.INotifyPropertyChanged"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
namespace Param_RootNamespace.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!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
//{**
|
||||
// These code blocks add the ThemeSelectorService initialization to the ActivationService of your project.
|
||||
//**}
|
||||
|
||||
private async Task InitializeAsync()
|
||||
{
|
||||
//{[{
|
||||
await ThemeSelectorService.InitializeAsync();
|
||||
//}]}
|
||||
}
|
||||
|
||||
private async Task StartupAsync()
|
||||
{
|
||||
//{[{
|
||||
ThemeSelectorService.SetRequestedTheme();
|
||||
//}]}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Windows.Storage;
|
||||
using Windows.UI.Xaml;
|
||||
|
||||
using Param_RootNamespace.Helpers;
|
||||
|
||||
namespace Param_RootNamespace.Services
|
||||
{
|
||||
public static class ThemeSelectorService
|
||||
{
|
||||
private const string SettingsKey = "RequestedTheme";
|
||||
|
||||
public static ElementTheme Theme { get; set; } = ElementTheme.Default;
|
||||
|
||||
public static async Task InitializeAsync()
|
||||
{
|
||||
Theme = await LoadThemeFromSettingsAsync();
|
||||
}
|
||||
|
||||
public static async Task SetThemeAsync(ElementTheme theme)
|
||||
{
|
||||
Theme = theme;
|
||||
|
||||
SetRequestedTheme();
|
||||
await SaveThemeInSettingsAsync(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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<!--{**-->
|
||||
<!--This xml blocks include string resources for the SettingsPagePage to your project.-->
|
||||
<!--**}-->
|
||||
|
||||
<root>
|
||||
<!--^^-->
|
||||
<!--{[{-->
|
||||
<data name="SettingsPage_Title.Text" xml:space="preserve">
|
||||
<value>SettingsPage</value>
|
||||
</data>
|
||||
<data name="SettingsPage_Theme.Text" xml:space="preserve">
|
||||
<value>Choose Theme</value>
|
||||
</data>
|
||||
<data name="SettingsPage_Theme_Dark.Content" xml:space="preserve">
|
||||
<value>Dark</value>
|
||||
</data>
|
||||
<data name="SettingsPage_Theme_Default.Content" xml:space="preserve">
|
||||
<value>Windows default</value>
|
||||
</data>
|
||||
<data name="SettingsPage_Theme_Light.Content" xml:space="preserve">
|
||||
<value>Light</value>
|
||||
</data>
|
||||
<data name="SettingsPage_About.Text" xml:space="preserve">
|
||||
<value>About this application</value>
|
||||
</data>
|
||||
<data name="SettingsPage_AboutDescription.Text" xml:space="preserve">
|
||||
<value>Settings page placeholder text. Your app description goes here.</value>
|
||||
</data>
|
||||
<data name="SettingsPage_PrivacyTermsLink.Content" xml:space="preserve">
|
||||
<value>Privacy Statement</value>
|
||||
</data>
|
||||
<data name="SettingsPage_PrivacyTermsLink.NavigateUri" xml:space="preserve">
|
||||
<value>https://YourPrivacyUrlGoesHere/</value>
|
||||
</data>
|
||||
<data name="SettingsPage_Personalization.Text" xml:space="preserve">
|
||||
<value>Personalization</value>
|
||||
</data>
|
||||
NavigateUri
|
||||
<!--}]}-->
|
||||
</root>
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Windows.Input;
|
||||
using Param_RootNamespace.Services;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.UI.Xaml;
|
||||
|
||||
namespace Param_ItemNamespace.ViewModels
|
||||
{
|
||||
public class SettingsPageViewModel : System.ComponentModel.INotifyPropertyChanged
|
||||
{
|
||||
// TODO WTS: Add other settings as necessary. For help see https://github.com/Microsoft/WindowsTemplateStudio/blob/master/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); }
|
||||
}
|
||||
|
||||
public async void SwitchTheme(ElementTheme theme)
|
||||
{
|
||||
await ThemeSelectorService.SetThemeAsync(theme);
|
||||
}
|
||||
|
||||
public SettingsPageViewModel()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
base.OnInitialize();
|
||||
|
||||
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}";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
<Page
|
||||
x:Class="Param_ItemNamespace.Views.SettingsPagePage"
|
||||
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:Param_ItemNamespace.Helpers"
|
||||
xmlns:xaml="using:Windows.UI.Xaml"
|
||||
xmlns:cm="using:Caliburn.Micro"
|
||||
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="SettingsPage_Title"
|
||||
x:Name="TitlePage"
|
||||
Style="{StaticResource PageTitleStyle}" />
|
||||
|
||||
<StackPanel Grid.Row="1">
|
||||
<TextBlock
|
||||
x:Uid="SettingsPage_Personalization"
|
||||
Style="{StaticResource SubtitleTextBlockStyle}" />
|
||||
|
||||
<StackPanel Margin="{StaticResource SettingsSubheaderMargin}">
|
||||
<TextBlock
|
||||
x:Uid="SettingsPage_Theme"
|
||||
Style="{StaticResource BodyTextStyle}" />
|
||||
|
||||
<StackPanel Margin="{StaticResource EightTopMargin}">
|
||||
<RadioButton
|
||||
x:Name="ThemeLightButton"
|
||||
x:Uid="SettingsPage_Theme_Light"
|
||||
GroupName="AppTheme"
|
||||
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Light, Mode=TwoWay}"
|
||||
cm:Message.Attach="SwitchTheme(ThemeLightButton.Tag)">
|
||||
<RadioButton.Tag>
|
||||
<xaml:ElementTheme>Light</xaml:ElementTheme>
|
||||
</RadioButton.Tag>
|
||||
</RadioButton>
|
||||
<RadioButton
|
||||
x:Name="ThemeDarkButton"
|
||||
x:Uid="SettingsPage_Theme_Dark"
|
||||
GroupName="AppTheme"
|
||||
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Dark, Mode=TwoWay}"
|
||||
cm:Message.Attach="SwitchTheme(ThemeDarkButton.Tag)">
|
||||
<RadioButton.Tag>
|
||||
<xaml:ElementTheme>Dark</xaml:ElementTheme>
|
||||
</RadioButton.Tag>
|
||||
</RadioButton>
|
||||
<RadioButton
|
||||
x:Name="ThemeDefaultButton"
|
||||
x:Uid="SettingsPage_Theme_Default"
|
||||
GroupName="AppTheme"
|
||||
IsChecked="{x:Bind ViewModel.ElementTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Default, Mode=TwoWay}"
|
||||
cm:Message.Attach="SwitchTheme(ThemeDefaultButton.Tag)">
|
||||
<RadioButton.Tag>
|
||||
<xaml:ElementTheme>Default</xaml:ElementTheme>
|
||||
</RadioButton.Tag>
|
||||
</RadioButton>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock
|
||||
x:Uid="SettingsPage_About"
|
||||
Style="{StaticResource SubtitleTextBlockStyle}"/>
|
||||
|
||||
<StackPanel Margin="{StaticResource EightTopMargin}">
|
||||
<TextBlock
|
||||
Text="{x:Bind ViewModel.VersionDescription, Mode=OneWay}" />
|
||||
<TextBlock
|
||||
x:Uid="SettingsPage_AboutDescription"
|
||||
Margin="{StaticResource EightTopMargin}" />
|
||||
|
||||
<HyperlinkButton
|
||||
x:Uid="SettingsPage_PrivacyTermsLink"
|
||||
Margin="{StaticResource EightTopMargin}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Page>
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Param_ItemNamespace.Views
|
||||
{
|
||||
public sealed partial class SettingsPagePage : Page
|
||||
{
|
||||
//// TODO WTS: Change the URL for your privacy policy in the Resource File, currently set to https://YourPrivacyUrlGoesHere
|
||||
|
||||
public SettingsPagePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ namespace Param_RootNamespace.Helpers
|
|||
{
|
||||
if (!Enum.IsDefined(EnumType, value))
|
||||
{
|
||||
throw new ArgumentException("value must be an Enum!");
|
||||
throw new ArgumentException("ExceptionEnumToBooleanConverterValueMustBeAnEnum".GetLocalized());
|
||||
}
|
||||
|
||||
var enumValue = Enum.Parse(EnumType, enumString);
|
||||
|
@ -22,7 +22,7 @@ namespace Param_RootNamespace.Helpers
|
|||
return enumValue.Equals(value);
|
||||
}
|
||||
|
||||
throw new ArgumentException("parameter must be an Enum name!");
|
||||
throw new ArgumentException("ExceptionEnumToBooleanConverterParameterMustBeAnEnumName".GetLocalized());
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
|
@ -32,7 +32,7 @@ namespace Param_RootNamespace.Helpers
|
|||
return Enum.Parse(EnumType, enumString);
|
||||
}
|
||||
|
||||
throw new ArgumentException("parameter must be an Enum name!");
|
||||
throw new ArgumentException("ExceptionEnumToBooleanConverterParameterMustBeAnEnumName".GetLocalized());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,6 +45,14 @@
|
|||
<value>Personalization</value>
|
||||
<comment>Personalization text for SettingsPage</comment>
|
||||
</data>
|
||||
<data name="ExceptionEnumToBooleanConverterValueMustBeAnEnum" xml:space="preserve">
|
||||
<value>value must be an Enum!</value>
|
||||
<comment>Value must be an Enum in enum to boolean converter</comment>
|
||||
</data>
|
||||
<data name="ExceptionEnumToBooleanConverterParameterMustBeAnEnumName" xml:space="preserve">
|
||||
<value>parameter must be an Enum name!</value>
|
||||
<comment>Parameter must be an Enum name in enum to boolean converter</comment>
|
||||
</data>
|
||||
NavigateUri
|
||||
<!--}]}-->
|
||||
</root>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Param_RootNamespace.Helpers
|
|||
{
|
||||
if (!Enum.IsDefined(EnumType, value))
|
||||
{
|
||||
throw new ArgumentException("value must be an Enum!");
|
||||
throw new ArgumentException("ExceptionEnumToBooleanConverterValueMustBeAnEnum".GetLocalized());
|
||||
}
|
||||
|
||||
var enumValue = Enum.Parse(EnumType, enumString);
|
||||
|
@ -22,7 +22,7 @@ namespace Param_RootNamespace.Helpers
|
|||
return enumValue.Equals(value);
|
||||
}
|
||||
|
||||
throw new ArgumentException("parameter must be an Enum name!");
|
||||
throw new ArgumentException("ExceptionEnumToBooleanConverterParameterMustBeAnEnumName".GetLocalized());
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
|
@ -32,7 +32,7 @@ namespace Param_RootNamespace.Helpers
|
|||
return Enum.Parse(EnumType, enumString);
|
||||
}
|
||||
|
||||
throw new ArgumentException("parameter must be an Enum name!");
|
||||
throw new ArgumentException("ExceptionEnumToBooleanConverterParameterMustBeAnEnumName".GetLocalized());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,6 +45,14 @@
|
|||
<value>Personalization</value>
|
||||
<comment>Personalization text for SettingsPage</comment>
|
||||
</data>
|
||||
<data name="ExceptionEnumToBooleanConverterValueMustBeAnEnum" xml:space="preserve">
|
||||
<value>value must be an Enum!</value>
|
||||
<comment>Value must be an Enum in enum to boolean converter</comment>
|
||||
</data>
|
||||
<data name="ExceptionEnumToBooleanConverterParameterMustBeAnEnumName" xml:space="preserve">
|
||||
<value>parameter must be an Enum name!</value>
|
||||
<comment>Parameter must be an Enum name in enum to boolean converter</comment>
|
||||
</data>
|
||||
NavigateUri
|
||||
<!--}]}-->
|
||||
</root>
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Param_RootNamespace.Helpers
|
|||
{
|
||||
if (!Enum.IsDefined(EnumType, value))
|
||||
{
|
||||
throw new ArgumentException("value must be an Enum!");
|
||||
throw new ArgumentException("ExceptionEnumToBooleanConverterValueMustBeAnEnum".GetLocalized());
|
||||
}
|
||||
|
||||
var enumValue = Enum.Parse(EnumType, enumString);
|
||||
|
@ -22,7 +22,7 @@ namespace Param_RootNamespace.Helpers
|
|||
return enumValue.Equals(value);
|
||||
}
|
||||
|
||||
throw new ArgumentException("parameter must be an Enum name!");
|
||||
throw new ArgumentException("ExceptionEnumToBooleanConverterParameterMustBeAnEnumName".GetLocalized());
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
|
@ -32,7 +32,7 @@ namespace Param_RootNamespace.Helpers
|
|||
return Enum.Parse(EnumType, enumString);
|
||||
}
|
||||
|
||||
throw new ArgumentException("parameter must be an Enum name!");
|
||||
throw new ArgumentException("ExceptionEnumToBooleanConverterParameterMustBeAnEnumName".GetLocalized());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,6 +45,14 @@
|
|||
<value>Personalization</value>
|
||||
<comment>Personalization text for SettingsPage</comment>
|
||||
</data>
|
||||
<data name="ExceptionEnumToBooleanConverterValueMustBeAnEnum" xml:space="preserve">
|
||||
<value>value must be an Enum!</value>
|
||||
<comment>Value must be an Enum in enum to boolean converter</comment>
|
||||
</data>
|
||||
<data name="ExceptionEnumToBooleanConverterParameterMustBeAnEnumName" xml:space="preserve">
|
||||
<value>parameter must be an Enum name!</value>
|
||||
<comment>Parameter must be an Enum name in enum to boolean converter</comment>
|
||||
</data>
|
||||
NavigateUri
|
||||
<!--}]}-->
|
||||
</root>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
The tabbed page is used for navigating frequently accessed, distinct content categories. Pivots allow for navigation between two or more content panes and relies on text headers to articulate the different sections of content.
|
||||
|
||||
To find out more if this is a good solution for you, head to [docs.microsoft.com](https://docs.microsoft.com/en-us/windows/uwp/controls-and-patterns/tabs-pivot).
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">
|
||||
<Canvas Width="48" Height="48">
|
||||
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Fill="#000000">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M48 42H0V4H48ZM2 40H46V6H2ZM16 10H6v2H16Zm14 0H20v2H30Zm12 0H34v2h8Zm0 26H6V16H42ZM8 34H40V18H8Z" FillRule="NonZero"/>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Canvas>
|
||||
</Viewbox>
|
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"author": "Nigel Sampson",
|
||||
"classifications": [
|
||||
"Universal"
|
||||
],
|
||||
"name": "Tabbed",
|
||||
"groupIdentity": "wts.Page.TabbedPivot",
|
||||
"identity": "wts.Page.TabbedPivot.CaliburnMicro",
|
||||
"description": "The tabbed page is used for navigating frequently accessed, distinct content categories.",
|
||||
"tags": {
|
||||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "page",
|
||||
"wts.framework": "CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "8",
|
||||
"wts.genGroup": "0",
|
||||
"wts.rightClickEnabled":"true"
|
||||
},
|
||||
"sourceName": "TabbedPivotPage",
|
||||
"preferNameDirectory": true,
|
||||
"PrimaryOutputs": [
|
||||
{
|
||||
"path": ".\\Views\\TabbedPivotPagePage.xaml"
|
||||
},
|
||||
{
|
||||
"path": ".\\Views\\TabbedPivotPagePage.xaml.cs"
|
||||
},
|
||||
{
|
||||
"path": ".\\ViewModels\\TabbedPivotPageViewModel.cs"
|
||||
},
|
||||
{
|
||||
"path": ".\\Views\\ExampleTabPage.xaml"
|
||||
},
|
||||
{
|
||||
"path": ".\\Views\\ExampleTabPage.xaml.cs"
|
||||
},
|
||||
{
|
||||
"path": ".\\ViewModels\\ExampleTabViewModel.cs"
|
||||
}
|
||||
],
|
||||
"symbols": {
|
||||
"wts.rootNamespace": {
|
||||
"type": "parameter",
|
||||
"replaces": "Param_RootNamespace"
|
||||
},
|
||||
"wts.itemNamespace": {
|
||||
"type": "parameter",
|
||||
"replaces": "Param_ItemNamespace"
|
||||
},
|
||||
"baseclass": {
|
||||
"type": "parameter",
|
||||
"replaces": "System.ComponentModel.INotifyPropertyChanged"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<!--{**-->
|
||||
<!--This xml blocks include string resources for the TabbedPivotPagePage to your project.-->
|
||||
<!--**}-->
|
||||
|
||||
<root>
|
||||
<!--^^-->
|
||||
<!--{[{-->
|
||||
<data name="TabbedPivotPage_Pivot.Text" xml:space="preserve">
|
||||
<value>TabbedPivotPage</value>
|
||||
</data>
|
||||
<data name="TabbedPivotPageExampleTabPage1_DisplayName" xml:space="preserve">
|
||||
<value>Example Tab 1</value>
|
||||
</data>
|
||||
<data name="TabbedPivotPageExampleTabPage2_DisplayName" xml:space="preserve">
|
||||
<value>Example Tab 2</value>
|
||||
</data>
|
||||
<!--}]}-->
|
||||
</root>
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Param_ItemNamespace.ViewModels
|
||||
{
|
||||
public class ExampleTabViewModel : Screen
|
||||
{
|
||||
public ExampleTabViewModel()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using Caliburn.Micro;
|
||||
using Param_ItemNamespace.Helpers;
|
||||
|
||||
namespace Param_ItemNamespace.ViewModels
|
||||
{
|
||||
public class TabbedPivotPageViewModel : Conductor<Screen>.Collection.OneActive
|
||||
{
|
||||
public TabbedPivotPageViewModel()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnInitialize()
|
||||
{
|
||||
base.OnInitialize();
|
||||
|
||||
// WTS Add view models to the Items collection to display them in the Tabs
|
||||
Items.Add(new ExampleTabViewModel { DisplayName = "TabbedPivotPageExampleTabPage1_DisplayName".GetLocalized() });
|
||||
Items.Add(new ExampleTabViewModel { DisplayName = "TabbedPivotPageExampleTabPage1_DisplayName".GetLocalized() });
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<Page
|
||||
x:Class="Param_ItemNamespace.Views.ExampleTabPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:App1.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
</Grid>
|
||||
</Page>
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Param_ItemNamespace.Views
|
||||
{
|
||||
public sealed partial class ExampleTabPage : Page
|
||||
{
|
||||
public ExampleTabPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<Page
|
||||
x:Class="Param_ItemNamespace.Views.TabbedPivotPagePage"
|
||||
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:cm="using:Caliburn.Micro"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition x:Name="TitleRow" Height="48"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock
|
||||
x:Name="TitlePage"
|
||||
x:Uid="TabbedPivotPage_Pivot"
|
||||
Text="Navigation Item 1"
|
||||
Style="{StaticResource PageTitleStyle}"
|
||||
Margin="12,0,12,7"/>
|
||||
|
||||
<Pivot Grid.Row="1" x:Name="Items">
|
||||
<Pivot.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding DisplayName}" />
|
||||
</DataTemplate>
|
||||
</Pivot.HeaderTemplate>
|
||||
<Pivot.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ContentControl cm:View.Model="{Binding}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch" />
|
||||
</DataTemplate>
|
||||
</Pivot.ItemTemplate>
|
||||
</Pivot>
|
||||
</Grid>
|
||||
</Page>
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Param_ItemNamespace.Views
|
||||
{
|
||||
public sealed partial class TabbedPivotPagePage : Page
|
||||
{
|
||||
public TabbedPivotPagePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
The web view page embeds a view into your app that renders web content using the Microsoft Edge rendering engine. Hyperlinks can also appear and function in a web view control. You can use a web view control to display richly formatted HTML content from a remote web server, dynamically generated code, or content files in your app package. Rich content can also contain script code and communicate between the script and your app's code.
|
||||
|
||||
To find out more if this is a good solution for you, head to [docs.microsoft.com](https://docs.microsoft.com/en-us/windows/uwp/controls-and-patterns/web-view).
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">
|
||||
<Canvas Width="48" Height="48">
|
||||
<Rectangle xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Canvas.Left="1" Canvas.Top="5" Width="46" Height="36" StrokeThickness="2" Stroke="#FF000000" StrokeMiterLimit="10"/>
|
||||
<Line xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" X1="1" Y1="13" X2="47" Y2="13" StrokeThickness="2" Stroke="#FF000000" StrokeMiterLimit="10"/>
|
||||
<Ellipse xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Canvas.Left="15" Canvas.Top="18" Width="18" Height="18" StrokeThickness="2" Stroke="#FF000000" StrokeMiterLimit="10"/>
|
||||
<Ellipse xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Canvas.Left="19.8" Width="8.4" Canvas.Top="18" Height="18" StrokeThickness="2" Stroke="#FF000000" StrokeMiterLimit="10"/>
|
||||
<Line xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" X1="15.3" Y1="30" X2="32.608" Y2="30" StrokeThickness="2" Stroke="#FF000000" StrokeMiterLimit="10"/>
|
||||
<Line xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" X1="15.392" Y1="24" X2="32.7" Y2="24" StrokeThickness="2" Stroke="#FF000000" StrokeMiterLimit="10"/>
|
||||
</Canvas>
|
||||
</Viewbox>
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"author": "Nigel Sampson",
|
||||
"classifications": [
|
||||
"Universal"
|
||||
],
|
||||
"name": "Web View",
|
||||
"groupIdentity": "wts.Page.WebView",
|
||||
"identity": "wts.Page.WebView.CaliburnMicro",
|
||||
"description": "The web view page embeds a view into your app that renders web content using the Microsoft Edge rendering engine.",
|
||||
"tags": {
|
||||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "page",
|
||||
"wts.framework": "CaliburnMicro",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "3",
|
||||
"wts.rightClickEnabled":"true",
|
||||
"wts.genGroup": "0"
|
||||
},
|
||||
"sourceName": "WebViewPage",
|
||||
"preferNameDirectory": true,
|
||||
"PrimaryOutputs": [
|
||||
{
|
||||
"path": ".\\Views\\WebViewPagePage.xaml"
|
||||
},
|
||||
{
|
||||
"path": ".\\Views\\WebViewPagePage.xaml.cs"
|
||||
},
|
||||
{
|
||||
"path": ".\\ViewModels\\WebViewPageViewModel.cs"
|
||||
}
|
||||
],
|
||||
"symbols": {
|
||||
"wts.rootNamespace": {
|
||||
"type": "parameter",
|
||||
"replaces": "Param_RootNamespace"
|
||||
},
|
||||
"wts.itemNamespace": {
|
||||
"type": "parameter",
|
||||
"replaces": "Param_ItemNamespace"
|
||||
},
|
||||
"baseclass": {
|
||||
"type": "parameter",
|
||||
"replaces": "System.ComponentModel.INotifyPropertyChanged"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<!--{**-->
|
||||
<!--This xml blocks include string resources for the WebViewPagePage to your project.-->
|
||||
<!--**}-->
|
||||
|
||||
<root>
|
||||
<!--^^-->
|
||||
<!--{[{-->
|
||||
<data name="WebViewPage_FailedMessage.Text" xml:space="preserve">
|
||||
<value>Page failed to load. Check connection and retry.</value>
|
||||
</data>
|
||||
<data name="WebViewPage_Loading.Text" xml:space="preserve">
|
||||
<value>Loading...</value>
|
||||
</data>
|
||||
<data name="WebViewPage_Retry.Content" xml:space="preserve">
|
||||
<value>retry</value>
|
||||
</data>
|
||||
<data name="WebViewPage_BrowserBackButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Back</value>
|
||||
</data>
|
||||
<data name="WebViewPage_BrowserBackButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Back</value>
|
||||
</data>
|
||||
<data name="WebViewPage_BrowserForwardButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Forward</value>
|
||||
</data>
|
||||
<data name="WebViewPage_BrowserForwardButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Forward</value>
|
||||
</data>
|
||||
<data name="WebViewPage_RefreshBrowserButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Refresh</value>
|
||||
</data>
|
||||
<data name="WebViewPage_RefreshBrowserButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Refresh</value>
|
||||
</data>
|
||||
<data name="WebViewPage_OpenInBrowserButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Open in browser</value>
|
||||
</data>
|
||||
<data name="WebViewPage_OpenInBrowserButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Open in browser</value>
|
||||
</data>
|
||||
<!--}]}-->
|
||||
</root>
|
|
@ -0,0 +1,131 @@
|
|||
using System;
|
||||
using System.Windows.Input;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Param_ItemNamespace.Helpers;
|
||||
using Caliburn.Micro;
|
||||
|
||||
namespace Param_ItemNamespace.ViewModels
|
||||
{
|
||||
public class WebViewPageViewModel : Screen
|
||||
{
|
||||
// TODO WTS: Specify your hyperlink default here
|
||||
private const string DefaultUrl = "https://developer.microsoft.com/en-us/windows/apps";
|
||||
|
||||
private Uri _source;
|
||||
|
||||
public Uri Source
|
||||
{
|
||||
get { return _source; }
|
||||
set { Set(ref _source, value); }
|
||||
}
|
||||
|
||||
private bool _isLoading;
|
||||
|
||||
public bool IsLoading
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isLoading;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
IsShowingFailedMessage = false;
|
||||
}
|
||||
|
||||
Set(ref _isLoading, value);
|
||||
IsLoadingVisibility = value ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
private Visibility _isLoadingVisibility;
|
||||
|
||||
public Visibility IsLoadingVisibility
|
||||
{
|
||||
get { return _isLoadingVisibility; }
|
||||
set { Set(ref _isLoadingVisibility, value); }
|
||||
}
|
||||
|
||||
private bool _isShowingFailedMessage;
|
||||
|
||||
public bool IsShowingFailedMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isShowingFailedMessage;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
IsLoading = false;
|
||||
}
|
||||
|
||||
Set(ref _isShowingFailedMessage, value);
|
||||
FailedMesageVisibility = value ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
private Visibility _failedMesageVisibility;
|
||||
|
||||
public Visibility FailedMesageVisibility
|
||||
{
|
||||
get { return _failedMesageVisibility; }
|
||||
set { Set(ref _failedMesageVisibility, value); }
|
||||
}
|
||||
|
||||
public void NavCompleted(WebViewNavigationCompletedEventArgs e)
|
||||
{
|
||||
IsLoading = false;
|
||||
|
||||
NotifyOfPropertyChange(() => CanGoBack);
|
||||
NotifyOfPropertyChange(() => CanGoForward);
|
||||
}
|
||||
|
||||
public void NavFailed(WebViewNavigationFailedEventArgs e)
|
||||
{
|
||||
// Use `e.WebErrorStatus` to vary the displayed message based on the error reason
|
||||
IsShowingFailedMessage = true;
|
||||
|
||||
NotifyOfPropertyChange(() => CanGoBack);
|
||||
NotifyOfPropertyChange(() => CanGoForward);
|
||||
}
|
||||
|
||||
public void Retry()
|
||||
{
|
||||
IsShowingFailedMessage = false;
|
||||
IsLoading = true;
|
||||
|
||||
_webView?.Refresh();
|
||||
}
|
||||
|
||||
public void GoBack() => _webView?.GoBack();
|
||||
|
||||
public bool CanGoBack => _webView?.CanGoBack ?? false;
|
||||
|
||||
public void GoForward() => _webView?.GoForward();
|
||||
|
||||
public bool CanGoForward => _webView?.CanGoForward ?? false;
|
||||
|
||||
public void RefreshBrowser() => _webView?.Refresh();
|
||||
|
||||
public async void OpenInBrowser() => await Windows.System.Launcher.LaunchUriAsync(Source);
|
||||
|
||||
private WebView _webView;
|
||||
|
||||
public WebViewPageViewModel()
|
||||
{
|
||||
IsLoading = true;
|
||||
Source = new Uri(DefaultUrl);
|
||||
}
|
||||
|
||||
public void Initialize(WebView webView)
|
||||
{
|
||||
_webView = webView;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
<Page
|
||||
x:Class="Param_ItemNamespace.Views.WebViewPagePage"
|
||||
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:i="using:Microsoft.Xaml.Interactivity"
|
||||
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
|
||||
xmlns:cm="using:Caliburn.Micro"
|
||||
mc:Ignorable="d">
|
||||
<Page.Resources>
|
||||
<Style x:Key="BrowserButtonStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}"/>
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}"/>
|
||||
<Setter Property="Padding" Value="8,4,8,4"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
|
||||
<Setter Property="FontWeight" Value="Normal"/>
|
||||
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
|
||||
<Setter Property="UseSystemFocusVisuals" Value="True"/>
|
||||
<Setter Property="FocusVisualMargin" Value="-3"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Grid x:Name="RootGrid" Background="{TemplateBinding Background}">
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal">
|
||||
<Storyboard>
|
||||
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="PointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPointerOver}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPointerOver}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushPressed}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundPressed}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<PointerDownThemeAnimation Storyboard.TargetName="RootGrid"/>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonBorderBrushDisabled}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ButtonForegroundDisabled}"/>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<ContentPresenter x:Name="ContentPresenter" AutomationProperties.AccessibilityView="Raw" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTransitions="{TemplateBinding ContentTransitions}" Content="{TemplateBinding Content}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Page.Resources>
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<WebView x:Name="webView" Source="{x:Bind ViewModel.Source, Mode=OneWay}"
|
||||
cm:Message.Attach="[Event NavigationCompleted] = [NavCompleted($eventArgs)]; [Event NavigationFailed] = [NavFailed($eventArgs)]">
|
||||
|
||||
</WebView>
|
||||
|
||||
<StackPanel Visibility="{x:Bind ViewModel.IsLoadingVisibility, Mode=OneWay}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<ProgressRing IsActive="{x:Bind ViewModel.IsLoading, Mode=OneWay}" />
|
||||
<TextBlock x:Uid="WebViewPage_Loading" />
|
||||
</StackPanel>
|
||||
<StackPanel Visibility="{x:Bind ViewModel.FailedMesageVisibility, Mode=OneWay}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock HorizontalAlignment="Center" x:Uid="WebViewPage_FailedMessage" TextWrapping="WrapWholeWords" />
|
||||
<HyperlinkButton cm:Message.Attach="Retry" x:Uid="WebViewPage_Retry" HorizontalAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
<Grid Grid.Row="1" Background="{ThemeResource SystemControlBackgroundBaseLowBrush}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Style="{StaticResource BrowserButtonStyle}" cm:Message.Attach="GoBack" x:Uid="WebViewPage_BrowserBackButton">
|
||||
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" />
|
||||
</Button>
|
||||
<Button Style="{StaticResource BrowserButtonStyle}" cm:Message.Attach="GoForward" x:Uid="WebViewPage_BrowserForwardButton">
|
||||
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" />
|
||||
</Button>
|
||||
</StackPanel >
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Style="{StaticResource BrowserButtonStyle}" cm:Message.Attach="RefreshBrowser" x:Uid="WebViewPage_RefreshBrowserButton">
|
||||
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" />
|
||||
</Button>
|
||||
<Button Style="{StaticResource BrowserButtonStyle}" cm:Message.Attach="OpenInBrowser" x:Uid="WebViewPage_OpenInBrowserButton">
|
||||
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Page>
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Param_ItemNamespace.Views
|
||||
{
|
||||
public sealed partial class WebViewPagePage : Page
|
||||
{
|
||||
public WebViewPagePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Loaded += (s, e) => ViewModel.Initialize(webView);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
"language": "C#",
|
||||
"type": "project",
|
||||
"wts.type": "project",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind",
|
||||
"wts.framework": "MVVMBasic|MVVMLight|CodeBehind|CaliburnMicro",
|
||||
"wts.projecttype":"Blank|SplitView|TabbedPivot",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.displayOrder": "1"
|
||||
|
@ -60,4 +60,4 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,6 +24,15 @@
|
|||
"author": "Microsoft",
|
||||
"order": "1",
|
||||
"licenses": "",
|
||||
"languages": [ "C#", "VisualBasic" ]
|
||||
"languages": [ "C#", "VisualBasic" ]
|
||||
},
|
||||
{
|
||||
"name": "CaliburnMicro",
|
||||
"displayName": "Caliburn.Micro",
|
||||
"summary": "Caliburn.Micro is a popular MVVM framework emphasising conventions and composability.",
|
||||
"author": "Nigel Sampson",
|
||||
"order": "4",
|
||||
"licenses": "[Caliburn.Micro](https://github.com/Caliburn-Micro/Caliburn.Micro/blob/master/License.txt)",
|
||||
"languages": [ "C#" ]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
Caliburn.Micro is a popular, 3rd party framework based on the [Model-View-ViewModel pattern](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel). The framework helps you to separate your View from your Model which creates applications that are cleaner and easier to maintain and extend. It also creates testable applications and allows you to have a much thinner user interface layer (which is more difficult to test automatically).
|
||||
|
||||
You can find more out at [Caliburn.Micro's homepage](http://caliburnmicro.com/)
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 13 KiB |
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"author": "Microsoft",
|
||||
"classifications": [
|
||||
"Universal"
|
||||
],
|
||||
"name": "CaliburnMicro.Feature.BackgroundTask.AddOnBackgroundNavigated",
|
||||
"tags": {
|
||||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "composition",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.compositionFilter": "$framework == CaliburnMicro & identity == wts.Feat.BackgroundTask"
|
||||
},
|
||||
"sourceName": "wts.ItemName",
|
||||
"preferNameDirectory": true,
|
||||
"PrimaryOutputs": [
|
||||
],
|
||||
"symbols": {
|
||||
"wts.rootNamespace": {
|
||||
"type": "parameter",
|
||||
"replaces": "Param_RootNamespace"
|
||||
},
|
||||
"wts.itemNamespace": {
|
||||
"type": "parameter",
|
||||
"replaces": "Param_ItemNamespace"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
//{**
|
||||
// This code block adds the OnBackgroundActivated event handler to the App class of your project.
|
||||
//**}
|
||||
namespace Param_RootNamespace
|
||||
{
|
||||
public sealed partial class App
|
||||
{
|
||||
//^^
|
||||
//{[{
|
||||
|
||||
protected override async void OnBackgroundActivated(BackgroundActivatedEventArgs args)
|
||||
{
|
||||
await ActivationService.ActivateAsync(args);
|
||||
}
|
||||
//}]}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"author": "Nigel Sampson",
|
||||
"classifications": [
|
||||
"Universal"
|
||||
],
|
||||
"name": "CaliburnMicro.Feature.SuspendAndResume.AddNavigation",
|
||||
"tags": {
|
||||
"language": "C#",
|
||||
"type": "item",
|
||||
"wts.type": "composition",
|
||||
"wts.version": "1.0.0",
|
||||
"wts.compositionFilter": "$framework == CaliburnMicro & identity == wts.Feat.SuspendAndResume"
|
||||
},
|
||||
"sourceName": "wts.ItemName",
|
||||
"preferNameDirectory": true,
|
||||
"PrimaryOutputs": [
|
||||
],
|
||||
"symbols": {
|
||||
"wts.rootNamespace": {
|
||||
"type": "parameter",
|
||||
"replaces": "Param_RootNamespace"
|
||||
},
|
||||
"wts.itemNamespace": {
|
||||
"type": "parameter",
|
||||
"replaces": "Param_ItemNamespace"
|
||||
}
|
||||
}
|
||||
}
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче