Skip to content

Commit d3f7fbd

Browse files
authored
Merge branch 'main' into color-picker-switch-to-winui
2 parents 9fad966 + 09eb161 commit d3f7fbd

25 files changed

+815
-316
lines changed

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/SystemInformation/SystemInformationCode.bind

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
public bool IsAppUpdated => SystemInformation.Instance.IsAppUpdated;
3636

3737
// To get the first version installed
38-
public PackageVersion FirstVersionInstalled => SystemInformation.Instance.FirstVersionInstalled;
38+
public string FirstVersionInstalled => SystemInformation.Instance.FirstVersionInstalled.ToFormattedString();
39+
40+
// To get the previous version installed
41+
public string PreviousVersionInstalled => SystemInformation.Instance.PreviousVersionInstalled.ToFormattedString();
3942

4043
// To get the first time the app was launched
4144
public DateTime FirstUseTime => SystemInformation.Instance.FirstUseTime;

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/SystemInformation/SystemInformationPage.xaml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,18 @@
170170
<StackPanel x:Name="Stack13"
171171
Margin="10"
172172
Orientation="Horizontal">
173+
<TextBlock FontSize="18"
174+
FontWeight="Bold"
175+
Text="Previous version installed:"
176+
TextWrapping="Wrap" />
177+
<TextBlock Margin="20,0"
178+
FontSize="18"
179+
Text="{x:Bind PreviousVersionInstalled}"
180+
TextWrapping="Wrap" />
181+
</StackPanel>
182+
<StackPanel x:Name="Stack14"
183+
Margin="10"
184+
Orientation="Horizontal">
173185
<TextBlock FontSize="18"
174186
FontWeight="Bold"
175187
Text="First use time:"
@@ -179,7 +191,7 @@
179191
Text="{x:Bind FirstUseTime}"
180192
TextWrapping="Wrap" />
181193
</StackPanel>
182-
<StackPanel x:Name="Stack14"
194+
<StackPanel x:Name="Stack15"
183195
Margin="10"
184196
Orientation="Horizontal">
185197
<TextBlock FontSize="18"
@@ -191,7 +203,7 @@
191203
Text="{x:Bind LaunchTime}"
192204
TextWrapping="Wrap" />
193205
</StackPanel>
194-
<StackPanel x:Name="Stack15"
206+
<StackPanel x:Name="Stack16"
195207
Margin="10"
196208
Orientation="Horizontal">
197209
<TextBlock FontSize="18"
@@ -203,7 +215,7 @@
203215
Text="{x:Bind LastLaunchTime}"
204216
TextWrapping="Wrap" />
205217
</StackPanel>
206-
<StackPanel x:Name="Stack16"
218+
<StackPanel x:Name="Stack17"
207219
Margin="10"
208220
Orientation="Horizontal">
209221
<TextBlock FontSize="18"
@@ -215,7 +227,7 @@
215227
Text="{x:Bind LastResetTime, Mode=OneWay}"
216228
TextWrapping="Wrap" />
217229
</StackPanel>
218-
<StackPanel x:Name="Stack17"
230+
<StackPanel x:Name="Stack18"
219231
Margin="10"
220232
Orientation="Horizontal">
221233
<TextBlock FontSize="18"
@@ -227,7 +239,7 @@
227239
Text="{x:Bind LaunchCount, Mode=OneWay}"
228240
TextWrapping="Wrap" />
229241
</StackPanel>
230-
<StackPanel x:Name="Stack18"
242+
<StackPanel x:Name="Stack19"
231243
Margin="10"
232244
Orientation="Horizontal">
233245
<TextBlock FontSize="18"
@@ -239,7 +251,7 @@
239251
Text="{x:Bind TotalLaunchCount}"
240252
TextWrapping="Wrap" />
241253
</StackPanel>
242-
<StackPanel x:Name="Stack19"
254+
<StackPanel x:Name="Stack20"
243255
Margin="10"
244256
Orientation="Horizontal">
245257
<TextBlock FontSize="18"
@@ -284,6 +296,9 @@
284296
<Setter Target="Stack15.Orientation" Value="Vertical" />
285297
<Setter Target="Stack16.Orientation" Value="Vertical" />
286298
<Setter Target="Stack17.Orientation" Value="Vertical" />
299+
<Setter Target="Stack18.Orientation" Value="Vertical" />
300+
<Setter Target="Stack19.Orientation" Value="Vertical" />
301+
<Setter Target="Stack20.Orientation" Value="Vertical" />
287302
</VisualState.Setters>
288303
</VisualState>
289304
</VisualStateGroup>

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/SystemInformation/SystemInformationPage.xaml.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ public sealed partial class SystemInformationPage : Page
5454
// To get the first version installed
5555
public string FirstVersionInstalled => SystemInformation.Instance.FirstVersionInstalled.ToFormattedString();
5656

57+
// To get the previous version installed
58+
public string PreviousVersionInstalled => SystemInformation.Instance.PreviousVersionInstalled.ToFormattedString();
59+
5760
// To get the first time the app was launched
5861
public string FirstUseTime => SystemInformation.Instance.FirstUseTime.ToString(Culture.DateTimeFormat);
5962

Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/BaseObjectStorageHelper.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
using System;
66
using System.Collections.Generic;
7-
using System.Reflection;
8-
using System.Runtime.Serialization;
97
using System.Threading.Tasks;
108
using Windows.Storage;
119

@@ -77,7 +75,7 @@ public bool KeyExists(string compositeKey, string key)
7775
/// <param name="key">Key of the object</param>
7876
/// <param name="default">Default value of the object</param>
7977
/// <returns>The T object</returns>
80-
public T Read<T>(string key, T @default = default(T))
78+
public T Read<T>(string key, T @default = default)
8179
{
8280
if (!Settings.Values.TryGetValue(key, out var value) || value == null)
8381
{
@@ -95,7 +93,7 @@ public bool KeyExists(string compositeKey, string key)
9593
/// <param name="key">Key of the object</param>
9694
/// <param name="default">Default value of the object</param>
9795
/// <returns>The T object</returns>
98-
public T Read<T>(string compositeKey, string key, T @default = default(T))
96+
public T Read<T>(string compositeKey, string key, T @default = default)
9997
{
10098
ApplicationDataCompositeValue composite = (ApplicationDataCompositeValue)Settings.Values[compositeKey];
10199
if (composite != null)
@@ -120,9 +118,6 @@ public bool KeyExists(string compositeKey, string key)
120118
/// <param name="value">Object to save</param>
121119
public void Save<T>(string key, T value)
122120
{
123-
var type = typeof(T);
124-
var typeInfo = type.GetTypeInfo();
125-
126121
Settings.Values[key] = serializer.Serialize(value);
127122
}
128123

@@ -182,7 +177,7 @@ public Task<bool> FileExistsAsync(string filePath)
182177
/// <param name="filePath">Path to the file that contains the object</param>
183178
/// <param name="default">Default value of the object</param>
184179
/// <returns>Waiting task until completion with the object in the file</returns>
185-
public async Task<T> ReadFileAsync<T>(string filePath, T @default = default(T))
180+
public async Task<T> ReadFileAsync<T>(string filePath, T @default = default)
186181
{
187182
string value = await StorageFileHelper.ReadTextFromFileAsync(Folder, filePath);
188183
return (value != null) ? serializer.Deserialize<T>(value) : @default;

Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/LocalObjectStorageHelper.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using System.Runtime.Serialization;
65
using Windows.Storage;
76

87
namespace Microsoft.Toolkit.Uwp.Helpers

0 commit comments

Comments
 (0)