This commit is contained in:
Oren Novotny 2019-04-16 09:57:07 -04:00
Родитель 681ad4d4ac
Коммит 8b0e115373
Не удалось извлечь подпись
6 изменённых файлов: 169 добавлений и 0 удалений

25
WpfCoreApp.sln Normal file
Просмотреть файл

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28815.163
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfCoreApp", "WpfCoreApp\WpfCoreApp.csproj", "{B7A8214D-3290-456E-8BFE-0C577B2CFC08}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B7A8214D-3290-456E-8BFE-0C577B2CFC08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B7A8214D-3290-456E-8BFE-0C577B2CFC08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7A8214D-3290-456E-8BFE-0C577B2CFC08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7A8214D-3290-456E-8BFE-0C577B2CFC08}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AA27FABE-9F44-416A-92EC-E45A95F1D034}
EndGlobalSection
EndGlobal

9
WpfCoreApp/App.xaml Normal file
Просмотреть файл

@ -0,0 +1,9 @@
<Application x:Class="WpfCoreApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfCoreApp"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

17
WpfCoreApp/App.xaml.cs Normal file
Просмотреть файл

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace WpfCoreApp
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

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

@ -0,0 +1,37 @@
<Window x:Class="WpfCoreApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfCoreApp"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window.Resources>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value="24" />
</Style>
<Style TargetType="Label">
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="24" />
</Style>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="Version" Target="{Binding ElementName=versionText}" VerticalAlignment="Center" />
<TextBlock x:Name="versionText" Grid.Column="1" VerticalAlignment="Center" />
<Label Grid.Row="1" Content="Deployment" Target="{Binding ElementName=deploymentType}" VerticalAlignment="Center" />
<TextBlock Grid.Row="1" x:Name="deploymentType" Grid.Column="1" VerticalAlignment="Center" />
<Label Grid.Row="2" Content="In Package" Target="{Binding ElementName=inPackage}" VerticalAlignment="Center" />
<TextBlock Grid.Row="2" x:Name="inPackage" Grid.Column="1" VerticalAlignment="Center" />
</Grid>
</Window>

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

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Versioning;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using OSVersionHelper;
namespace WpfCoreApp
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
versionText.Text = typeof(MainWindow).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
inPackage.Text = WindowsVersionHelper.HasPackageIdentity.ToString();
deploymentType.Text = GetDotNetInfo();
}
public static string GetDotNetInfo()
{
var runTimeDir = new FileInfo(typeof(string).Assembly.Location);
var entryDir = new FileInfo(Assembly.GetEntryAssembly().Location);
var IsSelfContaied = runTimeDir.DirectoryName == entryDir.DirectoryName;
var result = ".NET Core - ";
if (IsSelfContaied)
{
result += "Self Contained Deployment";
}
else
{
result += "Framework Dependent Deployment";
}
return result;
}
}
}

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

@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.138" PrivateAssets="all" />
<PackageReference Include="OSVersionHelper" Version="1.0.10" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Update="App.xaml">
<SubType>Designer</SubType>
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<Page Update="MainWindow.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>