-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscenario1_identity.xaml.cs
109 lines (101 loc) · 4.53 KB
/
scenario1_identity.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Navigation;
using System;
using Windows.ApplicationModel;
namespace PackageSampleHostedApp
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class Scenario1 : Page
{
// A pointer back to the main page. This is needed if you want to call methods in MainPage such
// as NotifyUser()
MainPage rootPage = MainPage.Current;
public Scenario1()
{
this.InitializeComponent();
}
String versionString(PackageVersion version)
{
return String.Format("{0}.{1}.{2}.{3}",
version.Major, version.Minor, version.Build, version.Revision);
}
String architectureString(Windows.System.ProcessorArchitecture architecture)
{
switch (architecture)
{
case Windows.System.ProcessorArchitecture.X86:
return "x86";
case Windows.System.ProcessorArchitecture.Arm:
return "arm";
case Windows.System.ProcessorArchitecture.X64:
return "x64";
case Windows.System.ProcessorArchitecture.Neutral:
return "neutral";
case Windows.System.ProcessorArchitecture.Unknown:
return "unknown";
default:
return "???";
}
}
void GetPackage_Click(Object sender, RoutedEventArgs e)
{
Package package = Package.Current;
PackageId packageId = package.Id;
String output = String.Format("Name: \"{0}\"\n" +
"Version: {1}\n" +
"Architecture: {2}\n" +
"ResourceId: \"{3}\"\n" +
"Publisher: \"{4}\"\n" +
"PublisherId: \"{5}\"\n" +
"FullName: \"{6}\"\n" +
"FamilyName: \"{7}\"\n" +
"IsFramework: {8}\n",
packageId.Name,
versionString(packageId.Version),
architectureString(packageId.Architecture),
packageId.ResourceId,
packageId.Publisher,
packageId.PublisherId,
packageId.FullName,
packageId.FamilyName,
package.IsFramework);
#if WINDOWS_APP
output += String.Format("IsResourcePackage: {0}\n" +
"IsBundle: {1}\n" +
"IsDevelopmentMode: {2}\n" +
"DisplayName: \"{3}\"\n" +
"PublisherDisplayName: \"{4}\"\n" +
"Description: \"{5}\"\n" +
"Logo: \"{6}\"\n",
package.IsResourcePackage,
package.IsBundle,
package.IsDevelopmentMode,
package.DisplayName,
package.PublisherDisplayName,
package.Description,
package.Logo.AbsoluteUri);
#endif
OutputTextBlock.Text = output;
}
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
}
}