Skip to content

Commit 5955606

Browse files
Merge pull request #431 from CNinnovation/428-accountpage-userinformation
Added user-information to the account-page
2 parents ea04a88 + 689f225 commit 5955606

3 files changed

Lines changed: 31 additions & 7 deletions

File tree

src/clients/xaml/CodeBreaker.WinUI/CodeBreaker.WinUI.csproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,14 @@
6363
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
6464
</ItemGroup>
6565
<ItemGroup>
66-
<PackageReference Include="CNInnovation.Codebreaker.ViewModels" Version="2.0.0-beta1.12" />
66+
<!--<PackageReference Include="CNInnovation.Codebreaker.ViewModels" Version="2.0.0-beta1.12" />-->
67+
<PackageReference Include="CNInnovation.Codebreaker.ViewModels" Version="2.0.1-beta.1.21" />
6768
<PackageReference Include="CommunityToolkit.WinUI.UI" Version="7.1.2" />
6869
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
69-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
70+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
7071
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
71-
<PackageReference Include="Microsoft.Identity.Client" Version="4.49.1" />
72-
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.2.230118.102" />
72+
<PackageReference Include="Microsoft.Identity.Client" Version="4.50.0" />
73+
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.2.230217.4" />
7374
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
7475
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
7576
<PackageReference Include="WinUIEx" Version="2.1.0" />
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System.Collections;
2+
using Microsoft.UI.Xaml.Data;
3+
4+
namespace CodeBreaker.WinUI.Converters;
5+
6+
internal class FirstOrDefaultConverter : IValueConverter
7+
{
8+
public object? Convert(object? value, Type targetType, object parameter, string language)
9+
{
10+
if (value is not IEnumerable enumerable)
11+
throw new ArgumentException("The value has to be an enumerable");
12+
13+
foreach (var item in enumerable)
14+
return item;
15+
16+
return null;
17+
}
18+
19+
public object ConvertBack(object value, Type targetType, object parameter, string language) =>
20+
throw new NotImplementedException();
21+
}

src/clients/xaml/CodeBreaker.WinUI/Views/Pages/AccountPage.xaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
xmlns:toolkitControls="using:CommunityToolkit.WinUI.UI.Controls"
99
xmlns:cme="using:CodeBreaker.WinUI.CustomMarkupExtensions"
1010
xmlns:ca="using:CodeBreaker.WinUI.CustomAttachedProperties"
11+
xmlns:c="using:CodeBreaker.WinUI.Converters"
1112
mc:Ignorable="d">
1213
<Page.Resources>
14+
<c:FirstOrDefaultConverter x:Key="FirstOrDefaultConverter" />
1315
<Style TargetType="toolkitControls:HeaderedContentControl">
1416
<Setter Property="Margin" Value="0,0,0,25" />
1517
<Setter Property="HeaderTemplate">
@@ -24,9 +26,9 @@
2426

2527
<Grid>
2628
<StackPanel>
27-
<toolkitControls:HeaderedContentControl Header="{cme:ResourceString Name=AccountPage_NameHeader}" Content="Sebastian Szvetecz" />
28-
<toolkitControls:HeaderedContentControl Header="{cme:ResourceString Name=AccountPage_MailHeader}" Content="sebastian@szvetecz.at" />
29-
<toolkitControls:HeaderedContentControl Header="{cme:ResourceString Name=AccountPage_GamerNameHeader}" Content="szv_gamer" />
29+
<toolkitControls:HeaderedContentControl Header="{cme:ResourceString Name=AccountPage_NameHeader}" Content="{x:Bind ViewModel.UserInformation.FullName}" />
30+
<toolkitControls:HeaderedContentControl Header="{cme:ResourceString Name=AccountPage_MailHeader}" Content="{x:Bind ViewModel.UserInformation.EmailAddresses, Converter={StaticResource FirstOrDefaultConverter}}" />
31+
<toolkitControls:HeaderedContentControl Header="{cme:ResourceString Name=AccountPage_GamerNameHeader}" Content="{x:Bind ViewModel.UserInformation.GamerName}" />
3032
<Button
3133
Style="{StaticResource AccentButtonStyle}"
3234
ca:Confirm.Enabled="True"

0 commit comments

Comments
 (0)