diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml index a696e85..5a9d4ce 100644 --- a/.github/workflows/build-package.yml +++ b/.github/workflows/build-package.yml @@ -2,7 +2,7 @@ name: Build XRSharp.CommunityToolkit env: package-source-myget: 'https://www.myget.org/F/xrsharp/api/v2/package' nuget: 'https://api.nuget.org/v3/index.json' - package-version: '0.1.6' + package-version: '0.1.7' suffix: 'preview' on: push: diff --git a/build/build-nuget-package-XRSharp-CommunityToolkit-cicd.bat b/build/build-nuget-package-XRSharp-CommunityToolkit-cicd.bat index cbd3ebe..dc40cdc 100644 --- a/build/build-nuget-package-XRSharp-CommunityToolkit-cicd.bat +++ b/build/build-nuget-package-XRSharp-CommunityToolkit-cicd.bat @@ -11,11 +11,11 @@ set "currentdatetime=%currentdatetime: =0%" rem If argument 1 is not given, use default value for PackageVersion: set "PackageVersion=%~1" -if not defined PackageVersion set "PackageVersion=0.1.6-private-%currentdatetime%" +if not defined PackageVersion set "PackageVersion=0.1.7-private-%currentdatetime%" rem If argument 2 is not given, use default value for XRSharpVersion: set "XRSharpVersion=%~2" -if not defined XRSharpVersion set "XRSharpVersion=0.1.6-preview-2024-01-11-062323-28482d56" +if not defined XRSharpVersion set "XRSharpVersion=0.1.7-preview-2024-07-03-083945-ec96f694" if not exist "nuspec/XRSharp.CommunityToolkit.nuspec" ( echo Wrong working directory. Please navigate to the folder that contains the BAT file before executing it. diff --git a/build/build-nuget-package-XRSharp-CommunityToolkit-private.bat b/build/build-nuget-package-XRSharp-CommunityToolkit-private.bat index 46e3c9a..8d9d798 100644 --- a/build/build-nuget-package-XRSharp-CommunityToolkit-private.bat +++ b/build/build-nuget-package-XRSharp-CommunityToolkit-private.bat @@ -10,11 +10,11 @@ rem Define the escape character for colored text for /F %%a in ('"prompt $E$S & echo on & for %%b in (1) do rem"') do set "ESC=%%a" rem Define the "%PackageVersion%" variable: -set /p PackageVersion="%ESC%[92mXRSharp.CommunityToolkit version:%ESC%[0m 0.1.6-private-" +set /p PackageVersion="%ESC%[92mXRSharp.CommunityToolkit version:%ESC%[0m 0.1.7-private-" -set PackageVersion="0.1.6-private-%PackageVersion%" +set PackageVersion="0.1.7-private-%PackageVersion%" -set XRSharpVersion="0.1.6-preview-2024-01-11-062323-28482d56" +set XRSharpVersion="0.1.7-preview-2024-07-03-083945-ec96f694" call "build-nuget-package-XRSharp-CommunityToolkit-cicd.bat" %PackageVersion% %XRSharpVersion% diff --git a/src/XRSharp.CommunityToolkit.Networked/XRSharp.CommunityToolkit.Networked.csproj b/src/XRSharp.CommunityToolkit.Networked/XRSharp.CommunityToolkit.Networked.csproj index 860a627..461e2dd 100644 --- a/src/XRSharp.CommunityToolkit.Networked/XRSharp.CommunityToolkit.Networked.csproj +++ b/src/XRSharp.CommunityToolkit.Networked/XRSharp.CommunityToolkit.Networked.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/Pages/Index.cs b/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/Pages/Index.cs index aff0bd9..355c2d1 100644 --- a/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/Pages/Index.cs +++ b/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/Pages/Index.cs @@ -2,9 +2,12 @@ using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Rendering; using Microsoft.JSInterop; +using System; +using System.Threading.Tasks; using XRSharp.CommunityToolkit.Browser.Interop; namespace XRSharp.CommunityToolkit.Browser.Pages; + [Route("/")] public class Index : ComponentBase { @@ -12,9 +15,15 @@ protected override void BuildRenderTree(RenderTreeBuilder __builder) { } - protected override void OnInitialized() + protected async override Task OnInitializedAsync() { - base.OnInitialized(); + await base.OnInitializedAsync(); + + if (!await JSRuntime.InvokeAsync("getOSFilesLoadedPromise")) + { + throw new InvalidOperationException("Failed to initialize OpenSilver. Check your browser's console for error details."); + } + Cshtml5Initializer.Initialize(new UnmarshalledJavaScriptExecutionHandler(JSRuntime)); Program.RunApplication(); } diff --git a/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/XRSharp.CommunityToolkit.Browser.csproj b/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/XRSharp.CommunityToolkit.Browser.csproj index c5ab256..2f65213 100644 --- a/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/XRSharp.CommunityToolkit.Browser.csproj +++ b/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/XRSharp.CommunityToolkit.Browser.csproj @@ -3,7 +3,7 @@ net8.0 True - 5 + 6 true true True @@ -12,9 +12,9 @@ - - - + + + diff --git a/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/wwwroot/BlazorLoader.js b/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/wwwroot/BlazorLoader.js deleted file mode 100644 index 34b8ca3..0000000 --- a/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/wwwroot/BlazorLoader.js +++ /dev/null @@ -1,25 +0,0 @@ -var i = 0; -var allResourcesBeingLoaded = []; -Blazor.start({ // start manually with loadBootResource - loadBootResource: function (type, name, defaultUri, integrity) { - if (type == "dotnetjs") - return defaultUri; - - var fetchResources = fetch(defaultUri, { - cache: 'no-cache', - integrity: integrity, - headers: { 'MyCustomHeader': 'My custom value' } - }); - - - allResourcesBeingLoaded.push(fetchResources); - fetchResources.then((r) => { - i++; - var total = allResourcesBeingLoaded.length; - if (typeof onResourceLoaded === "function") { - onResourceLoaded(i, total); - } - }); - return fetchResources; - } -}); \ No newline at end of file diff --git a/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/wwwroot/index.html b/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/wwwroot/index.html index 043029e..8ca5520 100644 --- a/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/wwwroot/index.html +++ b/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/wwwroot/index.html @@ -5,18 +5,46 @@ XR# Community Toolkit + -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- - - - - - - - + \ No newline at end of file diff --git a/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/wwwroot/loading-indicator.css b/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/wwwroot/loading-indicator.css index 47a1f80..f85de09 100644 --- a/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/wwwroot/loading-indicator.css +++ b/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/wwwroot/loading-indicator.css @@ -24,9 +24,8 @@ display: flex; justify-content: center; align-items: center; - position: relative; - width: 100%; - height: 100%; + width: 100vw; + height: 100vh; } .loading-indicator { @@ -145,10 +144,14 @@ animation-delay: 5.9s; } -.loading-indicator-percentage-container { +.loading-indicator-text { display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; } + + .loading-indicator-text:after { + content: var(--blazor-load-percentage-text, "Loading..."); + } \ No newline at end of file diff --git a/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/wwwroot/loading-indicator.js b/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/wwwroot/loading-indicator.js deleted file mode 100644 index 4471b52..0000000 --- a/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.Browser/wwwroot/loading-indicator.js +++ /dev/null @@ -1,28 +0,0 @@ -function onResourceLoaded(resourceIndex, totalResourceCount) { - let percentage = document.getElementById("loading-indicator-percentage"); - if (percentage) { - percentage.innerHTML = Math.round((resourceIndex / totalResourceCount) * 100) + "%"; - } -} - -let loadingIndicatorWrapper = document.createElement("div"); -loadingIndicatorWrapper.classList.add("loading-indicator-wrapper"); -document.getElementById("app").appendChild(loadingIndicatorWrapper); - -let loadingIndicator = document.createElement("div"); -loadingIndicator.classList.add("loading-indicator"); -loadingIndicatorWrapper.appendChild(loadingIndicator); - -for (let i = 0; i < 16; i++) { - let loadingIndicatorBall = document.createElement("div"); - loadingIndicatorBall.classList.add("loading-indicator-ball"); - loadingIndicator.appendChild(loadingIndicatorBall); -} - -let loadingIndicatorPercentageContainer = document.createElement("div"); -loadingIndicatorPercentageContainer.classList.add("loading-indicator-percentage-container"); -loadingIndicator.appendChild(loadingIndicatorPercentageContainer); - -let loadingIndicatorPercentage = document.createElement("div"); -loadingIndicatorPercentage.id = "loading-indicator-percentage"; -loadingIndicatorPercentageContainer.appendChild(loadingIndicatorPercentage); \ No newline at end of file diff --git a/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.csproj b/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.csproj index 119f64a..8af6ca4 100644 --- a/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.csproj +++ b/src/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit/XRSharp.CommunityToolkit.csproj @@ -7,7 +7,7 @@ - +