Skip to content

Commit c5644bd

Browse files
committed
Samples updated for .NET MAUI 9 Stable channel release.
1 parent 8ffcb5e commit c5644bd

24 files changed

+191
-14
lines changed

global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"sdk": {
33
"allowPrerelease": true,
44
"rollForward": "latestMinor",
5-
"version": "8.0.100"
5+
"version": "9.0.100"
66
}
77
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
4+
<MauiVersion>9.*</MauiVersion>
5+
</PropertyGroup>
6+
</Project>

src/NET_9/EmbeddedAndroid/EmbeddedAndroid.sln

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ VisualStudioVersion = 17.0.31903.59
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmbeddedAndroid", "EmbeddedAndroid.csproj", "{6080BD5C-A536-4175-A64D-78FFC4642A41}"
77
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
9+
ProjectSection(SolutionItems) = preProject
10+
Directory.Packages.props = Directory.Packages.props
11+
EndProjectSection
12+
EndProject
813
Global
914
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1015
Debug|Any CPU = Debug|Any CPU

src/NET_9/EmbeddedAndroid/EmbeddedAndroid.slnx

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<Solution>
2+
<Folder Name="/Solution Items/">
3+
<File Path="Directory.Packages.props" />
4+
</Folder>
25
<Project Path="EmbeddedAndroid.csproj">
36
<Deploy />
47
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
4+
<MauiVersion>9.*</MauiVersion>
5+
</PropertyGroup>
6+
</Project>

src/NET_9/EmbeddedWindows/EmbeddedWindows.sln

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmbeddedWindows", "Embedded
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MauiLib", "MauiLib\MauiLib.csproj", "{E93EB175-0FD3-4BFD-B81A-CDAF33998932}"
99
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
11+
ProjectSection(SolutionItems) = preProject
12+
Directory.Packages.props = Directory.Packages.props
13+
EndProjectSection
14+
EndProject
1015
Global
1116
GlobalSection(SolutionProperties) = preSolution
1217
HideSolutionNode = FALSE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Solution>
2+
<Folder Name="/Solution Items/">
3+
<File Path="Directory.Packages.props" />
4+
</Folder>
5+
<Project Path="MauiLib\MauiLib.csproj" />
6+
<Project Path="EmbeddedWindows\EmbeddedWindows.csproj">
7+
<Deploy />
8+
<Platform Project="x64" />
9+
</Project>
10+
</Solution>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
4+
<MauiVersion>9.*</MauiVersion>
5+
</PropertyGroup>
6+
</Project>

src/NET_9/EmbeddediOS/EmbeddediOS.sln

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ VisualStudioVersion = 17.0.31903.59
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmbeddediOS", "EmbeddediOS.csproj", "{DEB5C69A-CC84-491E-9E3D-72E222628EB2}"
77
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
9+
ProjectSection(SolutionItems) = preProject
10+
Directory.Packages.props = Directory.Packages.props
11+
EndProjectSection
12+
EndProject
813
Global
914
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1015
Debug|Any CPU = Debug|Any CPU

src/NET_9/EmbeddediOS/EmbeddediOS.slnx

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<Solution>
2+
<Folder Name="/Solution Items/">
3+
<File Path="Directory.Packages.props" />
4+
</Folder>
25
<Project Path="EmbeddediOS.csproj">
36
<Deploy />
47
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
4+
<MauiVersion>9.*</MauiVersion>
5+
</PropertyGroup>
6+
</Project>

src/NET_9/HybridWebViewApp/HybridWebViewApp.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
</ItemGroup>
6161

6262
<ItemGroup>
63-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.*-*" Condition="'$(Configuration)' == 'Debug'" />
63+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.*" Condition="'$(Configuration)' == 'Debug'" />
6464
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
6565
</ItemGroup>
6666

src/NET_9/HybridWebViewApp/HybridWebViewApp.sln

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ VisualStudioVersion = 17.0.31611.283
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{371A51A3-7E6B-415E-A4CD-ADAC03BCC115}") = "HybridWebViewApp", "HybridWebViewApp.csproj", "{A46627CB-85E6-4A7B-BAA0-A785D0B73BC1}"
77
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
9+
ProjectSection(SolutionItems) = preProject
10+
Directory.Packages.props = Directory.Packages.props
11+
EndProjectSection
12+
EndProject
813
Global
914
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1015
Debug|Any CPU = Debug|Any CPU

src/NET_9/HybridWebViewApp/HybridWebViewApp.slnx

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<Solution>
2+
<Folder Name="/Solution Items/">
3+
<File Path="Directory.Packages.props" />
4+
</Folder>
25
<Project Path="HybridWebViewApp.csproj">
36
<Deploy />
47
</Project>

src/NET_9/HybridWebViewApp/Resources/Raw/wwwroot/scripts/hwv.js

+49-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
window.HybridWebView = {
2-
"Init": function () {
2+
"Init": function Init() {
33
function DispatchHybridWebViewMessage(message) {
44
const event = new CustomEvent("HybridWebViewMessageReceived", { detail: { message: message } });
55
window.dispatchEvent(event);
@@ -27,11 +27,53 @@
2727
}
2828
},
2929

30-
"SendRawMessage": function (message) {
31-
window.HybridWebView.__SendMessageInternal('RawMessage', message);
30+
"SendRawMessage": function SendRawMessage(message) {
31+
window.HybridWebView.__SendMessageInternal('__RawMessage', message);
3232
},
3333

34-
"__SendMessageInternal": function (type, message) {
34+
"InvokeDotNet": async function InvokeDotNetAsync(methodName, paramValues) {
35+
const body = {
36+
MethodName: methodName
37+
};
38+
39+
if (typeof paramValues !== 'undefined') {
40+
if (!Array.isArray(paramValues)) {
41+
paramValues = [paramValues];
42+
}
43+
44+
for (var i = 0; i < paramValues.length; i++) {
45+
paramValues[i] = JSON.stringify(paramValues[i]);
46+
}
47+
48+
if (paramValues.length > 0) {
49+
body.ParamValues = paramValues;
50+
}
51+
}
52+
53+
const message = JSON.stringify(body);
54+
55+
var requestUrl = `${window.location.origin}/__hwvInvokeDotNet?data=${encodeURIComponent(message)}`;
56+
57+
const rawResponse = await fetch(requestUrl, {
58+
method: 'GET',
59+
headers: {
60+
'Accept': 'application/json'
61+
}
62+
});
63+
const response = await rawResponse.json();
64+
65+
if (response) {
66+
if (response.IsJson) {
67+
return JSON.parse(response.Result);
68+
}
69+
70+
return response.Result;
71+
}
72+
73+
return null;
74+
},
75+
76+
"__SendMessageInternal": function __SendMessageInternal(type, message) {
3577

3678
const messageToSend = type + '|' + message;
3779

@@ -49,7 +91,7 @@
4991
}
5092
},
5193

52-
"InvokeMethod": function (taskId, methodName, args) {
94+
"__InvokeJavaScript": function __InvokeJavaScript(taskId, methodName, args) {
5395
if (methodName[Symbol.toStringTag] === 'AsyncFunction') {
5496
// For async methods, we need to call the method and then trigger the callback when it's done
5597
const asyncPromise = methodName(...args);
@@ -65,13 +107,13 @@
65107
}
66108
},
67109

68-
"__TriggerAsyncCallback": function (taskId, result) {
110+
"__TriggerAsyncCallback": function __TriggerAsyncCallback(taskId, result) {
69111
// Make sure the result is a string
70112
if (result && typeof (result) !== 'string') {
71113
result = JSON.stringify(result);
72114
}
73115

74-
window.HybridWebView.__SendMessageInternal('InvokeMethodCompleted', taskId + '|' + result);
116+
window.HybridWebView.__SendMessageInternal('__InvokeJavaScriptCompleted', taskId + '|' + result);
75117
}
76118
}
77119

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
4+
<MauiVersion>9.*</MauiVersion>
5+
</PropertyGroup>
6+
</Project>

src/NET_9/MapsApp/MapsApp.sln

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ VisualStudioVersion = 17.5.33103.201
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{CC39106E-4594-4901-AEFB-51DE890E7E34}") = "MapsApp", "MapsApp.csproj", "{89D6D593-C99A-4072-8777-D8A241E1BFDD}"
77
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
9+
ProjectSection(SolutionItems) = preProject
10+
Directory.Packages.props = Directory.Packages.props
11+
EndProjectSection
12+
EndProject
813
Global
914
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1015
Debug|arm64 = Debug|arm64

src/NET_9/MapsApp/MapsApp.slnx

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Solution>
2+
<Folder Name="/Solution Items/">
3+
<File Path="Directory.Packages.props" />
4+
</Folder>
5+
<Project Path="MapsApp.csproj">
6+
<Deploy />
7+
<Platform Project="x64" />
8+
</Project>
9+
<Properties Name="Visual Studio">
10+
<!-- Support is provisionally available on Visual Studio 17.10 and later versions. -->
11+
<Property Name="OpenWith" Value="17" />
12+
</Properties>
13+
</Solution>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
4+
<MauiVersion>9.*</MauiVersion>
5+
</PropertyGroup>
6+
</Project>

src/NET_9/WinUIBlazor/WinUIBlazor.MauiLib/WinUIBlazor.MauiLib.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
<ItemGroup>
1818
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="$(MauiVersion)" />
19-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.*-*" Condition="'$(Configuration)' == 'Debug'" />
19+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.*" Condition="'$(Configuration)' == 'Debug'" />
2020
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
21-
<PackageReference Include="VijayAnand.MauiBlazor.Markup" Version="4.*-preview*" />
21+
<PackageReference Include="VijayAnand.MauiBlazor.Markup" Version="4.*" />
2222
</ItemGroup>
2323

2424
<ItemGroup>

src/NET_9/WinUIBlazor/WinUIBlazor.RazorLib/WinUIBlazor.RazorLib.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.*-*" />
18+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.*" />
1919
</ItemGroup>
2020
</Project>

src/NET_9/WinUIBlazor/WinUIBlazor.sln

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31903.59
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinUIBlazor", "WinUIBlazor\WinUIBlazor.csproj", "{B4FE125E-4AFF-44EB-A3B7-DC1793D7CBA6}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinUIBlazor.MauiLib", "WinUIBlazor.MauiLib\WinUIBlazor.MauiLib.csproj", "{71F838CD-A4C9-48E4-ABA9-716FB160CBEB}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinUIBlazor.RazorLib", "WinUIBlazor.RazorLib\WinUIBlazor.RazorLib.csproj", "{F427596A-19AA-4AC4-9F24-BCCF206EBBF0}"
11+
EndProject
12+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
13+
ProjectSection(SolutionItems) = preProject
14+
Directory.Packages.props = Directory.Packages.props
15+
EndProjectSection
16+
EndProject
17+
Global
18+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
19+
Debug|Any CPU = Debug|Any CPU
20+
Release|Any CPU = Release|Any CPU
21+
EndGlobalSection
22+
GlobalSection(SolutionProperties) = preSolution
23+
HideSolutionNode = FALSE
24+
EndGlobalSection
25+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
26+
{F427596A-19AA-4AC4-9F24-BCCF206EBBF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{F427596A-19AA-4AC4-9F24-BCCF206EBBF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{F427596A-19AA-4AC4-9F24-BCCF206EBBF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{F427596A-19AA-4AC4-9F24-BCCF206EBBF0}.Release|Any CPU.Build.0 = Release|Any CPU
30+
{71F838CD-A4C9-48E4-ABA9-716FB160CBEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31+
{71F838CD-A4C9-48E4-ABA9-716FB160CBEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
32+
{71F838CD-A4C9-48E4-ABA9-716FB160CBEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
33+
{71F838CD-A4C9-48E4-ABA9-716FB160CBEB}.Release|Any CPU.Build.0 = Release|Any CPU
34+
{B4FE125E-4AFF-44EB-A3B7-DC1793D7CBA6}.Debug|Any CPU.ActiveCfg = Debug|x86
35+
{B4FE125E-4AFF-44EB-A3B7-DC1793D7CBA6}.Debug|Any CPU.Build.0 = Debug|x86
36+
{B4FE125E-4AFF-44EB-A3B7-DC1793D7CBA6}.Release|Any CPU.ActiveCfg = Release|x86
37+
{B4FE125E-4AFF-44EB-A3B7-DC1793D7CBA6}.Release|Any CPU.Build.0 = Release|x86
38+
EndGlobalSection
39+
EndGlobal

src/NET_9/WinUIBlazor/WinUIBlazor.slnx

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<Solution>
2+
<Folder Name="/Solution Items/">
3+
<File Path="Directory.Packages.props" />
4+
</Folder>
25
<Project Path="WinUIBlazor\WinUIBlazor.csproj">
36
<Deploy />
47
<Platform Project="x64" />
@@ -9,4 +12,4 @@
912
<!-- Support is provisionally available on Visual Studio 17.10 and later versions. -->
1013
<Property Name="OpenWith" Value="Visual Studio Version 17" />
1114
</Properties>
12-
</Solution>
15+
</Solution>

src/NET_9/global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"sdk": {
33
"allowPrerelease": true,
44
"rollForward": "latestMinor",
5-
"version": "9.0.100-preview.1.24101.2"
5+
"version": "9.0.100"
66
}
77
}

0 commit comments

Comments
 (0)