Merge remote-tracking branch 'refs/remotes/origin/dev' into Issue196-FeedbackHub

This commit is contained in:
Matt Lacey 2017-09-22 18:49:03 +01:00
Родитель 1b565e82e6 efbd453641
Коммит efb4e822c2
56 изменённых файлов: 561 добавлений и 516 удалений

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

@ -20,18 +20,18 @@ namespace Microsoft.Templates.Core
}
}
public static void CopyRecursive(string sourceDir, string targetDir)
public static void CopyRecursive(string sourceDir, string targetDir, bool overwrite = false)
{
Directory.CreateDirectory(targetDir);
foreach (var file in Directory.GetFiles(sourceDir))
{
File.Copy(file, Path.Combine(targetDir, Path.GetFileName(file)));
File.Copy(file, Path.Combine(targetDir, Path.GetFileName(file)), overwrite);
}
foreach (var directory in Directory.GetDirectories(sourceDir))
{
CopyRecursive(directory, Path.Combine(targetDir, Path.GetFileName(directory)));
CopyRecursive(directory, Path.Combine(targetDir, Path.GetFileName(directory)), overwrite);
}
}

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

@ -4,12 +4,13 @@
using System.IO;
using System.Text;
using System;
using Microsoft.Templates.Core.Packaging;
namespace Microsoft.Templates.Core.Locations
{
public sealed class LocalTemplatesSource : TemplatesSource
public class LocalTemplatesSource : TemplatesSource
{
public string LocalTemplatesVersion { get; private set; }
@ -20,36 +21,55 @@ namespace Microsoft.Templates.Core.Locations
public override bool ForcedAcquisition { get => base.ForcedAcquisition; protected set => base.ForcedAcquisition = value; }
public string Origin => $@"..\..\..\..\..\{SourceFolderName}";
private string _id;
public override string Id { get => _id; }
private object lockObject = new object();
public LocalTemplatesSource() : this("0.0.0.0", "0.0.0.0")
{
base.ForcedAcquisition = true;
}
protected string FinalDestination { get; set; }
public LocalTemplatesSource() : this("0.0.0.0", "0.0.0.0", true)
{
_id = Configuration.Current.Environment;
}
public LocalTemplatesSource(string id) : this("0.0.0.0", "0.0.0.0", true)
{
_id = id;
}
public LocalTemplatesSource(string wizardVersion, string templatesVersion, bool forcedAdquisition = true)
{
base.ForcedAcquisition = forcedAdquisition;
ForcedAcquisition = forcedAdquisition;
LocalTemplatesVersion = templatesVersion;
LocalWizardVersion = wizardVersion;
}
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);
return Origin;
}
private void Copy(string sourceFolder, string targetFolder)
public override void Extract(string source, string targetFolder)
{
Fs.SafeDeleteDirectory(targetFolder);
Fs.CopyRecursive(sourceFolder, targetFolder);
if (source.ToLower().EndsWith("mstx"))
{
base.Extract(source, targetFolder);
}
else
{
SetLocalContent(source, targetFolder, new Version(LocalTemplatesVersion));
}
}
private void SetLocalContent(string sourcePath, string finalTargetFolder, Version version)
{
Version ver = version;
FinalDestination = PrepareFinalDestination(finalTargetFolder, ver);
if (!Directory.Exists(FinalDestination))
{
Fs.CopyRecursive(sourcePath, FinalDestination, true);
}
}
}
}

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

@ -33,7 +33,7 @@ namespace Microsoft.Templates.Core.Locations
Extract(mstxFilePath, targetFolder);
}
public void Extract(string mstxFilePath, string targetFolder)
public virtual void Extract(string mstxFilePath, string targetFolder)
{
string extractedContent = ExtractMstx(mstxFilePath);
@ -119,7 +119,7 @@ namespace Microsoft.Templates.Core.Locations
}
}
private static string PrepareFinalDestination(string finalTargetFolder, Version ver)
protected static string PrepareFinalDestination(string finalTargetFolder, Version ver)
{
Fs.EnsureFolder(finalTargetFolder);
@ -133,7 +133,7 @@ namespace Microsoft.Templates.Core.Locations
return finalDestination;
}
private static Version GetVersionFromFile(string versionFilePath)
protected static Version GetVersionFromFile(string versionFilePath)
{
var version = "0.0.0.0";
@ -157,7 +157,7 @@ namespace Microsoft.Templates.Core.Locations
return tempFolder;
}
private void CleanUpTemps()
protected void CleanUpTemps()
{
List<string> removedFolders = new List<string>();
foreach (string tempFolder in _tempFoldersUsed)

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

@ -157,8 +157,11 @@ namespace Microsoft.Templates.Core.Locations
{
try
{
string installedTemplatesPath = GetInstalledTemplatesPath();
_source.Extract(installedTemplatesPath, _content.TemplatesFolder);
string installedTemplatesPath = GetInstalledTemplatesPath();
if (File.Exists(installedTemplatesPath))
{
_source.Extract(installedTemplatesPath, _content.TemplatesFolder);
}
}
catch (Exception ex)
{

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

@ -16,15 +16,16 @@ using Microsoft.Templates.Core;
namespace Microsoft.Templates.UI.Generation
{
internal class ProjectConfigInfo
public class ProjectConfigInfo
{
const string FxMVVMBasic = "MVVMBasic";
const string FxMVVMLight = "MVVMLight";
const string FxCodeBehid = "CodeBehind";
public const string FxMVVMBasic = "MVVMBasic";
public const string FxMVVMLight = "MVVMLight";
public const string FxCodeBehid = "CodeBehind";
public const string FxCaliburnMicro = "CaliburnMicro";
const string ProjTypeBlank = "Blank";
const string ProjTypeSplitView = "SplitView";
const string ProjTypeTabbedPivot = "TabbedPivot";
public const string ProjTypeBlank = "Blank";
public const string ProjTypeSplitView = "SplitView";
public const string ProjTypeTabbedPivot = "TabbedPivot";
const string ProjectTypeLiteral = "projectType";
const string FrameworkLiteral = "framework";
@ -117,6 +118,10 @@ namespace Microsoft.Templates.UI.Generation
{
return FxCodeBehid;
}
else if (IsCaliburnMicro())
{
return FxCaliburnMicro;
}
else
{
return string.Empty;
@ -182,6 +187,22 @@ namespace Microsoft.Templates.UI.Generation
return false;
}
private static bool IsCaliburnMicro()
{
if (ExistsFileInProjectPath("Services", "ActivationService.cs"))
{
var files = Directory.GetFiles(GenContext.Current.ProjectPath, "*.*proj", SearchOption.TopDirectoryOnly);
foreach (string file in files)
{
if (File.ReadAllText(file).Contains("<PackageReference Include=\"Caliburn.Micro\">"))
{
return true;
}
}
}
return false;
}
private static bool IsSplitView()
{
return ExistsFileInProjectPath("Services", "ActivationService.cs")

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

@ -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();
}
}

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

@ -9,6 +9,7 @@ using Xunit;
namespace Microsoft.Templates.Core.Test.Composition
{
[Trait("ExecutionSet", "Minimum")]
public class CompositionQueryTest
{
[Fact]

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

@ -14,6 +14,8 @@ using Xunit;
namespace Microsoft.Templates.Core.Test.Config
{
[Trait("ExecutionSet", "Minimum")]
public class ConfigurationTests
{
[Fact]

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

@ -13,6 +13,8 @@ using Xunit;
namespace Microsoft.Templates.Core.Test.Diagnostics
{
[Trait("ExecutionSet", "Minimum")]
public class FileHealthWriterTest
{
[Fact]

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

@ -12,6 +12,8 @@ using Xunit;
namespace Microsoft.Templates.Core.Test.Diagnostics
{
[Trait("ExecutionSet", "Minimum")]
public class HealthTest
{
TestHealthWriter _testWriter = null;

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

@ -8,7 +8,7 @@ using Microsoft.Templates.Core.Diagnostics;
namespace Microsoft.Templates.Core.Test.Diagnostics
{
public sealed class TelemetryFixture : IDisposable
public sealed class TelemetryFixture
{
public TelemetryService Telemetry { get; }
@ -16,10 +16,5 @@ namespace Microsoft.Templates.Core.Test.Diagnostics
{
Telemetry = TelemetryService.Current;
}
public void Dispose()
{
TelemetryService.Current.Dispose();
}
}
}

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

@ -12,6 +12,8 @@ using Xunit;
namespace Microsoft.Templates.Core.Test.Diagnostics
{
[Trait("ExecutionSet", "Minimum")]
public class TelemetryServiceTest : IClassFixture<TelemetryFixture>
{
TelemetryFixture _fixture;

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

@ -12,6 +12,8 @@ using Xunit;
namespace Microsoft.Templates.Core.Test
{
[Collection("Unit Test Templates")]
[Trait("ExecutionSet", "Minimum")]
public class LocalizationTest
{
private TemplatesFixture _fixture;

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

@ -4,6 +4,7 @@
using System.IO;
using System.Text;
using System;
using Microsoft.Templates.Core.Locations;
using Microsoft.Templates.Core.Packaging;
@ -20,19 +21,25 @@ namespace Microsoft.Templates.Core.Test.Locations
protected override string AcquireMstx()
{
var tempFolder = Path.Combine(GetTempFolder(), SourceFolderName);
Copy($@"..\..\TestData\{SourceFolderName}", tempFolder);
File.WriteAllText(Path.Combine(tempFolder, "version.txt"), _localVersion, Encoding.UTF8);
return TemplatePackage.Pack(tempFolder);
// Hack and return the tempfolder directly to skip zipping and unzipping
return $@"..\..\TestData\{SourceFolderName}";
}
private static void Copy(string sourceFolder, string targetFolder)
public override void Extract(string source, string targetFolder)
{
Fs.SafeDeleteDirectory(targetFolder);
Fs.CopyRecursive(sourceFolder, targetFolder);
SetLocalContent(source, targetFolder, new Version(_localVersion));
}
private void SetLocalContent(string sourcePath, string finalTargetFolder, Version version)
{
Version ver = version;
string finalDestination = PrepareFinalDestination(finalTargetFolder, ver);
if (!Directory.Exists(finalDestination))
{
Fs.CopyRecursive(sourcePath, finalDestination, true);
}
}
}
}

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

@ -9,6 +9,8 @@ using Xunit;
namespace Microsoft.Templates.Core.Test
{
[Collection("Unit Test Templates")]
[Trait("ExecutionSet", "Minimum")]
public class NamingTests
{
private TemplatesFixture _fixture;

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

@ -9,6 +9,7 @@ using Xunit;
namespace Microsoft.Templates.Core.Test
{
[Collection("Unit Test Templates")]
[Trait("ExecutionSet", "Minimum")]
public class SuggestedDirectoryNameValidatorTests
{
[Fact]

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

@ -18,6 +18,8 @@ using Microsoft.Templates.Core.Packaging;
namespace Microsoft.Templates.Core.Test.Locations
{
[Trait("ExecutionSet", "Minimum")]
public class TemplatePackageTests
{
[Fact]

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

@ -16,6 +16,8 @@ using Microsoft.Templates.Core.Diagnostics;
namespace Microsoft.Templates.Core.Test.PostActions.Catalog
{
[Collection("Unit Test Templates")]
[Trait("ExecutionSet", "Minimum")]
public class GenerateTestCertificatePostActionTest : IContextProvider
{
private TemplatesFixture _fixture;

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

@ -8,6 +8,7 @@ using Xunit;
namespace Microsoft.Templates.Core.Test.PostActions.Catalog
{
[Trait("ExecutionSet", "Minimum")]
public class HandleRemovalsTest
{
[Fact]

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

@ -12,6 +12,7 @@ using Xunit;
namespace Microsoft.Templates.Core.Test.PostActions.Catalog
{
[Trait("ExecutionSet", "Minimum")]
public class MergeTest
{
[Fact]

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

@ -8,6 +8,7 @@ using Xunit;
namespace Microsoft.Templates.Core.Test.PostActions.Catalog
{
[Trait("ExecutionSet", "Minimum")]
public class SortImportsTest
{
[Fact]

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

@ -10,6 +10,7 @@ using Xunit;
namespace Microsoft.Templates.Core.Test.PostActions.Catalog
{
[Trait("ExecutionSet", "Minimum")]
public class SortUsingsTest
{
[Fact]

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

@ -17,6 +17,8 @@ using Xunit;
namespace Microsoft.Templates.Core.Test
{
[Collection("Unit Test Templates")]
[Trait("ExecutionSet", "Minimum")]
[Trait("Type", "ProjectGeneration")]
public class ITemplateInfoExtensionsTest
{
private readonly TemplatesFixture _fixture;
@ -28,7 +30,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetTemplateType_project(string language)
{
SetUpFixtureForTesting(language);
@ -52,7 +53,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetTemplateType_unspecified(string language)
{
SetUpFixtureForTesting(language);
@ -65,7 +65,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetIcon(string language)
{
SetUpFixtureForTesting(language);
@ -86,7 +85,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetIcon_unspecified(string language)
{
SetUpFixtureForTesting(language);
@ -99,7 +97,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetRichDescription(string language)
{
SetUpFixtureForTesting(language);
@ -112,7 +109,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetRichDescription_unspecified(string language)
{
SetUpFixtureForTesting(language);
@ -125,7 +121,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetFramework(string language)
{
SetUpFixtureForTesting(language);
@ -142,7 +137,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetFramework_unspecified(string language)
{
SetUpFixtureForTesting(language);
@ -155,7 +149,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetVersion(string language)
{
SetUpFixtureForTesting(language);
@ -168,7 +161,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetVersion_unspecified(string language)
{
SetUpFixtureForTesting(language);
@ -181,7 +173,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetGroup(string language)
{
SetUpFixtureForTesting(language);
@ -194,7 +185,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetGroup_unspecified(string language)
{
SetUpFixtureForTesting(language);
@ -207,7 +197,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetDisplayOrder(string language)
{
SetUpFixtureForTesting(language);
@ -220,7 +209,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetDisplayOrder_unspecified(string language)
{
SetUpFixtureForTesting(language);
@ -233,7 +221,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetCompositionOrder(string language)
{
SetUpFixtureForTesting(language);
@ -246,7 +233,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetCompositionOrder_unspecified(string language)
{
SetUpFixtureForTesting(language);
@ -259,7 +245,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetLicenses(string language)
{
SetUpFixtureForTesting(language);
@ -284,7 +269,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetLicenses_unspecified(string language)
{
SetUpFixtureForTesting(language);
@ -297,7 +281,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetLayout(string language)
{
SetUpFixtureForTesting(language);
@ -322,7 +305,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetLayout_NoLayout(string language)
{
SetUpFixtureForTesting(language);
@ -335,7 +317,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetDefaultName(string language)
{
SetUpFixtureForTesting(language);
@ -371,7 +352,6 @@ namespace Microsoft.Templates.Core.Test
[Theory]
[MemberData("GetAllLanguages")]
[Trait("Type", "ProjectGeneration")]
public void GetDefaultName_unspecified(string language)
{
SetUpFixtureForTesting(language);
@ -396,7 +376,6 @@ namespace Microsoft.Templates.Core.Test
private void SetUpFixtureForTesting(string language)
{
_fixture.InitializeFixture(language);
GenContext.Bootstrap(new UnitTestsTemplatesSource(), new FakeGenShell(language), language);
}
public static IEnumerable<object[]> GetAllLanguages()

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

@ -12,14 +12,21 @@ namespace Microsoft.Templates.Core.Test
public class TemplatesFixture
{
public TemplatesRepository Repository { get; private set; }
private bool _syncExecuted = false;
public void InitializeFixture(string language)
{
var source = new UnitTestsTemplatesSource();
GenContext.Bootstrap(source, new FakeGenShell(language), language);
GenContext.ToolBox.Repo.SynchronizeAsync().Wait();
if (!_syncExecuted)
{
GenContext.ToolBox.Repo.SynchronizeAsync().Wait();
_syncExecuted = true;
}
else
{
GenContext.ToolBox.Repo.CheckForUpdatesAsync().Wait();
}
Repository = GenContext.ToolBox.Repo;
}

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

@ -17,6 +17,7 @@ using Microsoft.VisualStudio.Threading;
using Microsoft.TemplateEngine.Abstractions;
using Xunit;
using Microsoft.Templates.UI.Generation;
namespace Microsoft.Templates.Test
{
@ -54,6 +55,7 @@ namespace Microsoft.Templates.Test
// Assert
Assert.True(Directory.Exists(resultPath));
Assert.True(Directory.GetFiles(resultPath, "*.*", SearchOption.AllDirectories).Count() > 2);
AssertCorrectProjectConfigInfo(projectType, framework);
// Clean
if (cleanGeneration)
@ -63,6 +65,13 @@ namespace Microsoft.Templates.Test
return resultPath;
}
protected void AssertCorrectProjectConfigInfo(string expectedProjectType, string expectedFramework)
{
var info = ProjectConfigInfo.ReadProjectConfiguration();
Assert.Equal(expectedProjectType, info.ProjectType);
Assert.Equal(expectedFramework, info.Framework);
}
protected void AssertBuildProjectAsync(string projectPath, string projectName)
{

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

@ -27,7 +27,7 @@ namespace Microsoft.Templates.Test
private string testExecutionTimeStamp = DateTime.Now.FormatAsDateHoursMinutes();
public override string GetTestRunPath() => $"{Path.GetPathRoot(Environment.CurrentDirectory)}\\UIT\\CM\\{testExecutionTimeStamp}\\";
public TemplatesSource Source => new BuildCaliburnMicroTestTemplatesSource();
public TemplatesSource Source => new LocalTemplatesSource("TestBuildCaliburnMicro");
private static bool syncExecuted;
@ -36,7 +36,7 @@ namespace Microsoft.Templates.Test
List<object[]> result = new List<object[]>();
foreach (var language in ProgrammingLanguages.GetAllLanguages())
{
await InitializeTemplatesForLanguageAsync(new BuildCaliburnMicroTestTemplatesSource(), language);
await InitializeTemplatesForLanguageAsync(new LocalTemplatesSource("TestBuildCaliburnMicro"), language);
var projectTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetTemplateType() == TemplateType.Project
&& t.GetLanguage() == language);
@ -64,8 +64,7 @@ namespace Microsoft.Templates.Test
List<object[]> result = new List<object[]>();
foreach (var language in ProgrammingLanguages.GetAllLanguages())
{
await InitializeTemplatesForLanguageAsync(new BuildCaliburnMicroTestTemplatesSource(), language);
await InitializeTemplatesForLanguageAsync(new BuildCaliburnMicroTestTemplatesSource(), language);
await InitializeTemplatesForLanguageAsync(new LocalTemplatesSource("TestBuildCaliburnMicro"), language);
var projectTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetTemplateType() == TemplateType.Project
&& t.GetLanguage() == language);

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

@ -1,43 +0,0 @@
// 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);
}
}
}

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

@ -27,7 +27,7 @@ namespace Microsoft.Templates.Test
private string testExecutionTimeStamp = DateTime.Now.FormatAsDateHoursMinutes();
public override string GetTestRunPath() => $"{Path.GetPathRoot(Environment.CurrentDirectory)}\\UIT\\CB\\{testExecutionTimeStamp}\\";
public TemplatesSource Source => new BuildCodeBehindTestTemplatesSource();
public TemplatesSource Source => new LocalTemplatesSource("TestBuildCodeBehind");
private static bool syncExecuted;
@ -36,7 +36,7 @@ namespace Microsoft.Templates.Test
List<object[]> result = new List<object[]>();
foreach (var language in ProgrammingLanguages.GetAllLanguages())
{
await InitializeTemplatesForLanguageAsync(new BuildCodeBehindTestTemplatesSource(), language);
await InitializeTemplatesForLanguageAsync(new LocalTemplatesSource("TestBuildCodeBehind"), language);
var projectTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetTemplateType() == TemplateType.Project
&& t.GetLanguage() == language);
@ -64,7 +64,7 @@ namespace Microsoft.Templates.Test
List<object[]> result = new List<object[]>();
foreach (var language in ProgrammingLanguages.GetAllLanguages())
{
await InitializeTemplatesForLanguageAsync(new BuildCodeBehindTestTemplatesSource(), language);
await InitializeTemplatesForLanguageAsync(new LocalTemplatesSource("TestBuildCodeBehind"), language);
var projectTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetTemplateType() == TemplateType.Project
&& t.GetLanguage() == language);

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

@ -1,43 +0,0 @@
// 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 BuildCodeBehindTestTemplatesSource : 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 => "TestBuildCodeBehind";
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);
}
}
}

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

@ -27,7 +27,7 @@ namespace Microsoft.Templates.Test
private string testExecutionTimeStamp = DateTime.Now.FormatAsDateHoursMinutes();
public override string GetTestRunPath() => $"{Path.GetPathRoot(Environment.CurrentDirectory)}\\UIT\\Build\\{testExecutionTimeStamp}\\";
public TemplatesSource Source => new BuildTestTemplatesSource();
public TemplatesSource Source => new LocalTemplatesSource("TestBuild");
private static bool syncExecuted;
@ -36,7 +36,7 @@ namespace Microsoft.Templates.Test
List<object[]> result = new List<object[]>();
foreach (var language in ProgrammingLanguages.GetAllLanguages())
{
await InitializeTemplatesForLanguageAsync(new BuildTestTemplatesSource(), language);
await InitializeTemplatesForLanguageAsync(new LocalTemplatesSource("TestBuild"), language);
var projectTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetTemplateType() == TemplateType.Project
&& t.GetLanguage() == language);
@ -64,7 +64,7 @@ namespace Microsoft.Templates.Test
List<object[]> result = new List<object[]>();
foreach (var language in ProgrammingLanguages.GetAllLanguages())
{
await InitializeTemplatesForLanguageAsync(new BuildTestTemplatesSource(), language);
await InitializeTemplatesForLanguageAsync(new LocalTemplatesSource("TestBuild"), language);
var projectTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetTemplateType() == TemplateType.Project
&& t.GetLanguage() == language);

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

@ -27,7 +27,7 @@ namespace Microsoft.Templates.Test
private string testExecutionTimeStamp = DateTime.Now.FormatAsDateHoursMinutes();
public override string GetTestRunPath() => $"{Path.GetPathRoot(Environment.CurrentDirectory)}\\UIT\\MB\\{testExecutionTimeStamp}\\";
public TemplatesSource Source => new BuildMVVMBasicTestTemplatesSource();
public TemplatesSource Source => new LocalTemplatesSource("TestBuildMVVMBasic");
private static bool syncExecuted;
@ -36,7 +36,7 @@ namespace Microsoft.Templates.Test
List<object[]> result = new List<object[]>();
foreach (var language in ProgrammingLanguages.GetAllLanguages())
{
await InitializeTemplatesForLanguageAsync(new BuildMVVMBasicTestTemplatesSource(), language);
await InitializeTemplatesForLanguageAsync(new LocalTemplatesSource("TestBuildMVVMBasic"), language);
var projectTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetTemplateType() == TemplateType.Project
&& t.GetLanguage() == language);
@ -64,7 +64,7 @@ namespace Microsoft.Templates.Test
List<object[]> result = new List<object[]>();
foreach (var language in ProgrammingLanguages.GetAllLanguages())
{
await InitializeTemplatesForLanguageAsync(new BuildMVVMBasicTestTemplatesSource(), language);
await InitializeTemplatesForLanguageAsync(new LocalTemplatesSource("TestBuildMVVMBasic"), language);
var projectTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetTemplateType() == TemplateType.Project
&& t.GetLanguage() == language);

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

@ -1,43 +0,0 @@
// 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 BuildMVVMBasicTestTemplatesSource : 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 => "TestBuildMVVMBasic";
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);
}
}
}

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

@ -27,7 +27,7 @@ namespace Microsoft.Templates.Test
private string testExecutionTimeStamp = DateTime.Now.FormatAsDateHoursMinutes();
public override string GetTestRunPath() => $"{Path.GetPathRoot(Environment.CurrentDirectory)}\\UIT\\ML\\{testExecutionTimeStamp}\\";
public TemplatesSource Source => new BuildMVVMLightTestTemplatesSource();
public TemplatesSource Source => new LocalTemplatesSource("TestBuildMVVMLight");
private static bool syncExecuted;
@ -36,7 +36,7 @@ namespace Microsoft.Templates.Test
List<object[]> result = new List<object[]>();
foreach (var language in ProgrammingLanguages.GetAllLanguages())
{
await InitializeTemplatesForLanguageAsync(new BuildMVVMLightTestTemplatesSource(), language);
await InitializeTemplatesForLanguageAsync(new LocalTemplatesSource("TestBuildMVVMLight"), language);
var projectTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetTemplateType() == TemplateType.Project
&& t.GetLanguage() == language);
@ -64,7 +64,7 @@ namespace Microsoft.Templates.Test
List<object[]> result = new List<object[]>();
foreach (var language in ProgrammingLanguages.GetAllLanguages())
{
await InitializeTemplatesForLanguageAsync(new BuildMVVMLightTestTemplatesSource(), language);
await InitializeTemplatesForLanguageAsync(new LocalTemplatesSource("TestBuildMVVMLight"), language);
var projectTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetTemplateType() == TemplateType.Project
&& t.GetLanguage() == language);

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

@ -1,43 +0,0 @@
// 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 BuildMVVMLightTestTemplatesSource : 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 => "TestBuildMVVMLight";
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);
}
}
}

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

@ -1,43 +0,0 @@
// 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 BuildTestTemplatesSource : TemplatesSource
{
private string _localVersion = "0.0.0.0";
protected override bool VerifyPackageSignatures => false;
public override bool ForcedAcquisition => true;
public string Origin => $@"..\..\..\..\..\{SourceFolderName}";
public override string Id => "TestBuild";
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"), _localVersion, Encoding.UTF8);
return TemplatePackage.Pack(tempFolder);
}
private void Copy(string sourceFolder, string targetFolder)
{
Fs.SafeDeleteDirectory(targetFolder);
Fs.CopyRecursive(sourceFolder, targetFolder);
}
}
}

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

@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Text;
using Microsoft.Templates.Core;
using Microsoft.Templates.Core.Gen;
@ -46,6 +47,59 @@ namespace Microsoft.Templates.Test
await AssertGenerateProjectAsync(selector, projectName, projectType, framework, language);
}
[Theory]
[MemberData("GetProjectTemplatesForGenerationAsync")]
[Trait("Type", "GenerationProjects")]
public async Task GenEmptyProjectCorrectInferProjectConfigInfoAsync(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}{framework}";
string projectPath = await AssertGenerateProjectAsync(selector, projectName, projectType, framework, language, null, false);
// Remove configuration from the manifest
RemoveProjectConfigInfoFromProject();
// Now the configuration must be inferred and should be as expected
AssertCorrectProjectConfigInfo(projectType, framework);
AssertProjectConfigInfoRecreated(projectType, framework);
}
private static void AssertProjectConfigInfoRecreated(string projectType, string framework)
{
string content = File.ReadAllText(Path.Combine(GenContext.Current.ProjectPath, "Package.appxmanifest"));
string expectedFxText = $"Name=\"framework\" Value=\"{framework}\"";
string expectedPtText = $"Name=\"projectType\" Value=\"{projectType}\"";
Assert.Contains(expectedFxText, content, StringComparison.InvariantCulture);
Assert.Contains(expectedPtText, content, StringComparison.InvariantCulture);
}
private void RemoveProjectConfigInfoFromProject()
{
string manifest = Path.Combine(GenContext.Current.ProjectPath, "Package.appxmanifest");
var lines = File.ReadAllLines(manifest);
StringBuilder sb = new StringBuilder();
string fx = $"genTemplate:Item Name=\"framework\"";
string pt = $"genTemplate:Item Name=\"projectType\"";
foreach (var line in lines)
{
if (!line.Contains(fx) && !line.Contains(pt))
{
sb.AppendLine(line);
}
}
File.Delete(manifest);
File.WriteAllText(manifest, sb.ToString());
}
[Theory]
[MemberData("GetProjectTemplatesForGenerationAsync")]
[Trait("Type", "GenerationAllPagesAndFeatures")]
@ -111,7 +165,7 @@ namespace Microsoft.Templates.Test
}
[Theory]
[MemberData("GetPageAndFeatureTemplatesAsync", "CaliburnMicro")]
[MemberData("GetPageAndFeatureTemplatesForGenerationAsync", "CaliburnMicro")]
[Trait("Type", "GenerationOneByOneCaliburnMicro")]
public async Task GenCaliburnMicroOneByOneItemsAsync(string itemName, string projectType, string framework, string itemId, string language)
{

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

@ -1,43 +0,0 @@
// 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 GenTestTemplatesSource : TemplatesSource
{
private string _localVersion = "0.0.0.0";
protected override bool VerifyPackageSignatures => false;
public override bool ForcedAcquisition => true;
public string Origin => $@"..\..\..\..\..\{SourceFolderName}";
public override string Id => "TestGen";
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"), _localVersion, Encoding.UTF8);
return TemplatePackage.Pack(tempFolder);
}
private void Copy(string sourceFolder, string targetFolder)
{
Fs.SafeDeleteDirectory(targetFolder);
Fs.CopyRecursive(sourceFolder, targetFolder);
}
}
}

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

@ -27,7 +27,7 @@ namespace Microsoft.Templates.Test
private string testExecutionTimeStamp = DateTime.Now.FormatAsDateHoursMinutes();
public override string GetTestRunPath() => $"{Path.GetPathRoot(Environment.CurrentDirectory)}\\UIT\\Generation\\{testExecutionTimeStamp}\\";
public TemplatesSource Source => new GenTestTemplatesSource();
public TemplatesSource Source => new LocalTemplatesSource("TestGen");
private static bool syncExecuted;
@ -36,7 +36,7 @@ namespace Microsoft.Templates.Test
List<object[]> result = new List<object[]>();
foreach (var language in ProgrammingLanguages.GetAllLanguages())
{
await InitializeTemplatesForLanguageAsync(new GenTestTemplatesSource(), language);
await InitializeTemplatesForLanguageAsync(new LocalTemplatesSource("TestGen"), language);
var projectTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetTemplateType() == TemplateType.Project
&& t.GetLanguage() == language);
@ -64,7 +64,7 @@ namespace Microsoft.Templates.Test
List<object[]> result = new List<object[]>();
foreach (var language in ProgrammingLanguages.GetAllLanguages())
{
await InitializeTemplatesForLanguageAsync(new GenTestTemplatesSource(), language);
await InitializeTemplatesForLanguageAsync(new LocalTemplatesSource("TestGen"), language);
var projectTemplates = GenContext.ToolBox.Repo.GetAll().Where(t => t.GetTemplateType() == TemplateType.Project
&& t.GetLanguage() == language);

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

@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.IO;
using System;
using Microsoft.Templates.Core;
using Microsoft.Templates.Core.Locations;
@ -10,50 +11,26 @@ using Microsoft.Templates.Core.Packaging;
namespace Microsoft.Templates.Test
{
public class StyleCopPlusLocalTemplatesSource : TemplatesSource
public class StyleCopPlusLocalTemplatesSource : LocalTemplatesSource
{
public string LocalTemplatesVersion { get; private set; }
public string LocalWizardVersion { get; private set; }
protected override bool VerifyPackageSignatures => false;
public string Origin => $@"..\..\..\..\..\{SourceFolderName}";
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public StyleCopPlusLocalTemplatesSource() : this("0.0.0.0", "0.0.0.0")
public StyleCopPlusLocalTemplatesSource() : base("BuildStyleCop")
{
ForcedAcquisition = true;
}
public override void Extract(string source, string targetFolder)
{
base.Extract(source, targetFolder);
SetStyleCopFeatureContent();
}
public override string Id => "BuildStyleCop";
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public StyleCopPlusLocalTemplatesSource(string wizardVersion, string templatesVersion, bool forcedAdquisition = true)
private void SetStyleCopFeatureContent()
{
ForcedAcquisition = forcedAdquisition;
LocalTemplatesVersion = templatesVersion;
LocalWizardVersion = wizardVersion;
}
protected override string AcquireMstx()
{
// Compress Content adding version return TemplatePackage path.
var tempFolder = Path.Combine(GetTempFolder(), SourceFolderName);
Copy(Origin, tempFolder);
Fs.CopyRecursive(@".\TestData\StyleCop", Path.Combine(tempFolder, "Features", "StyleCop"));
File.WriteAllText(Path.Combine(tempFolder, "version.txt"), LocalTemplatesVersion);
return TemplatePackage.Pack(tempFolder);
}
protected static void Copy(string sourceFolder, string targetFolder)
{
Fs.SafeDeleteDirectory(targetFolder);
Fs.CopyRecursive(sourceFolder, targetFolder);
string targetStyleCopFeaturePath = Path.Combine(FinalDestination, "Features", "StyleCop");
if (Directory.Exists(targetStyleCopFeaturePath))
{
Fs.SafeDeleteDirectory(targetStyleCopFeaturePath);
}
Fs.CopyRecursive(@".\TestData\StyleCop", targetStyleCopFeaturePath, true);
}
}
}

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

@ -123,23 +123,17 @@
<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" />
<Compile Include="BuildMVVMBasic\BuildMVVMBasicProjectsTests.cs" />
<Compile Include="BuildMVVMBasic\BuildMVVMBasicTestsTemplateSource.cs" />
<Compile Include="BuildMVVMLightTests\BuildMVVMLightCollection.cs" />
<Compile Include="BuildMVVMLightTests\BuildMVVMLightFixture.cs" />
<Compile Include="BuildMVVMLightTests\BuildMVVMLightProjectsTests.cs" />
<Compile Include="BuildMVVMLightTests\BuildMVVMLightTestsTemplateSource.cs" />
<Compile Include="BuildCodeBehindTests\BuildCodeBehindProjectsTests.cs" />
<Compile Include="BuildCodeBehindTests\BuildCodeBehindFixture.cs" />
<Compile Include="BuildFixture.cs" />
<Compile Include="BuildTestsTemplateSource.cs" />
<Compile Include="GenTests\GenerationCollection.cs" />
<Compile Include="GenTests\GenTestsTemplateSource.cs" />
<Compile Include="BuildCodeBehindTests\BuildCodeBehindTestsTemplateSource.cs" />
<Compile Include="GenTests\GenProjectsTests.cs" />
<Compile Include="FileEncodingTests.cs" />
<Compile Include="BaseTestContextProvider.cs" />

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

@ -0,0 +1,99 @@
# Perspective Parllax
## Overview and Purpose
This page describes how to enable Fluent Design parallax features in a
Windows Template Studio enabled application.
## Prerequisites
Perspective Parallax as a control is available as of the Fall Creators Update,
which enables all of the new Fluent features. This method also utilizes
conditional XAML, a Creators update feature, which allows the selective
enabling or disabling of features at runtime which aren't available on the
target computer.
This tutorial requires and assumes the following of your project and development environment
- An updated Visual Studio 2017 development environment
- The most current (Fall Creators Update) Windows 10 SDK
- Project Max Version set to Fall Creators Update or above (Release XXXXX)
- Project Min Version set to Creators Update (Release 15063)
## Conditional XAML
### What and Why
Conditional XAML is a set of directives for the XAML parser that allow you to selectively instantiate objects in markup at runtime based on if the relevant API exists on the target machine. As long as the project is compiled using a recent enough SDK that the "newest" controls exist in that API, then you as a developer can enable backwards compatability as far back at the Creators Update.
### How to Enable
The equivalent of the if statement is the conditional namespace.
``` XML
xmlns:myNamespace="schema?conditionalMethod(parameter)
```
The delimiter `?` separates the namespace on the left and the conditional on the right. At runtime, the namespace is evaluated as true or false based on the condition. By prefixing XAML objects with this namespace, if at runtime, it evaluates to true, the object is instantiated and if it evaluates to false, it is ignored.
In our case, the ParallaxView control is new for the Fall Creators Update. This update introduces the 5th version of the Universal API Contract. The condition to check for such a version is as follows
``` XML
IsApiContractPresent(ContractName, VersionNumber)
```
Therefore, we could create a namespace that checks for the 5th version of the contract in the following way. It would be added to our page in the following way
``` XML
xmlns:fcu="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,5)"
<UserControl
x:Class="XXXXX"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
...
xmlns:fcu="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,5)"
```
We can then conditionally instantiate controls based on the API contract as follows. In this example, the ColorPicker (a control only introduced in the Fall Creators Update) is only created at runtime when the machine it is running on has the right APIs.
``` XML
<fcu:ColorPicker x:Name="colorPicker" Grid.Column="1"/>
```
## Parallax Controls
### What is Parallax
Parallax is a visual effect where items closer to the viewer move faster than items in the background. Parallax creates a feeling of depth, perspective, and movement. In a UWP app, you can use the ParallaxView control to create a parallax effect. Parallax is a Fluent Design System component that adds motion, depth, and scale to your app.
ParallaxView becomes generally available starting in the Fall Creator's Update
### Appropriate Use
Microsoft gives the following general recommendations for where Parallax is appropriate for use.
+ Use parallax in lists with a background image
+ Consider using parallax in ListViewItems when ListViewItems contain an image
+ Dont use it everywhere, overuse can diminish its impact
### How to Enable
To create a parallax effect, you use the ParallaxView control. This control ties the scroll position of a foreground element, such as a list, to a background element, such as an image. As you scroll through the foreground element, it animates the background element to create a parallax effect.
To use the ParallaxView control, you provide a Source element and a background element.
As in the above section, we are going to selectively create a ParallaxView control only when the APIs exist.
``` XML
<Grid>
<fcu:ParallaxView Source="{x:Bind ForegroundElement}">
<fcu:Image x:Name="BackgroundImage" Source="/Assets/XXXX.jpg"/>
</fcu:ParallaxView>
<ScrollViewer Name="ForegroundElement".../>
...
</Grid>
```
Add the above snippet of code into the Content grid at the root level. Ensure the content you want to be captured inside the parallax (ie the scrollviewer) is named ForegroundElement and is also at the root of the grid.
## Further Reading
1. [Parallax and the Fluent Design System](https://docs.microsoft.com/en-us/windows/uwp/style/parallax)
2. [Conditional XAML](https://docs.microsoft.com/en-us/windows/uwp/debug-test-perf/conditional-xaml)
3. [Further reading on ParallaxView](https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.Parallaxview)

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

@ -1,4 +1,5 @@
using System;
using Windows.UI.Xaml.Controls;
namespace Param_ItemNamespace.Models
{
@ -18,5 +19,22 @@ namespace Param_ItemNamespace.Models
public double OrderTotal { get; set; }
public string Status { get; set; }
public Symbol Symbol { get; set; }
public char SymbolAsChar
{
get { return (char)Symbol; }
}
public string HashIdentIcon
{
get { return GetHashCode().ToString() + "-icon"; }
}
public string HashIdentTitle
{
get { return GetHashCode().ToString() + "-title"; }
}
}
}

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

@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Windows.UI.Xaml.Controls;
namespace Param_ItemNamespace.Services
{
@ -21,7 +22,8 @@ namespace Param_ItemNamespace.Services
Company = "Company F",
ShipTo = "Francisco Pérez-Olaeta",
OrderTotal = 2490.00,
Status = "Closed"
Status = "Closed",
Symbol = Symbol.Globe
},
new SampleOrder
{
@ -30,7 +32,8 @@ namespace Param_ItemNamespace.Services
Company = "Company CC",
ShipTo = "Soo Jung Lee",
OrderTotal = 1760.00,
Status = "Closed"
Status = "Closed",
Symbol = Symbol.Audio
},
new SampleOrder
{
@ -39,7 +42,8 @@ namespace Param_ItemNamespace.Services
Company = "Company Z",
ShipTo = "Run Liu",
OrderTotal = 2310.00,
Status = "Closed"
Status = "Closed",
Symbol = Symbol.Calendar
},
new SampleOrder
{
@ -48,7 +52,8 @@ namespace Param_ItemNamespace.Services
Company = "Company Y",
ShipTo = "John Rodman",
OrderTotal = 665.00,
Status = "Closed"
Status = "Closed",
Symbol = Symbol.Camera
},
new SampleOrder
{
@ -57,7 +62,8 @@ namespace Param_ItemNamespace.Services
Company = "Company H",
ShipTo = "Elizabeth Andersen",
OrderTotal = 560.00,
Status = "Shipped"
Status = "Shipped",
Symbol = Symbol.Clock
},
new SampleOrder
{
@ -66,7 +72,8 @@ namespace Param_ItemNamespace.Services
Company = "Company F",
ShipTo = "Francisco Pérez-Olaeta",
OrderTotal = 810.00,
Status = "Shipped"
Status = "Shipped",
Symbol = Symbol.Contact
},
new SampleOrder
{
@ -75,7 +82,8 @@ namespace Param_ItemNamespace.Services
Company = "Company I",
ShipTo = "Sven Mortensen",
OrderTotal = 196.50,
Status = "Shipped"
Status = "Shipped",
Symbol = Symbol.Favorite
},
new SampleOrder
{
@ -84,7 +92,8 @@ namespace Param_ItemNamespace.Services
Company = "Company BB",
ShipTo = "Amritansh Raghav",
OrderTotal = 270.00,
Status = "New"
Status = "New",
Symbol = Symbol.Home
},
new SampleOrder
{
@ -93,7 +102,8 @@ namespace Param_ItemNamespace.Services
Company = "Company A",
ShipTo = "Anna Bedecs",
OrderTotal = 736.00,
Status = "New"
Status = "New",
Symbol = Symbol.Mail
},
new SampleOrder
{
@ -102,7 +112,8 @@ namespace Param_ItemNamespace.Services
Company = "Company K",
ShipTo = "Peter Krschne",
OrderTotal = 800.00,
Status = "New"
Status = "New",
Symbol = Symbol.OutlineStar
},
};

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

@ -9,38 +9,55 @@
d:DesignWidth="400">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="48"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock
x:Name="TitlePage"
Text="{x:Bind MasterMenuItem.OrderId, Mode=OneWay}"
Style="{StaticResource PageTitleStyle}" />
<!--The SystemControlPageBackgroundChromeLowBrush background represents where you should place your detail content.-->
<Grid Grid.Row="1">
<ScrollViewer Name="ForegroundElement" VerticalScrollMode="Enabled" HorizontalAlignment="Stretch" Padding="24,48,0,0" >
<StackPanel HorizontalAlignment="Left">
<Border BorderThickness="0,0,0,0" BorderBrush="Gray">
<StackPanel Orientation="Horizontal" MaxHeight="200" HorizontalAlignment="Stretch">
<FontIcon
Name="Icon"
FontSize="46"
Glyph="{x:Bind MasterMenuItem.SymbolAsChar, Mode=OneWay}"
VerticalAlignment="Center" Margin="0,0,30,0"
HorizontalAlignment="Center"/>
<TextBlock
Name="Title"
Text="{x:Bind MasterMenuItem.Company, Mode=OneWay}"
FontSize="46" FontWeight="Light" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"
VerticalAlignment="Center" HorizontalAlignment="Center" />
</StackPanel>
</Border>
<StackPanel Padding="0,15,0,0">
<TextBlock Text="Status" FontSize="20" FontWeight="SemiLight" />
<TextBlock Text="{x:Bind MasterMenuItem.Status, Mode=OneWay}" FontSize="15" Padding="0,0,0,6" />
<TextBlock Text="Order date" Style="{StaticResource CaptionTextBlockStyle}" FontSize="20" FontWeight="SemiLight" />
<TextBlock Text="{x:Bind MasterMenuItem.OrderDate, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" FontSize="15" Padding="0,0,0,6" />
<TextBlock Text="Company" Style="{StaticResource CaptionTextBlockStyle}" FontSize="20" FontWeight="SemiLight" />
<TextBlock Text="{x:Bind MasterMenuItem.Company, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" FontSize="15" Padding="0,0,0,6" />
<TextBlock Text="Ship to" Style="{StaticResource CaptionTextBlockStyle}" FontSize="20" FontWeight="SemiLight" />
<TextBlock Text="{x:Bind MasterMenuItem.ShipTo, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" FontSize="15" Padding="0,0,0,6" />
<TextBlock Text="Order total" Style="{StaticResource CaptionTextBlockStyle}" FontSize="20" FontWeight="SemiLight" />
<TextBlock Text="{x:Bind MasterMenuItem.OrderTotal, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" FontSize="15" Padding="0,0,0,6" />
<ScrollViewer
Grid.Row="1"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollMode="Auto">
<TextBlock FontSize="20" FontWeight="SemiLight" Text="Note 1" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock FontSize="15" Padding="0,0,0,6" MaxWidth="1000" Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis quis hendrerit nulla, vel molestie libero. In nec ultricies magna, ultricies molestie ipsum. Mauris non dignissim velit. Etiam malesuada blandit mauris eu maximus. Quisque ornare, felis nec scelerisque mollis, risus dolor posuere magna, in gravida quam mi id nisi. Nullam mattis consequat ex. Cras nulla neque, dictum ac urna et, vestibulum feugiat ex. Pellentesque malesuada accumsan ligula, vel fringilla lacus facilisis sit amet. Proin convallis tempor arcu, ac placerat libero pretium ut. Praesent hendrerit nisl at lobortis viverra. Fusce vitae velit odio. Nam ut tortor sed purus finibus sollicitudin quis at ante. Ut sodales dolor vel eros mollis suscipit. Donec eu nulla id urna ultricies consequat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;" Style="{StaticResource BodyTextStyle}" />
<!--The SystemControlPageBackgroundChromeLowBrush background represents where you should place your detail content.-->
<Grid Background="{ThemeResource SystemControlPageBackgroundChromeLowBrush}">
<TextBlock FontSize="20" FontWeight="SemiLight" Text="Note 2" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock FontSize="15" Padding="0,0,0,6" MaxWidth="1000" Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis quis hendrerit nulla, vel molestie libero. In nec ultricies magna, ultricies molestie ipsum. Mauris non dignissim velit. Etiam malesuada blandit mauris eu maximus. Quisque ornare, felis nec scelerisque mollis, risus dolor posuere magna, in gravida quam mi id nisi. Nullam mattis consequat ex. Cras nulla neque, dictum ac urna et, vestibulum feugiat ex. Pellentesque malesuada accumsan ligula, vel fringilla lacus facilisis sit amet. Proin convallis tempor arcu, ac placerat libero pretium ut. Praesent hendrerit nisl at lobortis viverra. Fusce vitae velit odio. Nam ut tortor sed purus finibus sollicitudin quis at ante. Ut sodales dolor vel eros mollis suscipit. Donec eu nulla id urna ultricies consequat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;" Style="{StaticResource BodyTextStyle}" />
<!--Replate this StackPanel with your detail content.-->
<StackPanel Orientation="Vertical" Margin="{StaticResource MediumLeftTopRightBottomMargin}">
<TextBlock Text="Order Date" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock Text="{x:Bind MasterMenuItem.OrderDate, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" />
<TextBlock Text="Company" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock Text="{x:Bind MasterMenuItem.Company, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" />
<TextBlock Text="Ship to" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock Text="{x:Bind MasterMenuItem.ShipTo, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" />
<TextBlock Text="Order Total" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock Text="{x:Bind MasterMenuItem.OrderTotal, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" />
<TextBlock Text="Status" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock Text="{x:Bind MasterMenuItem.Status, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" />
<TextBlock FontSize="20" FontWeight="SemiLight" Text="Note 3" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock FontSize="15" Padding="0,0,0,6" MaxWidth="1000" Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis quis hendrerit nulla, vel molestie libero. In nec ultricies magna, ultricies molestie ipsum. Mauris non dignissim velit. Etiam malesuada blandit mauris eu maximus. Quisque ornare, felis nec scelerisque mollis, risus dolor posuere magna, in gravida quam mi id nisi. Nullam mattis consequat ex. Cras nulla neque, dictum ac urna et, vestibulum feugiat ex. Pellentesque malesuada accumsan ligula, vel fringilla lacus facilisis sit amet. Proin convallis tempor arcu, ac placerat libero pretium ut. Praesent hendrerit nisl at lobortis viverra. Fusce vitae velit odio. Nam ut tortor sed purus finibus sollicitudin quis at ante. Ut sodales dolor vel eros mollis suscipit. Donec eu nulla id urna ultricies consequat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;" Style="{StaticResource BodyTextStyle}" />
<TextBlock FontSize="20" FontWeight="SemiLight" Text="Note 4" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock FontSize="15" Padding="0,0,0,6" MaxWidth="1000" Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis quis hendrerit nulla, vel molestie libero. In nec ultricies magna, ultricies molestie ipsum. Mauris non dignissim velit. Etiam malesuada blandit mauris eu maximus. Quisque ornare, felis nec scelerisque mollis, risus dolor posuere magna, in gravida quam mi id nisi. Nullam mattis consequat ex. Cras nulla neque, dictum ac urna et, vestibulum feugiat ex. Pellentesque malesuada accumsan ligula, vel fringilla lacus facilisis sit amet. Proin convallis tempor arcu, ac placerat libero pretium ut. Praesent hendrerit nisl at lobortis viverra. Fusce vitae velit odio. Nam ut tortor sed purus finibus sollicitudin quis at ante. Ut sodales dolor vel eros mollis suscipit. Donec eu nulla id urna ultricies consequat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;" Style="{StaticResource BodyTextStyle}" />
</StackPanel>
</StackPanel>
</Grid>
</ScrollViewer>
</ScrollViewer>
</Grid>
</Grid>
</UserControl>

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

@ -10,8 +10,7 @@
mc:Ignorable="d">
<Grid
x:Name="ContentArea"
Background="{ThemeResource SystemControlBackgroundAltHighBrush}">
x:Name="ContentArea">
<views:MasterDetailDetailControl
Margin="{StaticResource MediumLeftRightMargin}"

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

@ -9,25 +9,45 @@
mc:Ignorable="d">
<Page.Resources>
<DataTemplate x:Key="MasterListViewItemTemplate" x:DataType="model:SampleOrder">
<Grid Margin="{StaticResource MediumLeftTopRightBottomMargin}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Margin="{StaticResource MediumLeftTopRightBottomMargin}" >
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Row="1">
<RelativePanel>
<Rectangle Stroke="Gray"
Fill="LightGray"
Width="48"
Height="48"
StrokeThickness="0"
Name="border"
RelativePanel.AlignVerticalCenterWithPanel="True"/>
<FontIcon
Name="icon"
Tag="{x:Bind HashIdentIcon}"
FontSize="35"
Glyph="{x:Bind SymbolAsChar}" VerticalAlignment="Top"
RelativePanel.AlignVerticalCenterWith="border"
RelativePanel.AlignHorizontalCenterWith="border"/>
<TextBlock
Text="{x:Bind OrderId}"
Style="{StaticResource ListTitleStyle}" />
<TextBlock
Grid.Row="1"
Text="{x:Bind Company}"
Style="{StaticResource ListSubTitleStyle}" />
<StackPanel RelativePanel.AlignVerticalCenterWithPanel="True" Margin="12,0,0,0" RelativePanel.RightOf="border">
<TextBlock
Name="title"
RelativePanel.RightOf="border"
Text="{x:Bind Company}"
Tag="{x:Bind HashIdentTitle}"
Style="{StaticResource BaseTextBlockStyle}"/>
<TextBlock
Name="subtitle"
RelativePanel.Below="title"
RelativePanel.AlignLeftWith="title"
Text="{x:Bind Status}"
Style="{StaticResource BodyTextBlockStyle}"/>
</StackPanel>
</RelativePanel>
</StackPanel>
</Grid>
</DataTemplate>
</Page.Resources>
<Grid
<Grid
x:Name="ContentArea"
Padding="12,0,12,0">
@ -71,7 +91,6 @@
ItemContainerTransitions="{x:Null}"
ItemTemplate="{StaticResource MasterListViewItemTemplate}"
IsItemClickEnabled="True"
Background="{ThemeResource SystemControlPageBackgroundChromeLowBrush}"
ItemClick="MasterListView_ItemClick">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
@ -92,7 +111,7 @@
x:Name="DetailControl"
MasterMenuItem="{x:Bind Selected, Mode=OneWay}"/>
</Grid>
<!-- Adaptive triggers -->
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="WindowStates">
@ -110,6 +129,7 @@
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="TitlePage.Margin" Value="48,0,12,7"/>
<Setter Target="TitleRow.Height" Value="48"/>
<Setter Target="MasterRow.Height" Value="Auto"/>
<Setter Target="TitlePage.Visibility" Value="Visible"/>

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

@ -1,7 +1,11 @@
using System;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
using Param_ItemNamespace.Models;
using Param_ItemNamespace.Services;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using System.Linq;

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

@ -9,38 +9,54 @@
d:DesignWidth="400">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="48"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock
x:Name="TitlePage"
Text="{x:Bind MasterMenuItem.OrderId, Mode=OneWay}"
Style="{StaticResource PageTitleStyle}" />
<!--The SystemControlPageBackgroundChromeLowBrush background represents where you should place your detail content.-->
<Grid Grid.Row="1">
<ScrollViewer Name="ForegroundElement" VerticalScrollMode="Enabled" HorizontalAlignment="Stretch" Padding="24,48,0,0" >
<StackPanel HorizontalAlignment="Left">
<Border BorderThickness="0,0,0,0" BorderBrush="Gray">
<StackPanel Orientation="Horizontal" MaxHeight="200" HorizontalAlignment="Stretch">
<FontIcon
Name="Icon"
FontSize="46"
Glyph="{x:Bind MasterMenuItem.SymbolAsChar, Mode=OneWay}"
VerticalAlignment="Center" Margin="0,0,30,0"
HorizontalAlignment="Center"/>
<TextBlock
Name="Title"
Text="{x:Bind MasterMenuItem.Company, Mode=OneWay}"
FontSize="46" FontWeight="Light" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"
VerticalAlignment="Center" HorizontalAlignment="Center" />
</StackPanel>
</Border>
<StackPanel Name="block" Padding="0,15,0,0">
<TextBlock Text="Status" FontSize="20" FontWeight="SemiLight" />
<TextBlock Text="{x:Bind MasterMenuItem.Status, Mode=OneWay}" FontSize="15" Padding="0,0,0,6" />
<TextBlock Text="Order date" Style="{StaticResource CaptionTextBlockStyle}" FontSize="20" FontWeight="SemiLight" />
<TextBlock Text="{x:Bind MasterMenuItem.OrderDate, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" FontSize="15" Padding="0,0,0,6" />
<TextBlock Text="Company" Style="{StaticResource CaptionTextBlockStyle}" FontSize="20" FontWeight="SemiLight" />
<TextBlock Text="{x:Bind MasterMenuItem.Company, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" FontSize="15" Padding="0,0,0,6" />
<TextBlock Text="Ship to" Style="{StaticResource CaptionTextBlockStyle}" FontSize="20" FontWeight="SemiLight" />
<TextBlock Text="{x:Bind MasterMenuItem.ShipTo, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" FontSize="15" Padding="0,0,0,6" />
<TextBlock Text="Order total" Style="{StaticResource CaptionTextBlockStyle}" FontSize="20" FontWeight="SemiLight" />
<TextBlock Text="{x:Bind MasterMenuItem.OrderTotal, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" FontSize="15" Padding="0,0,0,6" />
<ScrollViewer
Grid.Row="1"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollMode="Auto">
<TextBlock FontSize="20" FontWeight="SemiLight" Text="Note 1" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock FontSize="15" Padding="0,0,0,6" MaxWidth="1000" Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis quis hendrerit nulla, vel molestie libero. In nec ultricies magna, ultricies molestie ipsum. Mauris non dignissim velit. Etiam malesuada blandit mauris eu maximus. Quisque ornare, felis nec scelerisque mollis, risus dolor posuere magna, in gravida quam mi id nisi. Nullam mattis consequat ex. Cras nulla neque, dictum ac urna et, vestibulum feugiat ex. Pellentesque malesuada accumsan ligula, vel fringilla lacus facilisis sit amet. Proin convallis tempor arcu, ac placerat libero pretium ut. Praesent hendrerit nisl at lobortis viverra. Fusce vitae velit odio. Nam ut tortor sed purus finibus sollicitudin quis at ante. Ut sodales dolor vel eros mollis suscipit. Donec eu nulla id urna ultricies consequat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;" Style="{StaticResource BodyTextStyle}" />
<!--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 MasterMenuItem.OrderDate, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" />
<TextBlock Text="Company" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock Text="{x:Bind MasterMenuItem.Company, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" />
<TextBlock Text="Ship to" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock Text="{x:Bind MasterMenuItem.ShipTo, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" />
<TextBlock Text="Order Total" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock Text="{x:Bind MasterMenuItem.OrderTotal, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" />
<TextBlock Text="Status" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock Text="{x:Bind MasterMenuItem.Status, Mode=OneWay}" Style="{StaticResource BodyTextStyle}" />
<TextBlock FontSize="20" FontWeight="SemiLight" Text="Note 2" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock FontSize="15" Padding="0,0,0,6" MaxWidth="1000" Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis quis hendrerit nulla, vel molestie libero. In nec ultricies magna, ultricies molestie ipsum. Mauris non dignissim velit. Etiam malesuada blandit mauris eu maximus. Quisque ornare, felis nec scelerisque mollis, risus dolor posuere magna, in gravida quam mi id nisi. Nullam mattis consequat ex. Cras nulla neque, dictum ac urna et, vestibulum feugiat ex. Pellentesque malesuada accumsan ligula, vel fringilla lacus facilisis sit amet. Proin convallis tempor arcu, ac placerat libero pretium ut. Praesent hendrerit nisl at lobortis viverra. Fusce vitae velit odio. Nam ut tortor sed purus finibus sollicitudin quis at ante. Ut sodales dolor vel eros mollis suscipit. Donec eu nulla id urna ultricies consequat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;" Style="{StaticResource BodyTextStyle}" />
<TextBlock FontSize="20" FontWeight="SemiLight" Text="Note 3" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock FontSize="15" Padding="0,0,0,6" MaxWidth="1000" Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis quis hendrerit nulla, vel molestie libero. In nec ultricies magna, ultricies molestie ipsum. Mauris non dignissim velit. Etiam malesuada blandit mauris eu maximus. Quisque ornare, felis nec scelerisque mollis, risus dolor posuere magna, in gravida quam mi id nisi. Nullam mattis consequat ex. Cras nulla neque, dictum ac urna et, vestibulum feugiat ex. Pellentesque malesuada accumsan ligula, vel fringilla lacus facilisis sit amet. Proin convallis tempor arcu, ac placerat libero pretium ut. Praesent hendrerit nisl at lobortis viverra. Fusce vitae velit odio. Nam ut tortor sed purus finibus sollicitudin quis at ante. Ut sodales dolor vel eros mollis suscipit. Donec eu nulla id urna ultricies consequat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;" Style="{StaticResource BodyTextStyle}" />
<TextBlock FontSize="20" FontWeight="SemiLight" Text="Note 4" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock FontSize="15" Padding="0,0,0,6" MaxWidth="1000" Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis quis hendrerit nulla, vel molestie libero. In nec ultricies magna, ultricies molestie ipsum. Mauris non dignissim velit. Etiam malesuada blandit mauris eu maximus. Quisque ornare, felis nec scelerisque mollis, risus dolor posuere magna, in gravida quam mi id nisi. Nullam mattis consequat ex. Cras nulla neque, dictum ac urna et, vestibulum feugiat ex. Pellentesque malesuada accumsan ligula, vel fringilla lacus facilisis sit amet. Proin convallis tempor arcu, ac placerat libero pretium ut. Praesent hendrerit nisl at lobortis viverra. Fusce vitae velit odio. Nam ut tortor sed purus finibus sollicitudin quis at ante. Ut sodales dolor vel eros mollis suscipit. Donec eu nulla id urna ultricies consequat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;" Style="{StaticResource BodyTextStyle}" />
</StackPanel>
</StackPanel>
</Grid>
</ScrollViewer>
</ScrollViewer>
</Grid>
</Grid>
</UserControl>

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

@ -1,7 +1,6 @@
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Param_ItemNamespace.Models;
namespace Param_ItemNamespace.Views

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

@ -11,20 +11,40 @@
mc:Ignorable="d">
<Page.Resources>
<DataTemplate x:Key="MasterListViewItemTemplate" x:DataType="model:SampleOrder">
<Grid Margin="{StaticResource MediumLeftTopRightBottomMargin}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Margin="{StaticResource MediumLeftTopRightBottomMargin}" >
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Row="1">
<RelativePanel>
<Rectangle Stroke="Gray"
Fill="LightGray"
Width="48"
Height="48"
StrokeThickness="0"
Name="border"
RelativePanel.AlignVerticalCenterWithPanel="True"/>
<FontIcon
Name="icon"
Tag="{x:Bind HashIdentIcon}"
FontSize="35"
Glyph="{x:Bind SymbolAsChar}" VerticalAlignment="Top"
RelativePanel.AlignVerticalCenterWith="border"
RelativePanel.AlignHorizontalCenterWith="border"/>
<TextBlock
Text="{x:Bind OrderId}"
Style="{StaticResource ListTitleStyle}" />
<TextBlock
Grid.Row="1"
Text="{x:Bind Company}"
Style="{StaticResource ListSubTitleStyle}" />
<StackPanel RelativePanel.AlignVerticalCenterWithPanel="True" Margin="12,0,0,0" RelativePanel.RightOf="border">
<TextBlock
Name="title"
RelativePanel.RightOf="border"
Text="{x:Bind Company}"
Tag="{x:Bind HashIdentTitle}"
Style="{StaticResource BaseTextBlockStyle}"/>
<TextBlock
Name="subtitle"
RelativePanel.Below="title"
RelativePanel.AlignLeftWith="title"
Text="{x:Bind Status}"
Style="{StaticResource BodyTextBlockStyle}"/>
</StackPanel>
</RelativePanel>
</StackPanel>
</Grid>
</DataTemplate>
</Page.Resources>
@ -72,8 +92,7 @@
SelectedItem="{x:Bind ViewModel.Selected, Mode=OneWay}"
ItemContainerTransitions="{x:Null}"
ItemTemplate="{StaticResource MasterListViewItemTemplate}"
IsItemClickEnabled="True"
Background="{ThemeResource SystemControlPageBackgroundChromeLowBrush}">
IsItemClickEnabled="True">
<i:Interaction.Behaviors>
<ic:EventTriggerBehavior EventName="ItemClick">
<ic:InvokeCommandAction Command="{x:Bind ViewModel.ItemClickCommand}" />
@ -121,6 +140,7 @@
<AdaptiveTrigger MinWindowWidth="0"/>
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="TitlePage.Margin" Value="48,0,12,7"/>
<Setter Target="TitleRow.Height" Value="48"/>
<Setter Target="MasterRow.Height" Value="Auto"/>
<Setter Target="TitlePage.Visibility" Value="Visible"/>

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

@ -7,6 +7,8 @@
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
xmlns:cm="using:Caliburn.Micro"
xmlns:fcu ="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,5)"
xmlns:cu ="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,5)"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="BrowserButtonStyle" TargetType="Button">
@ -98,7 +100,7 @@
<HyperlinkButton cm:Message.Attach="Retry" x:Uid="WebViewPage_Retry" HorizontalAlignment="Center" />
</StackPanel>
<Grid Grid.Row="1" Background="{ThemeResource SystemControlBackgroundBaseLowBrush}">
<Grid fcu:VerticalAlignment="Bottom" cu:Grid.Row="1" cu:Background="{ThemeResource SystemControlBackgroundBaseLowBrush}" fcu:Background="{ThemeResource SystemControlChromeHighAcrylicElementMediumBrush }">
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource BrowserButtonStyle}" cm:Message.Attach="GoBack" x:Uid="WebViewPage_BrowserBackButton">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE72B;" />

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

@ -4,6 +4,8 @@
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:fcu ="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,5)"
xmlns:cu ="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,5)"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="BrowserButtonStyle" TargetType="Button">
@ -94,7 +96,7 @@
<HyperlinkButton Click="OnRetry" x:Uid="WebViewPage_Retry" HorizontalAlignment="Center" />
</StackPanel>
<Grid Grid.Row="1" Background="{ThemeResource SystemControlBackgroundBaseLowBrush}">
<Grid fcu:VerticalAlignment="Bottom" cu:Grid.Row="1" cu:Background="{ThemeResource SystemControlBackgroundBaseLowBrush}" fcu:Background="{ThemeResource SystemControlChromeHighAcrylicElementMediumBrush }">
<StackPanel Orientation="Horizontal">
<Button IsEnabled="{x:Bind IsBackEnabled, Mode=OneWay}" Style="{StaticResource BrowserButtonStyle}" Click="OnGoBack" x:Uid="WebViewPage_BrowserBackButton">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE72B;" />

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

@ -1,6 +1,8 @@
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace Param_ItemNamespace.Views
{

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

@ -6,6 +6,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
xmlns:fcu ="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,5)"
xmlns:cu ="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,5)"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="BrowserButtonStyle" TargetType="Button">
@ -103,7 +105,7 @@
<HyperlinkButton Command="{x:Bind ViewModel.RetryCommand}" x:Uid="WebViewPage_Retry" HorizontalAlignment="Center" />
</StackPanel>
<Grid Grid.Row="1" Background="{ThemeResource SystemControlBackgroundBaseLowBrush}">
<Grid fcu:VerticalAlignment="Bottom" cu:Grid.Row="1" cu:Background="{ThemeResource SystemControlBackgroundBaseLowBrush}" fcu:Background="{ThemeResource SystemControlChromeHighAcrylicElementMediumBrush }">
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource BrowserButtonStyle}" Command="{x:Bind ViewModel.BrowserBackCommand, Mode=OneWay}" x:Uid="WebViewPage_BrowserBackButton">
<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE72B;" />

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

@ -13,7 +13,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.15063.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>