Skip to content

Commit 54a2cb8

Browse files
initial .NET MAUI client with API v3 #13
1 parent bbb5d5e commit 54a2cb8

34 files changed

Lines changed: 153 additions & 157 deletions

src/CodeBreaker.MAUI.sln

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,20 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.0.31611.283
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeBreaker.ViewModels", "clients\xaml\CodeBreaker.ViewModels\CodeBreaker.ViewModels.csproj", "{E98CF0C8-4276-44AE-9260-FFB037E56BE8}"
7-
EndProject
86
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeBreaker.MAUI", "clients\xaml\CodeBreaker.MAUI\CodeBreaker.MAUI.csproj", "{D05F8B75-7B18-423C-928B-FBB26F9F13A7}"
97
EndProject
10-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeBreaker.Services", "clients\shared\CodeBreaker.Services\CodeBreaker.Services.csproj", "{857FAB8D-348F-4940-8004-36D501D1A661}"
11-
EndProject
12-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeBreaker.Shared", "shared\CodeBreaker.Shared\CodeBreaker.Shared.csproj", "{B7181E9E-A4AA-452F-83C4-92182DFDB579}"
13-
EndProject
14-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeBreaker.ViewModels.Tests", "clients\xaml\CodeBreaker.ViewModels.Tests\CodeBreaker.ViewModels.Tests.csproj", "{9C7EE2F5-DD4E-4853-A9CE-5D8E7F0A8554}"
15-
EndProject
168
Global
179
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1810
Debug|Any CPU = Debug|Any CPU
1911
Release|Any CPU = Release|Any CPU
2012
EndGlobalSection
2113
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22-
{E98CF0C8-4276-44AE-9260-FFB037E56BE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23-
{E98CF0C8-4276-44AE-9260-FFB037E56BE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
24-
{E98CF0C8-4276-44AE-9260-FFB037E56BE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
25-
{E98CF0C8-4276-44AE-9260-FFB037E56BE8}.Release|Any CPU.Build.0 = Release|Any CPU
2614
{D05F8B75-7B18-423C-928B-FBB26F9F13A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2715
{D05F8B75-7B18-423C-928B-FBB26F9F13A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
2816
{D05F8B75-7B18-423C-928B-FBB26F9F13A7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
2917
{D05F8B75-7B18-423C-928B-FBB26F9F13A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
3018
{D05F8B75-7B18-423C-928B-FBB26F9F13A7}.Release|Any CPU.Build.0 = Release|Any CPU
3119
{D05F8B75-7B18-423C-928B-FBB26F9F13A7}.Release|Any CPU.Deploy.0 = Release|Any CPU
32-
{857FAB8D-348F-4940-8004-36D501D1A661}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33-
{857FAB8D-348F-4940-8004-36D501D1A661}.Debug|Any CPU.Build.0 = Debug|Any CPU
34-
{857FAB8D-348F-4940-8004-36D501D1A661}.Release|Any CPU.ActiveCfg = Release|Any CPU
35-
{857FAB8D-348F-4940-8004-36D501D1A661}.Release|Any CPU.Build.0 = Release|Any CPU
36-
{B7181E9E-A4AA-452F-83C4-92182DFDB579}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37-
{B7181E9E-A4AA-452F-83C4-92182DFDB579}.Debug|Any CPU.Build.0 = Debug|Any CPU
38-
{B7181E9E-A4AA-452F-83C4-92182DFDB579}.Release|Any CPU.ActiveCfg = Release|Any CPU
39-
{B7181E9E-A4AA-452F-83C4-92182DFDB579}.Release|Any CPU.Build.0 = Release|Any CPU
40-
{9C7EE2F5-DD4E-4853-A9CE-5D8E7F0A8554}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41-
{9C7EE2F5-DD4E-4853-A9CE-5D8E7F0A8554}.Debug|Any CPU.Build.0 = Debug|Any CPU
42-
{9C7EE2F5-DD4E-4853-A9CE-5D8E7F0A8554}.Release|Any CPU.ActiveCfg = Release|Any CPU
43-
{9C7EE2F5-DD4E-4853-A9CE-5D8E7F0A8554}.Release|Any CPU.Build.0 = Release|Any CPU
4420
EndGlobalSection
4521
GlobalSection(SolutionProperties) = preSolution
4622
HideSolutionNode = FALSE

src/clients/xaml/CodeBreaker.MAUI/App.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version = "1.0" encoding = "UTF-8" ?>
22
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4-
xmlns:local="clr-namespace:CodeBreaker.MAUI"
5-
x:Class="CodeBreaker.MAUI.App"
4+
xmlns:local="clr-namespace:Codebreaker.MAUI"
5+
x:Class="Codebreaker.MAUI.App"
66
UserAppTheme="Dark">
77
<Application.Resources>
88
<ResourceDictionary>

src/clients/xaml/CodeBreaker.MAUI/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace CodeBreaker.MAUI;
1+
namespace Codebreaker.MAUI;
22

33
public partial class App : Application
44
{

src/clients/xaml/CodeBreaker.MAUI/AppShell.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<Shell
3-
x:Class="CodeBreaker.MAUI.AppShell"
3+
x:Class="Codebreaker.MAUI.AppShell"
44
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
55
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6-
xmlns:local="clr-namespace:CodeBreaker.MAUI"
7-
xmlns:pages="clr-namespace:CodeBreaker.MAUI.Views.Pages"
6+
xmlns:local="clr-namespace:Codebreaker.MAUI"
7+
xmlns:pages="clr-namespace:Codebreaker.MAUI.Views.Pages"
88
Shell.FlyoutBehavior="Disabled">
99

1010
<ShellContent

src/clients/xaml/CodeBreaker.MAUI/AppShell.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace CodeBreaker.MAUI;
1+
namespace Codebreaker.MAUI;
22

33
public partial class AppShell : Shell
44
{

src/clients/xaml/CodeBreaker.MAUI/CodeBreaker.MAUI.csproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net7.0-maccatalyst;net7.0-ios;net7.0-android</TargetFrameworks>
4+
<TargetFrameworks>net7.0-ios;net7.0-android</TargetFrameworks>
55
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
6-
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
7-
<!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
86
<OutputType>Exe</OutputType>
9-
<RootNamespace>CodeBreaker.MAUI</RootNamespace>
7+
<RootNamespace>Codebreaker.MAUI</RootNamespace>
108
<UseMaui>true</UseMaui>
119
<SingleProject>true</SingleProject>
1210
<ImplicitUsings>enable</ImplicitUsings>
1311
<Nullable>enable</Nullable>
12+
1413

1514
<!-- Display name -->
1615
<ApplicationTitle>Codebreaker</ApplicationTitle>
@@ -84,7 +83,8 @@
8483
</ItemGroup>
8584

8685
<ItemGroup>
87-
<PackageReference Include="CNInnovation.Codebreaker.ViewModels" Version="2.0.0-beta1.12" />
86+
<!--<PackageReference Include="CNInnovation.Codebreaker.ViewModels" Version="3.5.0-beta.14" />-->
87+
<PackageReference Include="CNInnovation.Codebreaker.ViewModels" Version="3.5.0-beta.16" />
8888
<PackageReference Include="CommunityToolkit.Maui" Version="4.0.0" />
8989
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
9090
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
@@ -100,7 +100,7 @@
100100
</ItemGroup>
101101

102102
<ItemGroup>
103-
<EditorConfigFiles Remove="C:\githublearn\codebreaker\src\xaml\CodeBreaker.MAUI\.editorconfig" />
103+
<EditorConfigFiles Remove="C:\githublearn\codebreaker\src\xaml\Codebreaker.MAUI\.editorconfig" />
104104
</ItemGroup>
105105

106106
<ItemGroup>
@@ -122,7 +122,7 @@
122122
</ItemGroup>
123123

124124
<ItemGroup>
125-
<None Include="C:\githublearn\codebreaker\src\xaml\CodeBreaker.MAUI\.editorconfig" />
125+
<None Include="C:\githublearn\codebreaker\src\xaml\Codebreaker.MAUI\.editorconfig" />
126126
</ItemGroup>
127127

128128
</Project>

src/clients/xaml/CodeBreaker.MAUI/Converters/ColornameToBrushConverter.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System.Globalization;
2-
3-
using static CodeBreaker.Shared.Models.Data.Colors;
4-
5-
namespace CodeBreaker.MAUI.Converters;
1+
namespace Codebreaker.MAUI.Converters;
62

73
public class ColornameToBrushConverter : IValueConverter
84
{
@@ -12,6 +8,8 @@ public class ColornameToBrushConverter : IValueConverter
128
private readonly static Brush s_greenBrush = new SolidColorBrush(Color.FromArgb("#00ad56"));
139
private readonly static Brush s_blueBrush = new SolidColorBrush(Color.FromArgb("#4f6bed"));
1410
private readonly static Brush s_yellowBrush = new SolidColorBrush(Color.FromArgb("#fce100"));
11+
private readonly static Brush s_purple = new SolidColorBrush(Colors.Purple);
12+
private readonly static Brush s_orange = new SolidColorBrush(Colors.Orange);
1513
private readonly static Brush s_emptyBrush = new SolidColorBrush(Color.FromArgb("#a0aeb2"));
1614

1715
public Brush BlackBrush { get; set; } = s_blackBrush;
@@ -20,7 +18,10 @@ public class ColornameToBrushConverter : IValueConverter
2018
public Brush GreenBrush { get; set; } = s_greenBrush;
2119
public Brush BlueBrush { get; set; } = s_blueBrush;
2220
public Brush YellowBrush { get; set; } = s_yellowBrush;
21+
private Brush PurpleBrush { get; set; } = s_purple;
22+
private Brush OrangeBrush { get; set; } = s_orange;
2323
private Brush EmptyBrush { get; set; } = s_emptyBrush;
24+
2425

2526
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
2627
{
@@ -35,12 +36,14 @@ public class ColornameToBrushConverter : IValueConverter
3536

3637
return guessPeg switch
3738
{
38-
Black => BlackBrush,
39-
White => WhiteBrush,
40-
Red => RedBrush,
41-
Green => GreenBrush,
42-
Blue => BlueBrush,
43-
Yellow => YellowBrush,
39+
"Black" => BlackBrush,
40+
"White" => WhiteBrush,
41+
"Red" => RedBrush,
42+
"Green" => GreenBrush,
43+
"Blue" => BlueBrush,
44+
"Yellow" => YellowBrush,
45+
"Purple" => PurpleBrush,
46+
"Orange" => OrangeBrush,
4447
_ => EmptyBrush
4548
};
4649
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace Codebreaker.MAUI.Converters;
2+
public class DictionaryToValuesConverter : IValueConverter
3+
{
4+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
5+
{
6+
if (parameter is not string fieldType)
7+
throw new ArgumentException("The parameter needs to be a string");
8+
9+
if (value is not IDictionary<string, string[]> valuesDictionary)
10+
throw new ArgumentException("The value needs to be a dictionary");
11+
12+
return valuesDictionary[fieldType];
13+
}
14+
15+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
16+
{
17+
throw new NotImplementedException();
18+
}
19+
}

src/clients/xaml/CodeBreaker.MAUI/Converters/GameStatusToIsVisibleConverter.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using CodeBreaker.ViewModels;
2-
3-
using System.Globalization;
4-
5-
namespace CodeBreaker.MAUI.Converters;
1+
namespace Codebreaker.MAUI.Converters;
62

73
public class GameStatusToIsVisibleConverter : IValueConverter
84
{

src/clients/xaml/CodeBreaker.MAUI/Converters/IntToEnumerableConverter.cs

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)