diff --git a/README.md b/README.md index 4752018..b4bb999 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ For more information about the command line switches you can run this command to If you need help for another OpenSilver template, let's say the Class Library template, just change the name of the template as follows: - dotnet new opensilvercl -h + dotnet new opensilverlib -h If you still encounter any issues, please contact: - the OpenSilver team at: https://opensilver.net/contact.aspx diff --git a/src/OpenSilver.CLI/C#/OpenSilverApplication/.template.config/template.json b/src/OpenSilver.CLI/C#/OpenSilverApplication/.template.config/template.json index 3b85877..7de540f 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverApplication/.template.config/template.json +++ b/src/OpenSilver.CLI/C#/OpenSilverApplication/.template.config/template.json @@ -53,9 +53,9 @@ "targetFramework": { "type": "parameter", "datatype": "string", - "description": "Sets the target .NET framework, must be net7.0 or net8.0", - "defaultValue": "net8.0", - "replaces": "net8.0", + "description": "Sets the target .NET framework, must be net7.0, net8.0 or net9.0", + "defaultValue": "net9.0", + "replaces": "net9.0", "choices": [ { "choice": "net7.0", @@ -64,30 +64,70 @@ { "choice": "net8.0", "description": "Use .NET 8.0" + }, + { + "choice": "net9.0", + "description": "Use .NET 9.0" + } + ] + }, + "theme": { + "type": "parameter", + "datatype": "string", + "description": "Specifies the theme for the generated OpenSilver application.", + "defaultValue": "classic", + "choices": [ + { + "choice": "classic", + "description": "Classic theme" + }, + { + "choice": "modern-light", + "description": "Modern theme with light mode" + }, + { + "choice": "modern-dark", + "description": "Modern theme with dark mode" } ] }, "openSilverPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverPackageVersion", + "replaces": "$OpenSilverPackageVersion$", "parameters": { - "value": "3.0.1" + "value": "3.1.0" } }, "openSilverSimulatorPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverSimulatorPackageVersion", + "replaces": "$OpenSilverSimulatorPackageVersion$", "parameters": { - "value": "3.0.0" + "value": "3.1.0" + } + }, + "openSilverWebAssemblyPackageVersion": { + "type": "generated", + "generator": "constant", + "replaces": "$OpenSilverWebAssemblyPackageVersion$", + "parameters": { + "value": "3.1.0" + } + }, + "modernThemePackageVersion": { + "type": "generated", + "generator": "constant", + "replaces": "$ModernThemePackageVersion$", + "parameters": { + "value": "3.1.*" } }, "webAssemblyPackageVersion": { "type": "generated", "generator": "switch", "datatype": "string", - "replaces": "WebAssemblyPackageVersion", + "replaces": "$WebAssemblyPackageVersion$", "parameters": { "evaluator": "C++", "cases": [ @@ -97,7 +137,49 @@ }, { "condition": "(targetFramework == 'net8.0')", - "value": "8.0.0" + "value": "8.0.11" + }, + { + "condition": "(targetFramework == 'net9.0')", + "value": "9.0.0" + } + ] + } + }, + "pageForeground": { + "type": "generated", + "generator": "switch", + "datatype": "string", + "replaces": "$PageForeground$", + "parameters": { + "evaluator": "C++", + "cases": [ + { + "condition": "(theme == 'classic')", + "value": "Black" + }, + { + "condition": "(theme != 'classic')", + "value": "{DynamicResource Theme_TextBrush}" + } + ] + } + }, + "gridBackground": { + "type": "generated", + "generator": "switch", + "datatype": "string", + "replaces": "$GridBackground$", + "parameters": { + "evaluator": "C++", + "cases": [ + { + "condition": "(theme == 'classic')", + "value": "White" + }, + { + "condition": "(theme != 'classic')", + "value": "{DynamicResource Theme_BackgroundBrush}" } ] } diff --git a/src/OpenSilver.CLI/C#/OpenSilverApplication/.vscode/launch.json b/src/OpenSilver.CLI/C#/OpenSilverApplication/.vscode/launch.json deleted file mode 100644 index 518e450..0000000 --- a/src/OpenSilver.CLI/C#/OpenSilverApplication/.vscode/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Launch OpenSilver App", - "type": "blazorwasm", - "request": "launch", - "timeout": 60000, - "url": "http://localhost:55592", - "cwd": "${workspaceFolder}/OpenSilverApplication.Browser" - } - ] -} \ No newline at end of file diff --git a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs deleted file mode 100644 index 9aa1185..0000000 --- a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs +++ /dev/null @@ -1,42 +0,0 @@ -using DotNetForHtml5; -using Microsoft.JSInterop; -using Microsoft.JSInterop.WebAssembly; - -namespace OpenSilverApplication.Browser.Interop -{ - public class UnmarshalledJavaScriptExecutionHandler : IWebAssemblyExecutionHandler - { - private const string MethodName = "callJSUnmarshalled_v2"; - private readonly WebAssemblyJSRuntime _runtime; - - public UnmarshalledJavaScriptExecutionHandler(IJSRuntime runtime) - { - _runtime = runtime as WebAssemblyJSRuntime; - } - - public void ExecuteJavaScript(string javaScriptToExecute) - { - _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public object ExecuteJavaScriptWithResult(string javaScriptToExecute) - { - return _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0) - { - return _runtime.InvokeUnmarshalled(identifier, arg0); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1, T2 arg2) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1, arg2); - } - } -} \ No newline at end of file diff --git a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj index 95d6566..4aa7954 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj +++ b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj @@ -1,9 +1,8 @@  - net8.0 - True - 6 + net9.0 + 7 true false @@ -11,9 +10,9 @@ - - - + + + diff --git a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Pages/Index.cs b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Pages/Index.cs index 18a8b70..b9ba02e 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Pages/Index.cs +++ b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Pages/Index.cs @@ -1,10 +1,7 @@ -using DotNetForHtml5; -using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.JSInterop; -using OpenSilverApplication.Browser.Interop; -using System; using System.Threading.Tasks; +using OpenSilver.WebAssembly; namespace OpenSilverApplication.Browser.Pages { @@ -18,17 +15,7 @@ protected override void BuildRenderTree(RenderTreeBuilder __builder) protected async override Task OnInitializedAsync() { 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(); + await Runner.RunApplicationAsync(); } - - [Inject] - private IJSRuntime JSRuntime { get; set; } } } \ No newline at end of file diff --git a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Program.cs b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Program.cs index 6bdf067..a654b19 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Program.cs +++ b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Program.cs @@ -1,9 +1,5 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Net.Http; using System.Threading.Tasks; -using System.Windows; namespace OpenSilverApplication.Browser { @@ -13,19 +9,8 @@ public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); - - builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - var host = builder.Build(); await host.RunAsync(); } - - public static void RunApplication() - { - Application.RunApplication(() => - { - var app = new OpenSilverApplication.App(); - }); - } } } diff --git a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Properties/launchSettings.json b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Properties/launchSettings.json index 6a2b151..e79929a 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Properties/launchSettings.json +++ b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Browser/Properties/launchSettings.json @@ -8,22 +8,23 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "OpenSilverApplication.Browser": { + "commandName": "Project", + "dotnetRunMessages": true, "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "http://localhost:55592/" }, - "OpenSilverApplication.Browser": { - "commandName": "Project", + "IIS Express": { + "commandName": "IISExpress", "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:55592/" + } } } } \ No newline at end of file diff --git a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Simulator/OpenSilverApplication.Simulator.csproj b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Simulator/OpenSilverApplication.Simulator.csproj index 37b9afd..826f049 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Simulator/OpenSilverApplication.Simulator.csproj +++ b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication.Simulator/OpenSilverApplication.Simulator.csproj @@ -2,11 +2,11 @@ WinExe - net472 + net9.0-windows - + diff --git a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/App.xaml b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/App.xaml index e3f05b8..65dccdc 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/App.xaml +++ b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/App.xaml @@ -8,4 +8,14 @@ + + + + + + + + + + diff --git a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/MainPage.xaml b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/MainPage.xaml index 7222d8b..c85f37e 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/MainPage.xaml +++ b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/MainPage.xaml @@ -4,9 +4,10 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:OpenSilverApplication" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d"> + mc:Ignorable="d" + Foreground="$PageForeground$"> - + diff --git a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/OpenSilverApplication.csproj b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/OpenSilverApplication.csproj index 9c6177b..a9dac6f 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/OpenSilverApplication.csproj +++ b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/OpenSilverApplication.csproj @@ -7,7 +7,10 @@ - + + + + diff --git a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/Properties/launchSettings.json b/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/Properties/launchSettings.json deleted file mode 100644 index 2199f6e..0000000 --- a/src/OpenSilver.CLI/C#/OpenSilverApplication/OpenSilverApplication/Properties/launchSettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "profiles": { - "OpenSilverApplication": { - "commandName": "Executable", - "executablePath": "cmd", - "commandLineArgs": "/c start \"\" \"http://www.opensilver.net/permalinks/wrong_startup_project.aspx\"" - } - } -} \ No newline at end of file diff --git a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/.template.config/template.json b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/.template.config/template.json index f677723..a3aa5b0 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/.template.config/template.json +++ b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/.template.config/template.json @@ -39,9 +39,9 @@ "targetFramework": { "type": "parameter", "datatype": "string", - "description": "Sets the target .NET framework, must be net7.0 or net8.0", - "defaultValue": "net8.0", - "replaces": "net8.0", + "description": "Sets the target .NET framework, must be net7.0, net8.0 or net9.0", + "defaultValue": "net9.0", + "replaces": "net9.0", "choices": [ { "choice": "net7.0", @@ -50,38 +50,50 @@ { "choice": "net8.0", "description": "Use .NET 8.0" + }, + { + "choice": "net9.0", + "description": "Use .NET 9.0" } ] }, "openSilverPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverPackageVersion", + "replaces": "$OpenSilverPackageVersion$", "parameters": { - "value": "3.0.1" + "value": "3.1.0" } }, "openSilverSimulatorPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverSimulatorPackageVersion", + "replaces": "$OpenSilverSimulatorPackageVersion$", "parameters": { - "value": "3.0.0" + "value": "3.1.0" + } + }, + "openSilverWebAssemblyPackageVersion": { + "type": "generated", + "generator": "constant", + "replaces": "$OpenSilverWebAssemblyPackageVersion$", + "parameters": { + "value": "3.1.0" } }, "openSilverOpenRiaPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverOpenRiaPackageVersion", + "replaces": "$OpenSilverOpenRiaPackageVersion$", "parameters": { - "value": "3.0.0" + "value": "3.1.0" } }, "webAssemblyPackageVersion": { "type": "generated", "generator": "switch", "datatype": "string", - "replaces": "WebAssemblyPackageVersion", + "replaces": "$WebAssemblyPackageVersion$", "parameters": { "evaluator": "C++", "cases": [ @@ -91,7 +103,11 @@ }, { "condition": "(targetFramework == 'net8.0')", - "value": "8.0.0" + "value": "8.0.11" + }, + { + "condition": "(targetFramework == 'net9.0')", + "value": "9.0.0" } ] } diff --git a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/.vscode/launch.json b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/.vscode/launch.json deleted file mode 100644 index 77569e8..0000000 --- a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/.vscode/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Launch OpenSilver App", - "type": "blazorwasm", - "request": "launch", - "timeout": 60000, - "url": "http://localhost:55592", - "cwd": "${workspaceFolder}/OpenSilverBusinessApplication.Browser" - } - ] -} \ No newline at end of file diff --git a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs deleted file mode 100644 index 38c6b1f..0000000 --- a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs +++ /dev/null @@ -1,42 +0,0 @@ -using DotNetForHtml5; -using Microsoft.JSInterop; -using Microsoft.JSInterop.WebAssembly; - -namespace OpenSilverBusinessApplication.Browser.Interop -{ - public class UnmarshalledJavaScriptExecutionHandler : IWebAssemblyExecutionHandler - { - private const string MethodName = "callJSUnmarshalled_v2"; - private readonly WebAssemblyJSRuntime _runtime; - - public UnmarshalledJavaScriptExecutionHandler(IJSRuntime runtime) - { - _runtime = runtime as WebAssemblyJSRuntime; - } - - public void ExecuteJavaScript(string javaScriptToExecute) - { - _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public object ExecuteJavaScriptWithResult(string javaScriptToExecute) - { - return _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0) - { - return _runtime.InvokeUnmarshalled(identifier, arg0); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1, T2 arg2) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1, arg2); - } - } -} \ No newline at end of file diff --git a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj index edb8756..d6890b8 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj +++ b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj @@ -1,9 +1,8 @@  - net8.0 - True - 6 + net9.0 + 7 true false @@ -11,9 +10,9 @@ - - - + + + diff --git a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Pages/Index.cs b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Pages/Index.cs index 106a7a9..3497ecf 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Pages/Index.cs +++ b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Pages/Index.cs @@ -1,10 +1,7 @@ -using DotNetForHtml5; -using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.JSInterop; -using OpenSilverBusinessApplication.Browser.Interop; -using System; using System.Threading.Tasks; +using OpenSilver.WebAssembly; namespace OpenSilverBusinessApplication.Browser.Pages { @@ -18,17 +15,7 @@ protected override void BuildRenderTree(RenderTreeBuilder __builder) protected async override Task OnInitializedAsync() { 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(); + await Runner.RunApplicationAsync(); } - - [Inject] - private IJSRuntime JSRuntime { get; set; } } } \ No newline at end of file diff --git a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Program.cs b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Program.cs index d63b199..a775186 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Program.cs +++ b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Program.cs @@ -1,9 +1,5 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Net.Http; using System.Threading.Tasks; -using System.Windows; namespace OpenSilverBusinessApplication.Browser { @@ -13,19 +9,8 @@ public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); - - builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - var host = builder.Build(); await host.RunAsync(); } - - public static void RunApplication() - { - Application.RunApplication(() => - { - var app = new OpenSilverBusinessApplication.App(); - }); - } } } diff --git a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json index 529c28c..85d4ab5 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json +++ b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json @@ -8,22 +8,23 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "OpenSilverBusinessApplication.Browser": { + "commandName": "Project", + "dotnetRunMessages": true, "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "http://localhost:55592/" }, - "OpenSilverBusinessApplication.Browser": { - "commandName": "Project", + "IIS Express": { + "commandName": "IISExpress", "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:55592/" + } } } } \ No newline at end of file diff --git a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Simulator/OpenSilverBusinessApplication.Simulator.csproj b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Simulator/OpenSilverBusinessApplication.Simulator.csproj index eab69bb..088cfb7 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Simulator/OpenSilverBusinessApplication.Simulator.csproj +++ b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Simulator/OpenSilverBusinessApplication.Simulator.csproj @@ -2,11 +2,11 @@ WinExe - net472 + net9.0-windows - + diff --git a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication/OpenSilverBusinessApplication.csproj b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication/OpenSilverBusinessApplication.csproj index f5bbc04..fa86171 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication/OpenSilverBusinessApplication.csproj +++ b/src/OpenSilver.CLI/C#/OpenSilverBusinessApplication/OpenSilverBusinessApplication/OpenSilverBusinessApplication.csproj @@ -8,14 +8,14 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/OpenSilver.CLI/C#/OpenSilverClassLibrary/.template.config/template.json b/src/OpenSilver.CLI/C#/OpenSilverClassLibrary/.template.config/template.json index 2a3946a..254a2a4 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverClassLibrary/.template.config/template.json +++ b/src/OpenSilver.CLI/C#/OpenSilverClassLibrary/.template.config/template.json @@ -33,9 +33,9 @@ "openSilverPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverPackageVersion", + "replaces": "$OpenSilverPackageVersion$", "parameters": { - "value": "3.0.1" + "value": "3.1.0" } } }, diff --git a/src/OpenSilver.CLI/C#/OpenSilverClassLibrary/OpenSilverClassLibrary.csproj b/src/OpenSilver.CLI/C#/OpenSilverClassLibrary/OpenSilverClassLibrary.csproj index a802b21..7e0c9d3 100644 --- a/src/OpenSilver.CLI/C#/OpenSilverClassLibrary/OpenSilverClassLibrary.csproj +++ b/src/OpenSilver.CLI/C#/OpenSilverClassLibrary/OpenSilverClassLibrary.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/OpenSilver.CLI/F#/OpenSilverApplication/.template.config/template.json b/src/OpenSilver.CLI/F#/OpenSilverApplication/.template.config/template.json index 72c75e0..dc4a50a 100644 --- a/src/OpenSilver.CLI/F#/OpenSilverApplication/.template.config/template.json +++ b/src/OpenSilver.CLI/F#/OpenSilverApplication/.template.config/template.json @@ -53,9 +53,9 @@ "targetFramework": { "type": "parameter", "datatype": "string", - "description": "Sets the target .NET framework, must be net7.0 or net8.0", - "defaultValue": "net8.0", - "replaces": "net8.0", + "description": "Sets the target .NET framework, must be net7.0, net8.0 or net9.0", + "defaultValue": "net9.0", + "replaces": "net9.0", "choices": [ { "choice": "net7.0", @@ -64,30 +64,70 @@ { "choice": "net8.0", "description": "Use .NET 8.0" + }, + { + "choice": "net9.0", + "description": "Use .NET 9.0" + } + ] + }, + "theme": { + "type": "parameter", + "datatype": "string", + "description": "Specifies the theme for the generated OpenSilver application.", + "defaultValue": "classic", + "choices": [ + { + "choice": "classic", + "description": "Classic theme" + }, + { + "choice": "modern-light", + "description": "Modern theme with light mode" + }, + { + "choice": "modern-dark", + "description": "Modern theme with dark mode" } ] }, "openSilverPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverPackageVersion", + "replaces": "$OpenSilverPackageVersion$", "parameters": { - "value": "3.0.1" + "value": "3.1.0" } }, "openSilverSimulatorPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverSimulatorPackageVersion", + "replaces": "$OpenSilverSimulatorPackageVersion$", "parameters": { - "value": "3.0.0" + "value": "3.1.0" + } + }, + "openSilverWebAssemblyPackageVersion": { + "type": "generated", + "generator": "constant", + "replaces": "$OpenSilverWebAssemblyPackageVersion$", + "parameters": { + "value": "3.1.0" + } + }, + "modernThemePackageVersion": { + "type": "generated", + "generator": "constant", + "replaces": "$ModernThemePackageVersion$", + "parameters": { + "value": "3.1.*" } }, "webAssemblyPackageVersion": { "type": "generated", "generator": "switch", "datatype": "string", - "replaces": "WebAssemblyPackageVersion", + "replaces": "$WebAssemblyPackageVersion$", "parameters": { "evaluator": "C++", "cases": [ @@ -97,7 +137,49 @@ }, { "condition": "(targetFramework == 'net8.0')", - "value": "8.0.0" + "value": "8.0.11" + }, + { + "condition": "(targetFramework == 'net9.0')", + "value": "9.0.0" + } + ] + } + }, + "pageForeground": { + "type": "generated", + "generator": "switch", + "datatype": "string", + "replaces": "$PageForeground$", + "parameters": { + "evaluator": "C++", + "cases": [ + { + "condition": "(theme == 'classic')", + "value": "Black" + }, + { + "condition": "(theme != 'classic')", + "value": "{DynamicResource Theme_TextBrush}" + } + ] + } + }, + "gridBackground": { + "type": "generated", + "generator": "switch", + "datatype": "string", + "replaces": "$GridBackground$", + "parameters": { + "evaluator": "C++", + "cases": [ + { + "condition": "(theme == 'classic')", + "value": "White" + }, + { + "condition": "(theme != 'classic')", + "value": "{DynamicResource Theme_BackgroundBrush}" } ] } diff --git a/src/OpenSilver.CLI/F#/OpenSilverApplication/.vscode/launch.json b/src/OpenSilver.CLI/F#/OpenSilverApplication/.vscode/launch.json deleted file mode 100644 index 518e450..0000000 --- a/src/OpenSilver.CLI/F#/OpenSilverApplication/.vscode/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Launch OpenSilver App", - "type": "blazorwasm", - "request": "launch", - "timeout": 60000, - "url": "http://localhost:55592", - "cwd": "${workspaceFolder}/OpenSilverApplication.Browser" - } - ] -} \ No newline at end of file diff --git a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs deleted file mode 100644 index 9aa1185..0000000 --- a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs +++ /dev/null @@ -1,42 +0,0 @@ -using DotNetForHtml5; -using Microsoft.JSInterop; -using Microsoft.JSInterop.WebAssembly; - -namespace OpenSilverApplication.Browser.Interop -{ - public class UnmarshalledJavaScriptExecutionHandler : IWebAssemblyExecutionHandler - { - private const string MethodName = "callJSUnmarshalled_v2"; - private readonly WebAssemblyJSRuntime _runtime; - - public UnmarshalledJavaScriptExecutionHandler(IJSRuntime runtime) - { - _runtime = runtime as WebAssemblyJSRuntime; - } - - public void ExecuteJavaScript(string javaScriptToExecute) - { - _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public object ExecuteJavaScriptWithResult(string javaScriptToExecute) - { - return _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0) - { - return _runtime.InvokeUnmarshalled(identifier, arg0); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1, T2 arg2) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1, arg2); - } - } -} \ No newline at end of file diff --git a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj index e68c8b3..a91222c 100644 --- a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj +++ b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj @@ -1,9 +1,8 @@  - net8.0 - True - 6 + net9.0 + 7 true false @@ -11,9 +10,9 @@ - - - + + + diff --git a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Pages/Index.cs b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Pages/Index.cs index 18a8b70..b9ba02e 100644 --- a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Pages/Index.cs +++ b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Pages/Index.cs @@ -1,10 +1,7 @@ -using DotNetForHtml5; -using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.JSInterop; -using OpenSilverApplication.Browser.Interop; -using System; using System.Threading.Tasks; +using OpenSilver.WebAssembly; namespace OpenSilverApplication.Browser.Pages { @@ -18,17 +15,7 @@ protected override void BuildRenderTree(RenderTreeBuilder __builder) protected async override Task OnInitializedAsync() { 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(); + await Runner.RunApplicationAsync(); } - - [Inject] - private IJSRuntime JSRuntime { get; set; } } } \ No newline at end of file diff --git a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Program.cs b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Program.cs index 6bdf067..a654b19 100644 --- a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Program.cs +++ b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Program.cs @@ -1,9 +1,5 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Net.Http; using System.Threading.Tasks; -using System.Windows; namespace OpenSilverApplication.Browser { @@ -13,19 +9,8 @@ public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); - - builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - var host = builder.Build(); await host.RunAsync(); } - - public static void RunApplication() - { - Application.RunApplication(() => - { - var app = new OpenSilverApplication.App(); - }); - } } } diff --git a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Properties/launchSettings.json b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Properties/launchSettings.json index 6a2b151..e79929a 100644 --- a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Properties/launchSettings.json +++ b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Browser/Properties/launchSettings.json @@ -8,22 +8,23 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "OpenSilverApplication.Browser": { + "commandName": "Project", + "dotnetRunMessages": true, "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "http://localhost:55592/" }, - "OpenSilverApplication.Browser": { - "commandName": "Project", + "IIS Express": { + "commandName": "IISExpress", "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:55592/" + } } } } \ No newline at end of file diff --git a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Simulator/OpenSilverApplication.Simulator.csproj b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Simulator/OpenSilverApplication.Simulator.csproj index 1d142f9..2234dd3 100644 --- a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Simulator/OpenSilverApplication.Simulator.csproj +++ b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication.Simulator/OpenSilverApplication.Simulator.csproj @@ -2,11 +2,11 @@ WinExe - net472 + net9.0-windows - + diff --git a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/App.xaml b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/App.xaml index e3f05b8..65dccdc 100644 --- a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/App.xaml +++ b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/App.xaml @@ -8,4 +8,14 @@ + + + + + + + + + + diff --git a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/MainPage.xaml b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/MainPage.xaml index 7222d8b..c85f37e 100644 --- a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/MainPage.xaml +++ b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/MainPage.xaml @@ -4,9 +4,10 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:OpenSilverApplication" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d"> + mc:Ignorable="d" + Foreground="$PageForeground$"> - + diff --git a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/OpenSilverApplication.fsproj b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/OpenSilverApplication.fsproj index 305b9bd..90c319d 100644 --- a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/OpenSilverApplication.fsproj +++ b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/OpenSilverApplication.fsproj @@ -7,7 +7,10 @@ - + + + + diff --git a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/Properties/launchSettings.json b/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/Properties/launchSettings.json deleted file mode 100644 index 2199f6e..0000000 --- a/src/OpenSilver.CLI/F#/OpenSilverApplication/OpenSilverApplication/Properties/launchSettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "profiles": { - "OpenSilverApplication": { - "commandName": "Executable", - "executablePath": "cmd", - "commandLineArgs": "/c start \"\" \"http://www.opensilver.net/permalinks/wrong_startup_project.aspx\"" - } - } -} \ No newline at end of file diff --git a/src/OpenSilver.CLI/F#/OpenSilverClassLibrary/.template.config/template.json b/src/OpenSilver.CLI/F#/OpenSilverClassLibrary/.template.config/template.json index 7c8a62f..b2e6b1b 100644 --- a/src/OpenSilver.CLI/F#/OpenSilverClassLibrary/.template.config/template.json +++ b/src/OpenSilver.CLI/F#/OpenSilverClassLibrary/.template.config/template.json @@ -33,9 +33,9 @@ "openSilverPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverPackageVersion", + "replaces": "$OpenSilverPackageVersion$", "parameters": { - "value": "3.0.1" + "value": "3.1.0" } } }, diff --git a/src/OpenSilver.CLI/F#/OpenSilverClassLibrary/OpenSilverClassLibrary.fsproj b/src/OpenSilver.CLI/F#/OpenSilverClassLibrary/OpenSilverClassLibrary.fsproj index af01c90..4a41351 100644 --- a/src/OpenSilver.CLI/F#/OpenSilverClassLibrary/OpenSilverClassLibrary.fsproj +++ b/src/OpenSilver.CLI/F#/OpenSilverClassLibrary/OpenSilverClassLibrary.fsproj @@ -7,7 +7,7 @@ - + diff --git a/src/OpenSilver.CLI/OpenSilver.CLI.Templates.csproj b/src/OpenSilver.CLI/OpenSilver.CLI.Templates.csproj index e19abd9..ef9c43c 100644 --- a/src/OpenSilver.CLI/OpenSilver.CLI.Templates.csproj +++ b/src/OpenSilver.CLI/OpenSilver.CLI.Templates.csproj @@ -12,7 +12,7 @@ Template - 3.0.0 + 3.1.0 OpenSilver.Templates Opensilver CLI templates Userware @@ -33,22 +33,7 @@ - - - - - - Code - - - Code - - - Code - - - Code - + \ No newline at end of file diff --git a/src/OpenSilver.CLI/VB/OpenSilverApplication/.template.config/template.json b/src/OpenSilver.CLI/VB/OpenSilverApplication/.template.config/template.json index bca564b..184615b 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverApplication/.template.config/template.json +++ b/src/OpenSilver.CLI/VB/OpenSilverApplication/.template.config/template.json @@ -53,9 +53,9 @@ "targetFramework": { "type": "parameter", "datatype": "string", - "description": "Sets the target .NET framework, must be net7.0 or net8.0", - "defaultValue": "net8.0", - "replaces": "net8.0", + "description": "Sets the target .NET framework, must be net7.0, net8.0 or net9.0", + "defaultValue": "net9.0", + "replaces": "net9.0", "choices": [ { "choice": "net7.0", @@ -64,30 +64,70 @@ { "choice": "net8.0", "description": "Use .NET 8.0" + }, + { + "choice": "net9.0", + "description": "Use .NET 9.0" + } + ] + }, + "theme": { + "type": "parameter", + "datatype": "string", + "description": "Specifies the theme for the generated OpenSilver application.", + "defaultValue": "classic", + "choices": [ + { + "choice": "classic", + "description": "Classic theme" + }, + { + "choice": "modern-light", + "description": "Modern theme with light mode" + }, + { + "choice": "modern-dark", + "description": "Modern theme with dark mode" } ] }, "openSilverPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverPackageVersion", + "replaces": "$OpenSilverPackageVersion$", "parameters": { - "value": "3.0.1" + "value": "3.1.0" } }, "openSilverSimulatorPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverSimulatorPackageVersion", + "replaces": "$OpenSilverSimulatorPackageVersion$", "parameters": { - "value": "3.0.0" + "value": "3.1.0" + } + }, + "openSilverWebAssemblyPackageVersion": { + "type": "generated", + "generator": "constant", + "replaces": "$OpenSilverWebAssemblyPackageVersion$", + "parameters": { + "value": "3.1.0" + } + }, + "modernThemePackageVersion": { + "type": "generated", + "generator": "constant", + "replaces": "$ModernThemePackageVersion$", + "parameters": { + "value": "3.1.*" } }, "webAssemblyPackageVersion": { "type": "generated", "generator": "switch", "datatype": "string", - "replaces": "WebAssemblyPackageVersion", + "replaces": "$WebAssemblyPackageVersion$", "parameters": { "evaluator": "C++", "cases": [ @@ -97,7 +137,49 @@ }, { "condition": "(targetFramework == 'net8.0')", - "value": "8.0.0" + "value": "8.0.11" + }, + { + "condition": "(targetFramework == 'net9.0')", + "value": "9.0.0" + } + ] + } + }, + "pageForeground": { + "type": "generated", + "generator": "switch", + "datatype": "string", + "replaces": "$PageForeground$", + "parameters": { + "evaluator": "C++", + "cases": [ + { + "condition": "(theme == 'classic')", + "value": "Black" + }, + { + "condition": "(theme != 'classic')", + "value": "{DynamicResource Theme_TextBrush}" + } + ] + } + }, + "gridBackground": { + "type": "generated", + "generator": "switch", + "datatype": "string", + "replaces": "$GridBackground$", + "parameters": { + "evaluator": "C++", + "cases": [ + { + "condition": "(theme == 'classic')", + "value": "White" + }, + { + "condition": "(theme != 'classic')", + "value": "{DynamicResource Theme_BackgroundBrush}" } ] } diff --git a/src/OpenSilver.CLI/VB/OpenSilverApplication/.vscode/launch.json b/src/OpenSilver.CLI/VB/OpenSilverApplication/.vscode/launch.json deleted file mode 100644 index 518e450..0000000 --- a/src/OpenSilver.CLI/VB/OpenSilverApplication/.vscode/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Launch OpenSilver App", - "type": "blazorwasm", - "request": "launch", - "timeout": 60000, - "url": "http://localhost:55592", - "cwd": "${workspaceFolder}/OpenSilverApplication.Browser" - } - ] -} \ No newline at end of file diff --git a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs deleted file mode 100644 index 9aa1185..0000000 --- a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs +++ /dev/null @@ -1,42 +0,0 @@ -using DotNetForHtml5; -using Microsoft.JSInterop; -using Microsoft.JSInterop.WebAssembly; - -namespace OpenSilverApplication.Browser.Interop -{ - public class UnmarshalledJavaScriptExecutionHandler : IWebAssemblyExecutionHandler - { - private const string MethodName = "callJSUnmarshalled_v2"; - private readonly WebAssemblyJSRuntime _runtime; - - public UnmarshalledJavaScriptExecutionHandler(IJSRuntime runtime) - { - _runtime = runtime as WebAssemblyJSRuntime; - } - - public void ExecuteJavaScript(string javaScriptToExecute) - { - _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public object ExecuteJavaScriptWithResult(string javaScriptToExecute) - { - return _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0) - { - return _runtime.InvokeUnmarshalled(identifier, arg0); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1, T2 arg2) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1, arg2); - } - } -} \ No newline at end of file diff --git a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj index 5a66e1b..f310836 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj +++ b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj @@ -1,9 +1,8 @@  - net8.0 - True - 6 + net9.0 + 7 true false @@ -11,9 +10,9 @@ - - - + + + diff --git a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Pages/Index.cs b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Pages/Index.cs index 18a8b70..b9ba02e 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Pages/Index.cs +++ b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Pages/Index.cs @@ -1,10 +1,7 @@ -using DotNetForHtml5; -using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.JSInterop; -using OpenSilverApplication.Browser.Interop; -using System; using System.Threading.Tasks; +using OpenSilver.WebAssembly; namespace OpenSilverApplication.Browser.Pages { @@ -18,17 +15,7 @@ protected override void BuildRenderTree(RenderTreeBuilder __builder) protected async override Task OnInitializedAsync() { 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(); + await Runner.RunApplicationAsync(); } - - [Inject] - private IJSRuntime JSRuntime { get; set; } } } \ No newline at end of file diff --git a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Program.cs b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Program.cs index 6bdf067..a654b19 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Program.cs +++ b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Program.cs @@ -1,9 +1,5 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Net.Http; using System.Threading.Tasks; -using System.Windows; namespace OpenSilverApplication.Browser { @@ -13,19 +9,8 @@ public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); - - builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - var host = builder.Build(); await host.RunAsync(); } - - public static void RunApplication() - { - Application.RunApplication(() => - { - var app = new OpenSilverApplication.App(); - }); - } } } diff --git a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Properties/launchSettings.json b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Properties/launchSettings.json index 6a2b151..e79929a 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Properties/launchSettings.json +++ b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Browser/Properties/launchSettings.json @@ -8,22 +8,23 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "OpenSilverApplication.Browser": { + "commandName": "Project", + "dotnetRunMessages": true, "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "http://localhost:55592/" }, - "OpenSilverApplication.Browser": { - "commandName": "Project", + "IIS Express": { + "commandName": "IISExpress", "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:55592/" + } } } } \ No newline at end of file diff --git a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Simulator/OpenSilverApplication.Simulator.csproj b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Simulator/OpenSilverApplication.Simulator.csproj index 1a2bdb4..1b58f46 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Simulator/OpenSilverApplication.Simulator.csproj +++ b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication.Simulator/OpenSilverApplication.Simulator.csproj @@ -2,11 +2,11 @@ WinExe - net472 + net9.0-windows - + diff --git a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/App.xaml b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/App.xaml index e3f05b8..65dccdc 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/App.xaml +++ b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/App.xaml @@ -8,4 +8,14 @@ + + + + + + + + + + diff --git a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/MainPage.xaml b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/MainPage.xaml index 7222d8b..c85f37e 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/MainPage.xaml +++ b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/MainPage.xaml @@ -4,9 +4,10 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:OpenSilverApplication" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d"> + mc:Ignorable="d" + Foreground="$PageForeground$"> - + diff --git a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/OpenSilverApplication.vbproj b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/OpenSilverApplication.vbproj index d4b39e8..a0e2932 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/OpenSilverApplication.vbproj +++ b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/OpenSilverApplication.vbproj @@ -7,7 +7,10 @@ - + + + + diff --git a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/Properties/launchSettings.json b/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/Properties/launchSettings.json deleted file mode 100644 index 2199f6e..0000000 --- a/src/OpenSilver.CLI/VB/OpenSilverApplication/OpenSilverApplication/Properties/launchSettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "profiles": { - "OpenSilverApplication": { - "commandName": "Executable", - "executablePath": "cmd", - "commandLineArgs": "/c start \"\" \"http://www.opensilver.net/permalinks/wrong_startup_project.aspx\"" - } - } -} \ No newline at end of file diff --git a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/.template.config/template.json b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/.template.config/template.json index 66fec2c..d49d1aa 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/.template.config/template.json +++ b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/.template.config/template.json @@ -39,9 +39,9 @@ "targetFramework": { "type": "parameter", "datatype": "string", - "description": "Sets the target .NET framework, must be net7.0 or net8.0", - "defaultValue": "net8.0", - "replaces": "net8.0", + "description": "Sets the target .NET framework, must be net7.0, net8.0 or net9.0", + "defaultValue": "net9.0", + "replaces": "net9.0", "choices": [ { "choice": "net7.0", @@ -50,38 +50,50 @@ { "choice": "net8.0", "description": "Use .NET 8.0" + }, + { + "choice": "net9.0", + "description": "Use .NET 9.0" } ] }, "openSilverPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverPackageVersion", + "replaces": "$OpenSilverPackageVersion$", "parameters": { - "value": "3.0.1" + "value": "3.1.0" } }, "openSilverSimulatorPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverSimulatorPackageVersion", + "replaces": "$OpenSilverSimulatorPackageVersion$", "parameters": { - "value": "3.0.0" + "value": "3.1.0" + } + }, + "openSilverWebAssemblyPackageVersion": { + "type": "generated", + "generator": "constant", + "replaces": "$OpenSilverWebAssemblyPackageVersion$", + "parameters": { + "value": "3.1.0" } }, "openSilverOpenRiaPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverOpenRiaPackageVersion", + "replaces": "$OpenSilverOpenRiaPackageVersion$", "parameters": { - "value": "3.0.0" + "value": "3.1.0" } }, "webAssemblyPackageVersion": { "type": "generated", "generator": "switch", "datatype": "string", - "replaces": "WebAssemblyPackageVersion", + "replaces": "$WebAssemblyPackageVersion$", "parameters": { "evaluator": "C++", "cases": [ @@ -91,7 +103,11 @@ }, { "condition": "(targetFramework == 'net8.0')", - "value": "8.0.0" + "value": "8.0.11" + }, + { + "condition": "(targetFramework == 'net9.0')", + "value": "9.0.0" } ] } diff --git a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/.vscode/launch.json b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/.vscode/launch.json deleted file mode 100644 index 77569e8..0000000 --- a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/.vscode/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Launch OpenSilver App", - "type": "blazorwasm", - "request": "launch", - "timeout": 60000, - "url": "http://localhost:55592", - "cwd": "${workspaceFolder}/OpenSilverBusinessApplication.Browser" - } - ] -} \ No newline at end of file diff --git a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs deleted file mode 100644 index 38c6b1f..0000000 --- a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs +++ /dev/null @@ -1,42 +0,0 @@ -using DotNetForHtml5; -using Microsoft.JSInterop; -using Microsoft.JSInterop.WebAssembly; - -namespace OpenSilverBusinessApplication.Browser.Interop -{ - public class UnmarshalledJavaScriptExecutionHandler : IWebAssemblyExecutionHandler - { - private const string MethodName = "callJSUnmarshalled_v2"; - private readonly WebAssemblyJSRuntime _runtime; - - public UnmarshalledJavaScriptExecutionHandler(IJSRuntime runtime) - { - _runtime = runtime as WebAssemblyJSRuntime; - } - - public void ExecuteJavaScript(string javaScriptToExecute) - { - _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public object ExecuteJavaScriptWithResult(string javaScriptToExecute) - { - return _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0) - { - return _runtime.InvokeUnmarshalled(identifier, arg0); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1, T2 arg2) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1, arg2); - } - } -} \ No newline at end of file diff --git a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj index a180d11..7375e26 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj +++ b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj @@ -1,9 +1,8 @@  - net8.0 - True - 6 + net9.0 + 7 true false @@ -11,9 +10,9 @@ - - - + + + diff --git a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Pages/Index.cs b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Pages/Index.cs index 106a7a9..3497ecf 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Pages/Index.cs +++ b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Pages/Index.cs @@ -1,10 +1,7 @@ -using DotNetForHtml5; -using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.JSInterop; -using OpenSilverBusinessApplication.Browser.Interop; -using System; using System.Threading.Tasks; +using OpenSilver.WebAssembly; namespace OpenSilverBusinessApplication.Browser.Pages { @@ -18,17 +15,7 @@ protected override void BuildRenderTree(RenderTreeBuilder __builder) protected async override Task OnInitializedAsync() { 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(); + await Runner.RunApplicationAsync(); } - - [Inject] - private IJSRuntime JSRuntime { get; set; } } } \ No newline at end of file diff --git a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Program.cs b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Program.cs index d63b199..a775186 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Program.cs +++ b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Program.cs @@ -1,9 +1,5 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Net.Http; using System.Threading.Tasks; -using System.Windows; namespace OpenSilverBusinessApplication.Browser { @@ -13,19 +9,8 @@ public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); - - builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - var host = builder.Build(); await host.RunAsync(); } - - public static void RunApplication() - { - Application.RunApplication(() => - { - var app = new OpenSilverBusinessApplication.App(); - }); - } } } diff --git a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json index 529c28c..85d4ab5 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json +++ b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json @@ -8,22 +8,23 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "OpenSilverBusinessApplication.Browser": { + "commandName": "Project", + "dotnetRunMessages": true, "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "http://localhost:55592/" }, - "OpenSilverBusinessApplication.Browser": { - "commandName": "Project", + "IIS Express": { + "commandName": "IISExpress", "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:55592/" + } } } } \ No newline at end of file diff --git a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Simulator/OpenSilverBusinessApplication.Simulator.csproj b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Simulator/OpenSilverBusinessApplication.Simulator.csproj index ba39c45..abaf994 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Simulator/OpenSilverBusinessApplication.Simulator.csproj +++ b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication.Simulator/OpenSilverBusinessApplication.Simulator.csproj @@ -2,11 +2,11 @@ WinExe - net472 + net9.0-windows - + diff --git a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication/OpenSilverBusinessApplication.vbproj b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication/OpenSilverBusinessApplication.vbproj index 3754667..f63e01e 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication/OpenSilverBusinessApplication.vbproj +++ b/src/OpenSilver.CLI/VB/OpenSilverBusinessApplication/OpenSilverBusinessApplication/OpenSilverBusinessApplication.vbproj @@ -8,14 +8,14 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/OpenSilver.CLI/VB/OpenSilverClassLibrary/.template.config/template.json b/src/OpenSilver.CLI/VB/OpenSilverClassLibrary/.template.config/template.json index 96798f3..cfcc2cf 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverClassLibrary/.template.config/template.json +++ b/src/OpenSilver.CLI/VB/OpenSilverClassLibrary/.template.config/template.json @@ -33,9 +33,9 @@ "openSilverPackageVersion": { "type": "generated", "generator": "constant", - "replaces": "OpenSilverPackageVersion", + "replaces": "$OpenSilverPackageVersion$", "parameters": { - "value": "3.0.1" + "value": "3.1.0" } } }, diff --git a/src/OpenSilver.CLI/VB/OpenSilverClassLibrary/OpenSilverClassLibrary.vbproj b/src/OpenSilver.CLI/VB/OpenSilverClassLibrary/OpenSilverClassLibrary.vbproj index 62e079b..89057a7 100644 --- a/src/OpenSilver.CLI/VB/OpenSilverClassLibrary/OpenSilverClassLibrary.vbproj +++ b/src/OpenSilver.CLI/VB/OpenSilverClassLibrary/OpenSilverClassLibrary.vbproj @@ -7,7 +7,7 @@ - + diff --git a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml index 260865a..5af4c33 100644 --- a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml +++ b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml @@ -7,42 +7,77 @@ WindowStartupLocation="CenterScreen" ResizeMode="NoResize" mc:Ignorable="d" - Title="OpenSilver Configuration" Height="300" Width="350" Icon="Icon.ico"> + Title="OpenSilver Configuration" Height="600" Width="660" Icon="Icon.ico"> + + + + + + + - - - - - .NET 6 + + + + + + + + + + + + + + + + + + + + + + .NET 7 - .NET 8 + .NET 8 + .NET 9 - - - + + - - - - + + + + - + + + - + + + + + diff --git a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml.cs b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml.cs index 31eb9b2..12f3534 100644 --- a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml.cs +++ b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/AppConfigurationWindow.xaml.cs @@ -1,5 +1,8 @@ -using System; +using OpenSilver.TemplateWizards.AppCustomizationWindow.Models; +using System; +using System.Collections.Generic; using System.Windows; +using System.Windows.Controls; namespace OpenSilver.TemplateWizards.AppCustomizationWindow { @@ -8,6 +11,8 @@ namespace OpenSilver.TemplateWizards.AppCustomizationWindow /// public partial class AppConfigurationWindow : Window { + public IDictionary Themes { get; set; } = new Dictionary(); + public string SelectedTheme { get; set; } public OpenSilverBuildType OpenSilverBuildType { get @@ -23,31 +28,72 @@ public DotNetVersion DotNetVersion switch (DotNetVersionComboBox.SelectedIndex) { case 0: - return DotNetVersion.Net6; - case 1: return DotNetVersion.Net7; - case 2: + case 1: return DotNetVersion.Net8; + case 2: + return DotNetVersion.Net9; default: throw new InvalidOperationException("Error retrieving selected .NET version"); } } } - public AppConfigurationWindow(string openSilverType) + + public AppConfigurationWindow(string openSilverType, bool isBusiness = false) { - InitializeComponent(); + InitilizeThemes(); + InitializeComponent(); if (openSilverType == "Library") { - DotNetVersionStackPanel.Visibility = Visibility.Collapsed; + DotNetVersionPanel.Visibility = Visibility.Collapsed; + } + + //Modern theme is deactivated for now, for Business Application projects + if (isBusiness) + { + chooseThemesCollection.Visibility = Visibility.Collapsed; + SelectedTheme = Themes[ThemeSelectionEnum.Classic]; + continueBtn.IsEnabled = true; + this.Height = 300; } } + private void InitilizeThemes() + { + Themes.Add(ThemeSelectionEnum.Dark, "Dark"); + Themes.Add(ThemeSelectionEnum.Light, "Light"); + Themes.Add(ThemeSelectionEnum.Classic, "Classic"); + } + private void ButtonContinue_Click(object sender, RoutedEventArgs e) { DialogResult = true; Close(); } + + private void OnThemSelected(object sender, RoutedEventArgs e) + { + + if (sender is RadioButton selectedRadio) + { + try + { + SelectedTheme = Themes[(ThemeSelectionEnum)selectedRadio.Tag]; + } + catch + { + throw new InvalidOperationException("Error retrieving selected theme option"); + } + } + + } + + private void ThemeCollectionView_SelectionChanged(object sender, EventArgs e) + { + SelectedTheme = (sender as ThemeOptions).Name; + continueBtn.IsEnabled = true; + } } } diff --git a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/DotNetVersion.cs b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/DotNetVersion.cs index 75fe39a..d80c69d 100644 --- a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/DotNetVersion.cs +++ b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/DotNetVersion.cs @@ -2,8 +2,8 @@ { public enum DotNetVersion { - Net6, Net7, - Net8 + Net8, + Net9, } } \ No newline at end of file diff --git a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/Models/ThemeOption.cs b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/Models/ThemeOption.cs new file mode 100644 index 0000000..fba3b48 --- /dev/null +++ b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/Models/ThemeOption.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.Runtime.CompilerServices; + +namespace OpenSilver.TemplateWizards.AppCustomizationWindow.Models +{ + public class ThemeOptions + { + public string ThumbnailUri { get; set; } + public string Name { get; set; } + public string Title { get; set; } + public string BackgroundColor { get; set; } + + public static IEnumerable GeThemes() + { + var themes = new List(); + themes.Add(new ThemeOptions { Name="Light",Title = "Modern - Light", ThumbnailUri = "/OpenSilver.TemplateWizards;component/Assets/Images/light_theme.png", BackgroundColor = "#FFFFFF" }); + themes.Add(new ThemeOptions { Name="Dark",Title = "Modern - Dark", ThumbnailUri = "/OpenSilver.TemplateWizards;component/Assets/Images/dark_theme.png", BackgroundColor = "#111111" }); + themes.Add(new ThemeOptions { Name="Classic",Title = "Classic - Silverlight", ThumbnailUri = "/OpenSilver.TemplateWizards;component/Assets/Images/classic_theme.png", BackgroundColor = "#FFFFFF" }); + return themes; + } + } +} diff --git a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/ThemeCollectionView.xaml b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/ThemeCollectionView.xaml new file mode 100644 index 0000000..38daad8 --- /dev/null +++ b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/ThemeCollectionView.xaml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + diff --git a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/ThemeCollectionView.xaml.cs b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/ThemeCollectionView.xaml.cs new file mode 100644 index 0000000..3bf4426 --- /dev/null +++ b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/ThemeCollectionView.xaml.cs @@ -0,0 +1,38 @@ +using OpenSilver.TemplateWizards.AppCustomizationWindow.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace OpenSilver.TemplateWizards.AppCustomizationWindow +{ + /// + /// Interaction logic for ThemeCollectionView.xaml + /// + public partial class ThemeCollectionView : UserControl + { + public event EventHandler SelectionChanged; + public ThemeCollectionView() + { + InitializeComponent(); + themeList.ItemsSource = ThemeOptions.GeThemes(); + themeList.SelectionChanged += ThemeList_SelectionChanged; + } + + private void ThemeList_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + + SelectionChanged?.Invoke(themeList.SelectedItem, e); + } + } +} diff --git a/src/OpenSilver.TemplateWizards/AppCustomizationWindow/ThemeSelectionEnum.cs b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/ThemeSelectionEnum.cs new file mode 100644 index 0000000..7bd0fd2 --- /dev/null +++ b/src/OpenSilver.TemplateWizards/AppCustomizationWindow/ThemeSelectionEnum.cs @@ -0,0 +1,9 @@ +namespace OpenSilver.TemplateWizards.AppCustomizationWindow +{ + public enum ThemeSelectionEnum + { + Dark, + Light, + Classic, + } +} \ No newline at end of file diff --git a/src/OpenSilver.TemplateWizards/AppCustomizationWizard.cs b/src/OpenSilver.TemplateWizards/AppCustomizationWizard.cs index dcb3596..7630fed 100644 --- a/src/OpenSilver.TemplateWizards/AppCustomizationWizard.cs +++ b/src/OpenSilver.TemplateWizards/AppCustomizationWizard.cs @@ -13,6 +13,66 @@ namespace OpenSilver.TemplateWizards class AppCustomizationWizard : IWizard { private const string NugetConfig = "NuGet.Config"; + private const string ClassicLoadingAnimation = @" +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
"; + private const string ModernLoadingAnimation = @" +
+
+
+
+
+
+
+
+ + + +
+
+
"; + private const string ModernLightStyles = @" + "; + private const string ModernDarkStyles = @" + "; + private const string ModernLoadingJs = @" + const script = document.createElement('script'); + script.setAttribute('type', 'application/javascript'); + script.setAttribute('src', 'modern/loading-animation.js?date=' + new Date().toISOString()); + document.head.appendChild(script);"; private static string GetVsixFullPath(string filename) { @@ -40,7 +100,7 @@ private static void CopyNugetConfig(Dictionary replacementsDicti try { var directoryKey = IsProjectAndSolutionSameDir(replacementsDictionary) ? "$destinationdirectory$" : "$solutiondirectory$"; - var solutionDir = replacementsDictionary.ContainsKey(directoryKey) ? replacementsDictionary[directoryKey] : null; + var solutionDir = replacementsDictionary.ContainsKey(directoryKey) ? replacementsDictionary[directoryKey] : null; var vsixNugetConfig = GetVsixFullPath(NugetConfig); if (solutionDir != null && vsixNugetConfig != null) { @@ -60,7 +120,66 @@ public void BeforeOpeningFile(ProjectItem projectItem) public void ProjectFinishedGenerating(Project project) { + } + + private string GetAppXamlTheme(string selectedTheme) + { + if (selectedTheme == "Classic") + { + return ""; + } + + return $" {Environment.NewLine} {Environment.NewLine} "; + } + + private string GetThemesNugetPackageLine(string version) + { + return $"{Environment.NewLine} "; + } + + private string GetLoadingColors(string selectedTheme) + { + if (selectedTheme == "Light") + { + return ModernLightStyles; + } + + if (selectedTheme == "Dark") + { + return ModernDarkStyles; + } + + return ""; + } + + private string GetLoadingIndicatorCss(string selectedTheme) + { + if (selectedTheme == "Classic") + { + return "loading-indicator.css"; + } + + return "modern/loading-indicator.css"; + } + + private string GetLoadingIndicatorJs(string selectedTheme) + { + if (selectedTheme == "Classic") + { + return ""; + } + return ModernLoadingJs; + } + + private string GetLoadingIndicatorHtml(string selectedTheme) + { + if (selectedTheme == "Classic") + { + return ClassicLoadingAnimation; + } + + return ModernLoadingAnimation; } public void ProjectItemFinishedGenerating(ProjectItem projectItem) @@ -79,11 +198,11 @@ public void RunStarted(object automationObject, Dictionary repla XNamespace defaultNamespace = openSilverInfo.GetDefaultNamespace(); - string openSilverAPI = openSilverInfo.Element(defaultNamespace + "Api").Value; string openSilverType = openSilverInfo.Element(defaultNamespace + "Type").Value; + bool isBusiness = openSilverInfo.Element(defaultNamespace + "IsBusiness")?.Value.Equals("true", StringComparison.OrdinalIgnoreCase) ?? false; - AppConfigurationWindow window = new AppConfigurationWindow(openSilverType); + AppConfigurationWindow window = new AppConfigurationWindow(openSilverType, isBusiness); // In the case of a class Library, the user has no other choices to make so we do not show the app configuration window. if (openSilverType != "Library") @@ -95,44 +214,47 @@ public void RunStarted(object automationObject, Dictionary repla } } - if (openSilverAPI == "Silverlight") - { - switch (window.OpenSilverBuildType) - { - case OpenSilverBuildType.Stable: - replacementsDictionary.Add("$opensilverpackagename$", "OpenSilver"); - break; - } - } - else - { - throw new ArgumentNullException($"Unknown OpenSilver API '{openSilverAPI}'"); - } - if (openSilverType == "Application") { switch (window.DotNetVersion) { - case DotNetVersion.Net6: - replacementsDictionary.Add("$targetframework$", "net6.0"); - replacementsDictionary.Add("$blazorpackagesversion$", "6.0.0"); - break; case DotNetVersion.Net7: replacementsDictionary.Add("$targetframework$", "net7.0"); replacementsDictionary.Add("$blazorpackagesversion$", "7.0.0"); break; case DotNetVersion.Net8: replacementsDictionary.Add("$targetframework$", "net8.0"); - replacementsDictionary.Add("$blazorpackagesversion$", "8.0.0"); + replacementsDictionary.Add("$blazorpackagesversion$", "8.0.11"); + break; + case DotNetVersion.Net9: + replacementsDictionary.Add("$targetframework$", "net9.0"); + replacementsDictionary.Add("$blazorpackagesversion$", "9.0.0"); break; } CopyNugetConfig(replacementsDictionary); } - replacementsDictionary.Add("$opensilverpackageversion$", "3.0.1"); - replacementsDictionary.Add("$opensilversimulatorpackageversion$", "3.0.0"); - replacementsDictionary.Add("$openria46packageversion$", "3.0.0"); + replacementsDictionary.Add("$opensilverpackageversion$", "3.1.0"); + replacementsDictionary.Add("$opensilversimulatorpackageversion$", "3.1.0"); + replacementsDictionary.Add("$opensilverwebassemblypackageversion$", "3.1.0"); + replacementsDictionary.Add("$openria46packageversion$", "3.1.0"); + replacementsDictionary.Add("$opensilverthememodern$", "3.1.*"); + + replacementsDictionary.Add("$pageforeground$", IsClassic(window) ? "Black" : "{DynamicResource Theme_TextBrush}"); + replacementsDictionary.Add("$gridbackground$", IsClassic(window) ? "White" : "{DynamicResource Theme_BackgroundBrush}"); + replacementsDictionary.Add("$appxamltheme$", GetAppXamlTheme(window.SelectedTheme)); + replacementsDictionary.Add("$themesnugetpackage$", IsClassic(window) ? "" : GetThemesNugetPackageLine(replacementsDictionary["$opensilverthememodern$"])); + + replacementsDictionary.Add("$modernloadingcolors$", GetLoadingColors(window.SelectedTheme)); + replacementsDictionary.Add("$loadingindicatorcss$", GetLoadingIndicatorCss(window.SelectedTheme)); + replacementsDictionary.Add("$loadingindicatorjs$", GetLoadingIndicatorJs(window.SelectedTheme)); + replacementsDictionary.Add("$loadingindicatorhtml$", GetLoadingIndicatorHtml(window.SelectedTheme)); + } + + private bool IsClassic(AppConfigurationWindow window) + { + return window.SelectedTheme == "Classic"; } public bool ShouldAddProjectItem(string filePath) diff --git a/src/OpenSilver.TemplateWizards/Assets/Images/classic_theme.png b/src/OpenSilver.TemplateWizards/Assets/Images/classic_theme.png new file mode 100644 index 0000000..ee5f2ac Binary files /dev/null and b/src/OpenSilver.TemplateWizards/Assets/Images/classic_theme.png differ diff --git a/src/OpenSilver.TemplateWizards/Assets/Images/dark_theme.png b/src/OpenSilver.TemplateWizards/Assets/Images/dark_theme.png new file mode 100644 index 0000000..3ff1f03 Binary files /dev/null and b/src/OpenSilver.TemplateWizards/Assets/Images/dark_theme.png differ diff --git a/src/OpenSilver.TemplateWizards/Assets/Images/light_theme.png b/src/OpenSilver.TemplateWizards/Assets/Images/light_theme.png new file mode 100644 index 0000000..62bfa68 Binary files /dev/null and b/src/OpenSilver.TemplateWizards/Assets/Images/light_theme.png differ diff --git a/src/OpenSilver.TemplateWizards/OpenSilver.TemplateWizards.csproj b/src/OpenSilver.TemplateWizards/OpenSilver.TemplateWizards.csproj index f8cc621..05c814d 100644 --- a/src/OpenSilver.TemplateWizards/OpenSilver.TemplateWizards.csproj +++ b/src/OpenSilver.TemplateWizards/OpenSilver.TemplateWizards.csproj @@ -49,7 +49,12 @@ AppConfigurationWindow.xaml + + + ThemeCollectionView.xaml + +
@@ -58,6 +63,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile +
@@ -66,5 +75,11 @@ + + + + + +
\ No newline at end of file diff --git a/src/OpenSilver.VSIX/source.extension.vsixmanifest b/src/OpenSilver.VSIX/source.extension.vsixmanifest index 1efd65f..a4c7fec 100644 --- a/src/OpenSilver.VSIX/source.extension.vsixmanifest +++ b/src/OpenSilver.VSIX/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + OpenSilver Project templates and XAML Designer for creating OpenSilver applications. OpenSilver is an open-source reimplementation of Silverlight that runs on current browsers via WebAssembly. Logo_32x32.png diff --git a/src/OpenSilver.XamlDesigner/OpenSilver.XamlDesigner.csproj b/src/OpenSilver.XamlDesigner/OpenSilver.XamlDesigner.csproj index dd97716..03288ad 100644 --- a/src/OpenSilver.XamlDesigner/OpenSilver.XamlDesigner.csproj +++ b/src/OpenSilver.XamlDesigner/OpenSilver.XamlDesigner.csproj @@ -235,22 +235,22 @@ - ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2024-11-18-031505-451785db\lib\net47\Userware.XamlDesigner.Api.BL.Models.OpenSilver.dll + ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2024-12-10-092348-bf8d19d8\lib\net47\Userware.XamlDesigner.Api.BL.Models.OpenSilver.dll - ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2024-11-18-031505-451785db\lib\net47\Userware.XamlDesigner.Api.Client.OpenSilver.dll + ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2024-12-10-092348-bf8d19d8\lib\net47\Userware.XamlDesigner.Api.Client.OpenSilver.dll - ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2024-11-18-031505-451785db\lib\net47\Userware.XamlDesigner.Communication.OpenSilver.dll + ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2024-12-10-092348-bf8d19d8\lib\net47\Userware.XamlDesigner.Communication.OpenSilver.dll - ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2024-11-18-031505-451785db\lib\net47\Userware.XamlDesigner.Data.Primitives.OpenSilver.dll + ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2024-12-10-092348-bf8d19d8\lib\net47\Userware.XamlDesigner.Data.Primitives.OpenSilver.dll - ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2024-11-18-031505-451785db\lib\net47\Userware.XamlDesigner.OpenSilver.dll + ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2024-12-10-092348-bf8d19d8\lib\net47\Userware.XamlDesigner.OpenSilver.dll - ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2024-11-18-031505-451785db\lib\net47\Userware.XamlDesigner.SplitXamlEditor.OpenSilver.dll + ..\packages\XamlDesigner.OpenSilver.2.0.0-preview-2024-12-10-092348-bf8d19d8\lib\net47\Userware.XamlDesigner.SplitXamlEditor.OpenSilver.dll
@@ -296,11 +296,11 @@ - + - +
\ No newline at end of file diff --git a/src/OpenSilver.XamlDesigner/packages.config b/src/OpenSilver.XamlDesigner/packages.config index 2eba5a6..7800914 100644 --- a/src/OpenSilver.XamlDesigner/packages.config +++ b/src/OpenSilver.XamlDesigner/packages.config @@ -63,5 +63,5 @@ - + \ No newline at end of file diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs deleted file mode 100644 index 369fd51..0000000 --- a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs +++ /dev/null @@ -1,42 +0,0 @@ -using DotNetForHtml5; -using Microsoft.JSInterop; -using Microsoft.JSInterop.WebAssembly; - -namespace $safeprojectname$.Interop -{ - public class UnmarshalledJavaScriptExecutionHandler : IWebAssemblyExecutionHandler - { - private const string MethodName = "callJSUnmarshalled_v2"; - private readonly WebAssemblyJSRuntime _runtime; - - public UnmarshalledJavaScriptExecutionHandler(IJSRuntime runtime) - { - _runtime = runtime as WebAssemblyJSRuntime; - } - - public void ExecuteJavaScript(string javaScriptToExecute) - { - _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public object ExecuteJavaScriptWithResult(string javaScriptToExecute) - { - return _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0) - { - return _runtime.InvokeUnmarshalled(identifier, arg0); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1, T2 arg2) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1, arg2); - } - } -} \ No newline at end of file diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj index 9e4125a..184eae0 100644 --- a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj +++ b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/OpenSilverApplication.Browser.csproj @@ -2,8 +2,7 @@ $ext_targetframework$ - True - 6 + 7 true false @@ -13,7 +12,7 @@ - + diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/OpenSilverApplication.Browser.vstemplate b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/OpenSilverApplication.Browser.vstemplate index 3e47d5f..b8bc7ab 100644 --- a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/OpenSilverApplication.Browser.vstemplate +++ b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/OpenSilverApplication.Browser.vstemplate @@ -9,13 +9,12 @@ launchSettings.json + modern/loading-indicator.css + modern/loading-animation.js favicon.ico index.html loading-indicator.css - - UnmarshalledJavaScriptExecutionHandler.cs - Index.cs diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Pages/Index.cs b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Pages/Index.cs index f56a66b..792ce2b 100644 --- a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Pages/Index.cs +++ b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Pages/Index.cs @@ -1,10 +1,7 @@ -using System; -using System.Threading.Tasks; -using DotNetForHtml5; -using $safeprojectname$.Interop; +using System.Threading.Tasks; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.JSInterop; +using OpenSilver.WebAssembly; namespace $safeprojectname$.Pages { @@ -18,17 +15,7 @@ protected override void BuildRenderTree(RenderTreeBuilder __builder) protected async override Task OnInitializedAsync() { 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(); + await Runner.RunApplicationAsync<$ext_safeprojectname$.App>(); } - - [Inject] - private IJSRuntime JSRuntime { get; set; } } } \ No newline at end of file diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Program.cs b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Program.cs index c089ce7..24b50d3 100644 --- a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Program.cs +++ b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Program.cs @@ -1,8 +1,4 @@ -using System.Windows; -using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using System.Threading.Tasks; namespace $safeprojectname$ @@ -13,19 +9,8 @@ public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); - - builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - var host = builder.Build(); await host.RunAsync(); } - - public static void RunApplication() - { - Application.RunApplication(() => - { - var app = new $ext_safeprojectname$.App(); - }); - } } } diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Properties/launchSettings.json b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Properties/launchSettings.json index 7b865db..990c3f6 100644 --- a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Properties/launchSettings.json +++ b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/Properties/launchSettings.json @@ -8,22 +8,23 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "$safeprojectname$": { + "commandName": "Project", + "dotnetRunMessages": true, "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "http://localhost:55592/" }, - "$safeprojectname$": { - "commandName": "Project", + "IIS Express": { + "commandName": "IISExpress", "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:55592/" + } } } } \ No newline at end of file diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/wwwroot/index.html b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/wwwroot/index.html index 411db66..0589c9e 100644 --- a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/wwwroot/index.html +++ b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/wwwroot/index.html @@ -4,40 +4,20 @@ $ext_safeprojectname$ - + $ext_modernloadingcolors$ -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
$ext_loadingindicatorhtml$
diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/wwwroot/loading-indicator.css b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/wwwroot/loading-indicator.css index af05e43..f85e049 100644 --- a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/wwwroot/loading-indicator.css +++ b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/wwwroot/loading-indicator.css @@ -20,12 +20,17 @@ } } +body { + margin: 0; +} + .loading-indicator-wrapper { display: flex; justify-content: center; align-items: center; width: 100vw; height: 100vh; + background-color: #f0f0f0; /* Lighter background */ } .loading-indicator { @@ -41,8 +46,8 @@ width: 16%; height: 16%; border-radius: 50%; - background: #41afe6; - filter: blur(4px); + background: #3b8eea; /* Light blue */ + filter: blur(3px); /* Slightly lighter blur */ opacity: 0; animation: loading-indicator-ball-anim 9s infinite; } @@ -154,4 +159,7 @@ .loading-indicator-text:after { content: var(--blazor-load-percentage-text, "Loading..."); + color: #555; /* Darker text for contrast */ + font-size: 1.2rem; + font-family: 'Arial', sans-serif; } diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/wwwroot/modern/loading-animation.js b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/wwwroot/modern/loading-animation.js new file mode 100644 index 0000000..8c79602 --- /dev/null +++ b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/wwwroot/modern/loading-animation.js @@ -0,0 +1,134 @@ +(function () { + function startLoader() { + const count = document.querySelector(".opensilver-odometer"); + const loader = document.querySelector(".opensilver-loader-progress-bar"); + + if (!count || !loader) return; + + loader.style.width = "0%"; + + const observer = new MutationObserver(updateCount); + function updateCount() { + const loadPercentageText = getComputedStyle(document.documentElement) + .getPropertyValue("--blazor-load-percentage-text") + .trim(); + const loadPercentage = parseInt(loadPercentageText.replace(/"/g, "")); + const currentValue = isNaN(loadPercentage) ? 0 : loadPercentage; + + animateCounter(currentValue); + loader.style.width = currentValue + "%"; + + if (currentValue === 100) { + observer.disconnect(); + return; + } + } + + observer.observe(document.documentElement, { + attributes: true, + attributeFilter: ["style"], + }); + + updateCount(); + } + + function animateCounter(newValue) { + newValue = Math.min(newValue, 100); + + const count = Array.from(document.querySelectorAll(".opensilver-odometer")); + const currentValue = count.map((span) => span.textContent).join(""); + const newValueString = String(newValue).padStart(3, "0"); + for (let i = 0; i < newValueString.length; i++) { + if (newValueString[i] !== currentValue[i]) { + gsap.to(count[i], { + y: -4, + opacity: 0.5, + duration: 0.075, + ease: "none", + onComplete: () => { + count[i].textContent = newValueString[i]; + gsap.fromTo( + count[i], + { y: 4, opacity: 0.5 }, + { y: 0, opacity: 1, duration: 0.075, ease: "none" } + ); + }, + }); + } + } + + if (newValue === 100 && currentValue !== "100") { + gsap.to(count[1], { + y: -4, + opacity: 0.5, + duration: 0.075, + ease: "none", + onComplete: () => { + count[1].textContent = "0"; + gsap.fromTo( + count[1], + { y: 4, opacity: 0.5 }, + { y: 0, opacity: 1, duration: 0.075, ease: "none" } + ); + }, + }); + + gsap.to(count[2], { + y: -4, + opacity: 0.5, + duration: 0.075, + ease: "none", + onComplete: () => { + count[2].textContent = "0"; + gsap.fromTo( + count[2], + { y: 4, opacity: 0.5 }, + { y: 0, opacity: 1, duration: 0.075, ease: "none" } + ); + }, + }); + } + } + + function onDomReady() { + startLoader(); + + function startAnimations() { + gsap.to(".opensilver-loader-progress", { + width: "60vw", + opacity: 1, + duration: 1.25, + ease: "power1.out", + delay: 0.4, + }); + + gsap.to(".opensilver-counter-container", { + opacity: 1, + duration: 0.3, + ease: "none", + delay: 1.1, + }); + + gsap.to(".opensilver-counter-container > .opensilver-odometer", { + transform: "translateY(0)", + duration: 0.3, + ease: "none", + delay: 1.1, + }); + } + + startAnimations(); + } + + const script = document.createElement('script'); + script.setAttribute('type', 'application/javascript'); + script.setAttribute('src', 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js'); + script.addEventListener('load', function () { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', onDomReady); + } else { + onDomReady(); + } + }); + document.head.appendChild(script); +})(); \ No newline at end of file diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/wwwroot/modern/loading-indicator.css b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/wwwroot/modern/loading-indicator.css new file mode 100644 index 0000000..5eb9e1e --- /dev/null +++ b/src/OpenSilverApplicationTemplate/OpenSilverApplication.Browser/wwwroot/modern/loading-indicator.css @@ -0,0 +1,74 @@ + +html body { + background: var(--opensilver-loading-background-color); +} + +.opensilver-loading-indicator { + position: fixed; + top: 0; + left: 0; + display: flex; + justify-content: center; + align-items: center; + pointer-events: none; + height: 100vh; + width: 100vw; + overflow: hidden; + background: var(--opensilver-loading-background-color); +} + +.opensilver-loading-indicator .opensilver-loader-container { + display: flex; + justify-content: center; + align-items: center; + gap: 8px; +} + +.opensilver-loading-indicator .opensilver-loader { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 10px; + width: 100%; + height: 100%; + margin-left: 20px; +} + +.opensilver-loading-indicator .opensilver-loader-progress { + display: flex; + justify-content: flex-start; + align-items: center; + width: 0; + max-width: 200px; + height: 4px; + border-radius: 12px; + background-color: var(--opensilver-loading-progress-bg); +} + +.opensilver-loading-indicator .opensilver-loader-progress-bar { + width: 0%; + height: 5px; + border-radius: 12px; + background-color: var(--opensilver-loading-progress-bar-color); + transition: width 0.75s ease; +} + +.opensilver-loading-indicator .opensilver-counter-container { + align-self: end; + display: flex; + justify-content: end; + align-items: center; + font-family: sans-serif; + font-size: clamp(0.8rem, 1.4vw, 1.6rem); + font-weight: 500; + width: 100%; + min-width: 26px; + line-height: 1; + gap: 1px; + color: var(--opensilver-loading-counter-color); +} + +.opensilver-loading-indicator .opensilver-counter-container > .opensilver-odometer { + transform: translateY(4px); +} diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication.vstemplate b/src/OpenSilverApplicationTemplate/OpenSilverApplication.vstemplate index 91c60d2..834b750 100644 --- a/src/OpenSilverApplicationTemplate/OpenSilverApplication.vstemplate +++ b/src/OpenSilverApplicationTemplate/OpenSilverApplication.vstemplate @@ -1,41 +1,42 @@ - - OpenSilver Application - A blank project for creating a rich internet application using OpenSilver. OpenSilver is an open-source reimplementation of Silverlight that runs on current browsers via WebAssembly. - Icon.ico - csharp - csharp - xaml - web - blazor - OpenSilver - 10 - true - OpenSilverApplication - true - true - - - - - OpenSilverApplication.Browser\OpenSilverApplication.Browser.vstemplate - - - OpenSilverApplication\OpenSilverApplication.vstemplate - - - OpenSilverApplication.Simulator\OpenSilverApplication.Simulator.vstemplate - - - - - OpenSilver.TemplateWizards, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - OpenSilver.TemplateWizards.AppCustomizationWizard - - - - Silverlight - Application - - + + OpenSilver Application + A blank project for creating a rich internet application using OpenSilver. OpenSilver is an open-source reimplementation of Silverlight that runs on current browsers via WebAssembly. + Icon.ico + csharp + csharp + xaml + web + blazor + OpenSilver + 10 + true + OpenSilverApplication + true + true + + + + + OpenSilverApplication.Browser\OpenSilverApplication.Browser.vstemplate + + + OpenSilverApplication\OpenSilverApplication.vstemplate + + + OpenSilverApplication.Simulator\OpenSilverApplication.Simulator.vstemplate + + + + + OpenSilver.TemplateWizards, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + OpenSilver.TemplateWizards.AppCustomizationWizard + + + + Silverlight + Application + cs + + \ No newline at end of file diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication/App.xaml b/src/OpenSilverApplicationTemplate/OpenSilverApplication/App.xaml index b9ec891..30d0938 100644 --- a/src/OpenSilverApplicationTemplate/OpenSilverApplication/App.xaml +++ b/src/OpenSilverApplicationTemplate/OpenSilverApplication/App.xaml @@ -5,7 +5,8 @@ xmlns:local="clr-namespace:$ext_safeprojectname$"> - + +$ext_appxamltheme$ diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication/MainPage.xaml b/src/OpenSilverApplicationTemplate/OpenSilverApplication/MainPage.xaml index 0c16c99..2fdcd6e 100644 --- a/src/OpenSilverApplicationTemplate/OpenSilverApplication/MainPage.xaml +++ b/src/OpenSilverApplicationTemplate/OpenSilverApplication/MainPage.xaml @@ -4,9 +4,10 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:$ext_safeprojectname$" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d"> + mc:Ignorable="d" + Foreground="$ext_pageforeground$"> - + diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication/OpenSilverApplication.csproj b/src/OpenSilverApplicationTemplate/OpenSilverApplication/OpenSilverApplication.csproj index 8fd4c07..7a228d4 100644 --- a/src/OpenSilverApplicationTemplate/OpenSilverApplication/OpenSilverApplication.csproj +++ b/src/OpenSilverApplicationTemplate/OpenSilverApplication/OpenSilverApplication.csproj @@ -7,7 +7,7 @@ - + $ext_themesnugetpackage$ diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication/OpenSilverApplication.vstemplate b/src/OpenSilverApplicationTemplate/OpenSilverApplication/OpenSilverApplication.vstemplate index 324c290..563562f 100644 --- a/src/OpenSilverApplicationTemplate/OpenSilverApplication/OpenSilverApplication.vstemplate +++ b/src/OpenSilverApplicationTemplate/OpenSilverApplication/OpenSilverApplication.vstemplate @@ -9,9 +9,6 @@ App.xaml.cs MainPage.xaml MainPage.xaml.cs - - launchSettings.json - \ No newline at end of file diff --git a/src/OpenSilverApplicationTemplate/OpenSilverApplication/Properties/launchSettings.json b/src/OpenSilverApplicationTemplate/OpenSilverApplication/Properties/launchSettings.json deleted file mode 100644 index c6f934e..0000000 --- a/src/OpenSilverApplicationTemplate/OpenSilverApplication/Properties/launchSettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "profiles": { - "$ext_safeprojectname$": { - "commandName": "Executable", - "executablePath": "cmd", - "commandLineArgs": "/c start \"\" \"http://www.opensilver.net/permalinks/wrong_startup_project.aspx\"" - } - } -} \ No newline at end of file diff --git a/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs b/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs deleted file mode 100644 index cd76284..0000000 --- a/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs +++ /dev/null @@ -1,42 +0,0 @@ -using DotNetForHtml5; -using Microsoft.JSInterop; -using Microsoft.JSInterop.WebAssembly; - -namespace $ext_safeprojectname$.Browser.Interop -{ - public class UnmarshalledJavaScriptExecutionHandler : IWebAssemblyExecutionHandler - { - private const string MethodName = "callJSUnmarshalled_v2"; - private readonly WebAssemblyJSRuntime _runtime; - - public UnmarshalledJavaScriptExecutionHandler(IJSRuntime runtime) - { - _runtime = runtime as WebAssemblyJSRuntime; - } - - public void ExecuteJavaScript(string javaScriptToExecute) - { - _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public object ExecuteJavaScriptWithResult(string javaScriptToExecute) - { - return _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0) - { - return _runtime.InvokeUnmarshalled(identifier, arg0); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1, T2 arg2) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1, arg2); - } - } -} \ No newline at end of file diff --git a/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj b/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj index 220f9ff..78bb6c0 100644 --- a/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj +++ b/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj @@ -2,8 +2,7 @@ $ext_targetframework$ - True - 6 + 7 true false @@ -13,7 +12,7 @@ - + diff --git a/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.vstemplate b/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.vstemplate index 4c51776..2562fc5 100644 --- a/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.vstemplate +++ b/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.vstemplate @@ -13,9 +13,6 @@ index.html loading-indicator.css - - UnmarshalledJavaScriptExecutionHandler.cs - Index.cs diff --git a/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Pages/Index.cs b/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Pages/Index.cs index e3267e2..0662d19 100644 --- a/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Pages/Index.cs +++ b/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Pages/Index.cs @@ -1,10 +1,7 @@ -using System; -using System.Threading.Tasks; -using DotNetForHtml5; +using System.Threading.Tasks; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.JSInterop; -using $ext_safeprojectname$.Browser.Interop; +using OpenSilver.WebAssembly; namespace $ext_safeprojectname$.Browser.Pages { @@ -18,17 +15,7 @@ protected override void BuildRenderTree(RenderTreeBuilder __builder) protected async override Task OnInitializedAsync() { 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(); + await Runner.RunApplicationAsync<$ext_safeprojectname$.App>(); } - - [Inject] - private IJSRuntime JSRuntime { get; set; } } } \ No newline at end of file diff --git a/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Program.cs b/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Program.cs index 5471c82..ce58ec3 100644 --- a/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Program.cs +++ b/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Program.cs @@ -1,9 +1,5 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Net.Http; using System.Threading.Tasks; -using System.Windows; namespace $ext_safeprojectname$.Browser { @@ -13,19 +9,8 @@ public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); - - builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - var host = builder.Build(); await host.RunAsync(); } - - public static void RunApplication() - { - Application.RunApplication(() => - { - var app = new $ext_safeprojectname$.App(); - }); - } } } diff --git a/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json b/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json index 8a5ea8f..4faa042 100644 --- a/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json +++ b/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json @@ -8,22 +8,23 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "$safeprojectname$": { + "commandName": "Project", + "dotnetRunMessages": true, "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "http://localhost:55592/" }, - "$safeprojectname$": { - "commandName": "Project", + "IIS Express": { + "commandName": "IISExpress", "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:55592/" + } } } } \ No newline at end of file diff --git a/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/wwwroot/loading-indicator.css b/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/wwwroot/loading-indicator.css index a87a07b..fcf8777 100644 --- a/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/wwwroot/loading-indicator.css +++ b/src/OpenSilverBusinessApplicationTemplate/OpenSilverBusinessApplication.Browser/wwwroot/loading-indicator.css @@ -20,12 +20,17 @@ } } +body { + margin: 0; +} + .loading-indicator-wrapper { display: flex; justify-content: center; align-items: center; width: 100vw; height: 100vh; + background-color: #f0f0f0; /* Lighter background */ } .loading-indicator { @@ -41,8 +46,8 @@ width: 16%; height: 16%; border-radius: 50%; - background: #41afe6; - filter: blur(4px); + background: #3b8eea; /* Light blue */ + filter: blur(3px); /* Slightly lighter blur */ opacity: 0; animation: loading-indicator-ball-anim 9s infinite; } @@ -154,4 +159,7 @@ .loading-indicator-text:after { content: var(--blazor-load-percentage-text, "Loading..."); + color: #555; /* Darker text for contrast */ + font-size: 1.2rem; + font-family: 'Arial', sans-serif; } diff --git a/src/OpenSilverBusinessApplicationTemplate/root.vstemplate b/src/OpenSilverBusinessApplicationTemplate/root.vstemplate index b73b9fa..dbfe386 100644 --- a/src/OpenSilverBusinessApplicationTemplate/root.vstemplate +++ b/src/OpenSilverBusinessApplicationTemplate/root.vstemplate @@ -1,36 +1,38 @@ - - OpenSilver Business Application (RIA Services) - OpenSilver line-of-business application using Open RIA Services (client/server) - __TemplateIcon.ico - OpenSilverBusinessApplication - true - true - csharp - web - csharp - xaml - web - blazor - OpenSilver - 12 - - - - OpenSilverBusinessApplication\OpenSilverBusinessApplication.vstemplate - OpenSilverBusinessApplication.Browser\OpenSilverBusinessApplication.Browser.vstemplate - OpenSilverBusinessApplication.Simulator\OpenSilverBusinessApplication.Simulator.vstemplate - OpenSilverBusinessApplication.Web\OpenSilverBusinessApplication.Web.vstemplate - - - - OpenSilver.TemplateWizards, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - OpenSilver.TemplateWizards.AppCustomizationWizard - - - - Silverlight - Application - - + + OpenSilver Business Application (RIA Services) + OpenSilver line-of-business application using Open RIA Services (client/server) + __TemplateIcon.ico + OpenSilverBusinessApplication + true + true + csharp + web + csharp + xaml + web + blazor + OpenSilver + 12 + + + + OpenSilverBusinessApplication\OpenSilverBusinessApplication.vstemplate + OpenSilverBusinessApplication.Browser\OpenSilverBusinessApplication.Browser.vstemplate + OpenSilverBusinessApplication.Simulator\OpenSilverBusinessApplication.Simulator.vstemplate + OpenSilverBusinessApplication.Web\OpenSilverBusinessApplication.Web.vstemplate + + + + OpenSilver.TemplateWizards, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + OpenSilver.TemplateWizards.AppCustomizationWizard + + + + Silverlight + Application + cs + true + + \ No newline at end of file diff --git a/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs b/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs deleted file mode 100644 index cd76284..0000000 --- a/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs +++ /dev/null @@ -1,42 +0,0 @@ -using DotNetForHtml5; -using Microsoft.JSInterop; -using Microsoft.JSInterop.WebAssembly; - -namespace $ext_safeprojectname$.Browser.Interop -{ - public class UnmarshalledJavaScriptExecutionHandler : IWebAssemblyExecutionHandler - { - private const string MethodName = "callJSUnmarshalled_v2"; - private readonly WebAssemblyJSRuntime _runtime; - - public UnmarshalledJavaScriptExecutionHandler(IJSRuntime runtime) - { - _runtime = runtime as WebAssemblyJSRuntime; - } - - public void ExecuteJavaScript(string javaScriptToExecute) - { - _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public object ExecuteJavaScriptWithResult(string javaScriptToExecute) - { - return _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0) - { - return _runtime.InvokeUnmarshalled(identifier, arg0); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1, T2 arg2) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1, arg2); - } - } -} \ No newline at end of file diff --git a/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj b/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj index 700cd7d..35e6c4d 100644 --- a/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj +++ b/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.csproj @@ -2,8 +2,7 @@ $ext_targetframework$ - True - 6 + 7 true false @@ -13,7 +12,7 @@ - + diff --git a/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.vstemplate b/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.vstemplate index 4c51776..2562fc5 100644 --- a/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.vstemplate +++ b/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/OpenSilverBusinessApplication.Browser.vstemplate @@ -13,9 +13,6 @@ index.html loading-indicator.css - - UnmarshalledJavaScriptExecutionHandler.cs - Index.cs diff --git a/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Pages/Index.cs b/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Pages/Index.cs index e3267e2..0662d19 100644 --- a/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Pages/Index.cs +++ b/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Pages/Index.cs @@ -1,10 +1,7 @@ -using System; -using System.Threading.Tasks; -using DotNetForHtml5; +using System.Threading.Tasks; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.JSInterop; -using $ext_safeprojectname$.Browser.Interop; +using OpenSilver.WebAssembly; namespace $ext_safeprojectname$.Browser.Pages { @@ -18,17 +15,7 @@ protected override void BuildRenderTree(RenderTreeBuilder __builder) protected async override Task OnInitializedAsync() { 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(); + await Runner.RunApplicationAsync<$ext_safeprojectname$.App>(); } - - [Inject] - private IJSRuntime JSRuntime { get; set; } } } \ No newline at end of file diff --git a/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Program.cs b/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Program.cs index 5471c82..ce58ec3 100644 --- a/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Program.cs +++ b/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Program.cs @@ -1,9 +1,5 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Net.Http; using System.Threading.Tasks; -using System.Windows; namespace $ext_safeprojectname$.Browser { @@ -13,19 +9,8 @@ public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); - - builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - var host = builder.Build(); await host.RunAsync(); } - - public static void RunApplication() - { - Application.RunApplication(() => - { - var app = new $ext_safeprojectname$.App(); - }); - } } } diff --git a/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json b/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json index 7b865db..990c3f6 100644 --- a/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json +++ b/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/Properties/launchSettings.json @@ -8,22 +8,23 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "$safeprojectname$": { + "commandName": "Project", + "dotnetRunMessages": true, "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "http://localhost:55592/" }, - "$safeprojectname$": { - "commandName": "Project", + "IIS Express": { + "commandName": "IISExpress", "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:55592/" + } } } } \ No newline at end of file diff --git a/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/wwwroot/loading-indicator.css b/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/wwwroot/loading-indicator.css index af05e43..f85e049 100644 --- a/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/wwwroot/loading-indicator.css +++ b/src/OpenSilverBusinessVBApplicationTemplate/OpenSilverBusinessApplication.Browser/wwwroot/loading-indicator.css @@ -20,12 +20,17 @@ } } +body { + margin: 0; +} + .loading-indicator-wrapper { display: flex; justify-content: center; align-items: center; width: 100vw; height: 100vh; + background-color: #f0f0f0; /* Lighter background */ } .loading-indicator { @@ -41,8 +46,8 @@ width: 16%; height: 16%; border-radius: 50%; - background: #41afe6; - filter: blur(4px); + background: #3b8eea; /* Light blue */ + filter: blur(3px); /* Slightly lighter blur */ opacity: 0; animation: loading-indicator-ball-anim 9s infinite; } @@ -154,4 +159,7 @@ .loading-indicator-text:after { content: var(--blazor-load-percentage-text, "Loading..."); + color: #555; /* Darker text for contrast */ + font-size: 1.2rem; + font-family: 'Arial', sans-serif; } diff --git a/src/OpenSilverBusinessVBApplicationTemplate/root.vstemplate b/src/OpenSilverBusinessVBApplicationTemplate/root.vstemplate index d6a4466..c29e661 100644 --- a/src/OpenSilverBusinessVBApplicationTemplate/root.vstemplate +++ b/src/OpenSilverBusinessVBApplicationTemplate/root.vstemplate @@ -1,36 +1,38 @@ - - OpenSilver Business Application (RIA Services) (VB) - OpenSilver line-of-business application using Open RIA Services (client/server) - __TemplateIcon.ico - OpenSilverBusinessApplication - true - true - visualbasic - web - visualbasic - xaml - web - blazor - OpenSilver - 16 - - - - OpenSilverBusinessApplication\OpenSilverBusinessApplication.vstemplate - OpenSilverBusinessApplication.Browser\OpenSilverBusinessApplication.Browser.vstemplate - OpenSilverBusinessApplication.Simulator\OpenSilverBusinessApplication.Simulator.vstemplate - OpenSilverBusinessApplication.Web\OpenSilverBusinessApplication.Web.vstemplate - - - - OpenSilver.TemplateWizards, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - OpenSilver.TemplateWizards.AppCustomizationWizard - - - - Silverlight - Application - - + + OpenSilver Business Application (RIA Services) (VB) + OpenSilver line-of-business application using Open RIA Services (client/server) + __TemplateIcon.ico + OpenSilverBusinessApplication + true + true + visualbasic + web + visualbasic + xaml + web + blazor + OpenSilver + 16 + + + + OpenSilverBusinessApplication\OpenSilverBusinessApplication.vstemplate + OpenSilverBusinessApplication.Browser\OpenSilverBusinessApplication.Browser.vstemplate + OpenSilverBusinessApplication.Simulator\OpenSilverBusinessApplication.Simulator.vstemplate + OpenSilverBusinessApplication.Web\OpenSilverBusinessApplication.Web.vstemplate + + + + OpenSilver.TemplateWizards, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + OpenSilver.TemplateWizards.AppCustomizationWizard + + + + Silverlight + Application + vb + true + + \ No newline at end of file diff --git a/src/OpenSilverClassLibraryTemplate/OpenSilverClassLibrary.csproj b/src/OpenSilverClassLibraryTemplate/OpenSilverClassLibrary.csproj index ccb40c2..93f1b7c 100644 --- a/src/OpenSilverClassLibraryTemplate/OpenSilverClassLibrary.csproj +++ b/src/OpenSilverClassLibraryTemplate/OpenSilverClassLibrary.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverApplication.vstemplate b/src/OpenSilverFSApplicationTemplate/OpenSilverApplication.vstemplate index 9d19fe6..da2b0c7 100644 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverApplication.vstemplate +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverApplication.vstemplate @@ -1,41 +1,42 @@ - - OpenSilver Application (F#) - A blank project for creating a rich internet application using OpenSilver. OpenSilver is an open-source reimplementation of Silverlight that runs on current browsers via WebAssembly. - Icon.ico - fsharp - fsharp - xaml - web - blazor - OpenSilver - 18 - true - OpenSilverApplication - true - true - - - - - OpenSilverFSApplication.Browser\OpenSilverApplication.Browser.vstemplate - - - OpenSilverFSApplication\OpenSilverApplication.vstemplate - - - OpenSilverFSApplication.Simulator\OpenSilverApplication.Simulator.vstemplate - - - - - OpenSilver.TemplateWizards, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - OpenSilver.TemplateWizards.AppCustomizationWizard - - - - Silverlight - Application - - + + OpenSilver Application (F#) + A blank project for creating a rich internet application using OpenSilver. OpenSilver is an open-source reimplementation of Silverlight that runs on current browsers via WebAssembly. + Icon.ico + fsharp + fsharp + xaml + web + blazor + OpenSilver + 18 + true + OpenSilverApplication + true + true + + + + + OpenSilverFSApplication.Browser\OpenSilverApplication.Browser.vstemplate + + + OpenSilverFSApplication\OpenSilverApplication.vstemplate + + + OpenSilverFSApplication.Simulator\OpenSilverApplication.Simulator.vstemplate + + + + + OpenSilver.TemplateWizards, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + OpenSilver.TemplateWizards.AppCustomizationWizard + + + + Silverlight + Application + fs + + \ No newline at end of file diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs deleted file mode 100644 index 369fd51..0000000 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs +++ /dev/null @@ -1,42 +0,0 @@ -using DotNetForHtml5; -using Microsoft.JSInterop; -using Microsoft.JSInterop.WebAssembly; - -namespace $safeprojectname$.Interop -{ - public class UnmarshalledJavaScriptExecutionHandler : IWebAssemblyExecutionHandler - { - private const string MethodName = "callJSUnmarshalled_v2"; - private readonly WebAssemblyJSRuntime _runtime; - - public UnmarshalledJavaScriptExecutionHandler(IJSRuntime runtime) - { - _runtime = runtime as WebAssemblyJSRuntime; - } - - public void ExecuteJavaScript(string javaScriptToExecute) - { - _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public object ExecuteJavaScriptWithResult(string javaScriptToExecute) - { - return _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0) - { - return _runtime.InvokeUnmarshalled(identifier, arg0); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1, T2 arg2) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1, arg2); - } - } -} \ No newline at end of file diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/OpenSilverApplication.Browser.csproj b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/OpenSilverApplication.Browser.csproj index 04240c7..ada65df 100644 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/OpenSilverApplication.Browser.csproj +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/OpenSilverApplication.Browser.csproj @@ -2,8 +2,7 @@ $ext_targetframework$ - True - 6 + 7 true false @@ -13,7 +12,7 @@ - + diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/OpenSilverApplication.Browser.vstemplate b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/OpenSilverApplication.Browser.vstemplate index 3e47d5f..b8bc7ab 100644 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/OpenSilverApplication.Browser.vstemplate +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/OpenSilverApplication.Browser.vstemplate @@ -9,13 +9,12 @@ launchSettings.json + modern/loading-indicator.css + modern/loading-animation.js favicon.ico index.html loading-indicator.css - - UnmarshalledJavaScriptExecutionHandler.cs - Index.cs diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Pages/Index.cs b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Pages/Index.cs index f56a66b..792ce2b 100644 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Pages/Index.cs +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Pages/Index.cs @@ -1,10 +1,7 @@ -using System; -using System.Threading.Tasks; -using DotNetForHtml5; -using $safeprojectname$.Interop; +using System.Threading.Tasks; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.JSInterop; +using OpenSilver.WebAssembly; namespace $safeprojectname$.Pages { @@ -18,17 +15,7 @@ protected override void BuildRenderTree(RenderTreeBuilder __builder) protected async override Task OnInitializedAsync() { 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(); + await Runner.RunApplicationAsync<$ext_safeprojectname$.App>(); } - - [Inject] - private IJSRuntime JSRuntime { get; set; } } } \ No newline at end of file diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Program.cs b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Program.cs index c089ce7..24b50d3 100644 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Program.cs +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Program.cs @@ -1,8 +1,4 @@ -using System.Windows; -using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using System.Threading.Tasks; namespace $safeprojectname$ @@ -13,19 +9,8 @@ public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); - - builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - var host = builder.Build(); await host.RunAsync(); } - - public static void RunApplication() - { - Application.RunApplication(() => - { - var app = new $ext_safeprojectname$.App(); - }); - } } } diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Properties/launchSettings.json b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Properties/launchSettings.json index 7b865db..990c3f6 100644 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Properties/launchSettings.json +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/Properties/launchSettings.json @@ -8,22 +8,23 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "$safeprojectname$": { + "commandName": "Project", + "dotnetRunMessages": true, "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "http://localhost:55592/" }, - "$safeprojectname$": { - "commandName": "Project", + "IIS Express": { + "commandName": "IISExpress", "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:55592/" + } } } } \ No newline at end of file diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/wwwroot/index.html b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/wwwroot/index.html index 411db66..0589c9e 100644 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/wwwroot/index.html +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/wwwroot/index.html @@ -4,40 +4,20 @@ $ext_safeprojectname$ - + $ext_modernloadingcolors$ -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
$ext_loadingindicatorhtml$
diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/wwwroot/loading-indicator.css b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/wwwroot/loading-indicator.css index af05e43..f85e049 100644 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/wwwroot/loading-indicator.css +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/wwwroot/loading-indicator.css @@ -20,12 +20,17 @@ } } +body { + margin: 0; +} + .loading-indicator-wrapper { display: flex; justify-content: center; align-items: center; width: 100vw; height: 100vh; + background-color: #f0f0f0; /* Lighter background */ } .loading-indicator { @@ -41,8 +46,8 @@ width: 16%; height: 16%; border-radius: 50%; - background: #41afe6; - filter: blur(4px); + background: #3b8eea; /* Light blue */ + filter: blur(3px); /* Slightly lighter blur */ opacity: 0; animation: loading-indicator-ball-anim 9s infinite; } @@ -154,4 +159,7 @@ .loading-indicator-text:after { content: var(--blazor-load-percentage-text, "Loading..."); + color: #555; /* Darker text for contrast */ + font-size: 1.2rem; + font-family: 'Arial', sans-serif; } diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/wwwroot/modern/loading-animation.js b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/wwwroot/modern/loading-animation.js new file mode 100644 index 0000000..8c79602 --- /dev/null +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/wwwroot/modern/loading-animation.js @@ -0,0 +1,134 @@ +(function () { + function startLoader() { + const count = document.querySelector(".opensilver-odometer"); + const loader = document.querySelector(".opensilver-loader-progress-bar"); + + if (!count || !loader) return; + + loader.style.width = "0%"; + + const observer = new MutationObserver(updateCount); + function updateCount() { + const loadPercentageText = getComputedStyle(document.documentElement) + .getPropertyValue("--blazor-load-percentage-text") + .trim(); + const loadPercentage = parseInt(loadPercentageText.replace(/"/g, "")); + const currentValue = isNaN(loadPercentage) ? 0 : loadPercentage; + + animateCounter(currentValue); + loader.style.width = currentValue + "%"; + + if (currentValue === 100) { + observer.disconnect(); + return; + } + } + + observer.observe(document.documentElement, { + attributes: true, + attributeFilter: ["style"], + }); + + updateCount(); + } + + function animateCounter(newValue) { + newValue = Math.min(newValue, 100); + + const count = Array.from(document.querySelectorAll(".opensilver-odometer")); + const currentValue = count.map((span) => span.textContent).join(""); + const newValueString = String(newValue).padStart(3, "0"); + for (let i = 0; i < newValueString.length; i++) { + if (newValueString[i] !== currentValue[i]) { + gsap.to(count[i], { + y: -4, + opacity: 0.5, + duration: 0.075, + ease: "none", + onComplete: () => { + count[i].textContent = newValueString[i]; + gsap.fromTo( + count[i], + { y: 4, opacity: 0.5 }, + { y: 0, opacity: 1, duration: 0.075, ease: "none" } + ); + }, + }); + } + } + + if (newValue === 100 && currentValue !== "100") { + gsap.to(count[1], { + y: -4, + opacity: 0.5, + duration: 0.075, + ease: "none", + onComplete: () => { + count[1].textContent = "0"; + gsap.fromTo( + count[1], + { y: 4, opacity: 0.5 }, + { y: 0, opacity: 1, duration: 0.075, ease: "none" } + ); + }, + }); + + gsap.to(count[2], { + y: -4, + opacity: 0.5, + duration: 0.075, + ease: "none", + onComplete: () => { + count[2].textContent = "0"; + gsap.fromTo( + count[2], + { y: 4, opacity: 0.5 }, + { y: 0, opacity: 1, duration: 0.075, ease: "none" } + ); + }, + }); + } + } + + function onDomReady() { + startLoader(); + + function startAnimations() { + gsap.to(".opensilver-loader-progress", { + width: "60vw", + opacity: 1, + duration: 1.25, + ease: "power1.out", + delay: 0.4, + }); + + gsap.to(".opensilver-counter-container", { + opacity: 1, + duration: 0.3, + ease: "none", + delay: 1.1, + }); + + gsap.to(".opensilver-counter-container > .opensilver-odometer", { + transform: "translateY(0)", + duration: 0.3, + ease: "none", + delay: 1.1, + }); + } + + startAnimations(); + } + + const script = document.createElement('script'); + script.setAttribute('type', 'application/javascript'); + script.setAttribute('src', 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js'); + script.addEventListener('load', function () { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', onDomReady); + } else { + onDomReady(); + } + }); + document.head.appendChild(script); +})(); \ No newline at end of file diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/wwwroot/modern/loading-indicator.css b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/wwwroot/modern/loading-indicator.css new file mode 100644 index 0000000..5eb9e1e --- /dev/null +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication.Browser/wwwroot/modern/loading-indicator.css @@ -0,0 +1,74 @@ + +html body { + background: var(--opensilver-loading-background-color); +} + +.opensilver-loading-indicator { + position: fixed; + top: 0; + left: 0; + display: flex; + justify-content: center; + align-items: center; + pointer-events: none; + height: 100vh; + width: 100vw; + overflow: hidden; + background: var(--opensilver-loading-background-color); +} + +.opensilver-loading-indicator .opensilver-loader-container { + display: flex; + justify-content: center; + align-items: center; + gap: 8px; +} + +.opensilver-loading-indicator .opensilver-loader { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 10px; + width: 100%; + height: 100%; + margin-left: 20px; +} + +.opensilver-loading-indicator .opensilver-loader-progress { + display: flex; + justify-content: flex-start; + align-items: center; + width: 0; + max-width: 200px; + height: 4px; + border-radius: 12px; + background-color: var(--opensilver-loading-progress-bg); +} + +.opensilver-loading-indicator .opensilver-loader-progress-bar { + width: 0%; + height: 5px; + border-radius: 12px; + background-color: var(--opensilver-loading-progress-bar-color); + transition: width 0.75s ease; +} + +.opensilver-loading-indicator .opensilver-counter-container { + align-self: end; + display: flex; + justify-content: end; + align-items: center; + font-family: sans-serif; + font-size: clamp(0.8rem, 1.4vw, 1.6rem); + font-weight: 500; + width: 100%; + min-width: 26px; + line-height: 1; + gap: 1px; + color: var(--opensilver-loading-counter-color); +} + +.opensilver-loading-indicator .opensilver-counter-container > .opensilver-odometer { + transform: translateY(4px); +} diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/App.xaml b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/App.xaml index b9ec891..7266969 100644 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/App.xaml +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/App.xaml @@ -8,4 +8,5 @@ +$ext_appxamltheme$ diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/MainPage.xaml b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/MainPage.xaml index 0c16c99..2fdcd6e 100644 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/MainPage.xaml +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/MainPage.xaml @@ -4,9 +4,10 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:$ext_safeprojectname$" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d"> + mc:Ignorable="d" + Foreground="$ext_pageforeground$"> - + diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/OpenSilverApplication.fsproj b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/OpenSilverApplication.fsproj index 2d6cbb0..f414e7b 100644 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/OpenSilverApplication.fsproj +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/OpenSilverApplication.fsproj @@ -7,7 +7,7 @@ - + $ext_themesnugetpackage$ diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/OpenSilverApplication.vstemplate b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/OpenSilverApplication.vstemplate index 3c3470e..18082d8 100644 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/OpenSilverApplication.vstemplate +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/OpenSilverApplication.vstemplate @@ -9,9 +9,6 @@ App.xaml.fs MainPage.xaml MainPage.xaml.fs - - launchSettings.json - \ No newline at end of file diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/Properties/launchSettings.json b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/Properties/launchSettings.json deleted file mode 100644 index c6f934e..0000000 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplication/Properties/launchSettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "profiles": { - "$ext_safeprojectname$": { - "commandName": "Executable", - "executablePath": "cmd", - "commandLineArgs": "/c start \"\" \"http://www.opensilver.net/permalinks/wrong_startup_project.aspx\"" - } - } -} \ No newline at end of file diff --git a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplicationTemplate.csproj b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplicationTemplate.csproj index f6146bd..3f8df0f 100644 --- a/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplicationTemplate.csproj +++ b/src/OpenSilverFSApplicationTemplate/OpenSilverFSApplicationTemplate.csproj @@ -13,7 +13,7 @@ Debug AnyCPU {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - {80832fe2-eb71-4443-b582-61cf0132e241} + {80832FE2-EB71-4443-B582-61CF0132E241} Library Properties $safeprojectname$ diff --git a/src/OpenSilverFSClassLibraryTemplate/OpenSilverClassLibrary.fsproj b/src/OpenSilverFSClassLibraryTemplate/OpenSilverClassLibrary.fsproj index 9860b5c..8db5103 100644 --- a/src/OpenSilverFSClassLibraryTemplate/OpenSilverClassLibrary.fsproj +++ b/src/OpenSilverFSClassLibraryTemplate/OpenSilverClassLibrary.fsproj @@ -7,7 +7,7 @@ - + diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverApplication.vstemplate b/src/OpenSilverVBApplicationTemplate/OpenSilverApplication.vstemplate index b2ee91d..750a924 100644 --- a/src/OpenSilverVBApplicationTemplate/OpenSilverApplication.vstemplate +++ b/src/OpenSilverVBApplicationTemplate/OpenSilverApplication.vstemplate @@ -36,6 +36,7 @@ Silverlight Application + vb \ No newline at end of file diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs deleted file mode 100644 index 369fd51..0000000 --- a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Interop/UnmarshalledJavaScriptExecutionHandler.cs +++ /dev/null @@ -1,42 +0,0 @@ -using DotNetForHtml5; -using Microsoft.JSInterop; -using Microsoft.JSInterop.WebAssembly; - -namespace $safeprojectname$.Interop -{ - public class UnmarshalledJavaScriptExecutionHandler : IWebAssemblyExecutionHandler - { - private const string MethodName = "callJSUnmarshalled_v2"; - private readonly WebAssemblyJSRuntime _runtime; - - public UnmarshalledJavaScriptExecutionHandler(IJSRuntime runtime) - { - _runtime = runtime as WebAssemblyJSRuntime; - } - - public void ExecuteJavaScript(string javaScriptToExecute) - { - _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public object ExecuteJavaScriptWithResult(string javaScriptToExecute) - { - return _runtime.InvokeUnmarshalled(MethodName, javaScriptToExecute); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0) - { - return _runtime.InvokeUnmarshalled(identifier, arg0); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1); - } - - public TResult InvokeUnmarshalled(string identifier, T0 arg0, T1 arg1, T2 arg2) - { - return _runtime.InvokeUnmarshalled(identifier, arg0, arg1, arg2); - } - } -} \ No newline at end of file diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/OpenSilverApplication.Browser.csproj b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/OpenSilverApplication.Browser.csproj index 5abc949..35e6c4d 100644 --- a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/OpenSilverApplication.Browser.csproj +++ b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/OpenSilverApplication.Browser.csproj @@ -2,8 +2,7 @@ $ext_targetframework$ - True - 6 + 7 true false @@ -13,7 +12,7 @@ - + diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/OpenSilverApplication.Browser.vstemplate b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/OpenSilverApplication.Browser.vstemplate index 3e47d5f..b8bc7ab 100644 --- a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/OpenSilverApplication.Browser.vstemplate +++ b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/OpenSilverApplication.Browser.vstemplate @@ -9,13 +9,12 @@ launchSettings.json + modern/loading-indicator.css + modern/loading-animation.js favicon.ico index.html loading-indicator.css - - UnmarshalledJavaScriptExecutionHandler.cs - Index.cs diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Pages/Index.cs b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Pages/Index.cs index f56a66b..792ce2b 100644 --- a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Pages/Index.cs +++ b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Pages/Index.cs @@ -1,10 +1,7 @@ -using System; -using System.Threading.Tasks; -using DotNetForHtml5; -using $safeprojectname$.Interop; +using System.Threading.Tasks; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.JSInterop; +using OpenSilver.WebAssembly; namespace $safeprojectname$.Pages { @@ -18,17 +15,7 @@ protected override void BuildRenderTree(RenderTreeBuilder __builder) protected async override Task OnInitializedAsync() { 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(); + await Runner.RunApplicationAsync<$ext_safeprojectname$.App>(); } - - [Inject] - private IJSRuntime JSRuntime { get; set; } } } \ No newline at end of file diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Program.cs b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Program.cs index c089ce7..24b50d3 100644 --- a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Program.cs +++ b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Program.cs @@ -1,8 +1,4 @@ -using System.Windows; -using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Net.Http; +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using System.Threading.Tasks; namespace $safeprojectname$ @@ -13,19 +9,8 @@ public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); - - builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - var host = builder.Build(); await host.RunAsync(); } - - public static void RunApplication() - { - Application.RunApplication(() => - { - var app = new $ext_safeprojectname$.App(); - }); - } } } diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Properties/launchSettings.json b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Properties/launchSettings.json index 7b865db..990c3f6 100644 --- a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Properties/launchSettings.json +++ b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/Properties/launchSettings.json @@ -8,22 +8,23 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "$safeprojectname$": { + "commandName": "Project", + "dotnetRunMessages": true, "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "http://localhost:55592/" }, - "$safeprojectname$": { - "commandName": "Project", + "IIS Express": { + "commandName": "IISExpress", "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "http://localhost:55592/" + } } } } \ No newline at end of file diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/wwwroot/index.html b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/wwwroot/index.html index 411db66..0589c9e 100644 --- a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/wwwroot/index.html +++ b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/wwwroot/index.html @@ -4,40 +4,20 @@ $ext_safeprojectname$ - + $ext_modernloadingcolors$ -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
$ext_loadingindicatorhtml$
diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/wwwroot/loading-indicator.css b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/wwwroot/loading-indicator.css index af05e43..f85e049 100644 --- a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/wwwroot/loading-indicator.css +++ b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/wwwroot/loading-indicator.css @@ -20,12 +20,17 @@ } } +body { + margin: 0; +} + .loading-indicator-wrapper { display: flex; justify-content: center; align-items: center; width: 100vw; height: 100vh; + background-color: #f0f0f0; /* Lighter background */ } .loading-indicator { @@ -41,8 +46,8 @@ width: 16%; height: 16%; border-radius: 50%; - background: #41afe6; - filter: blur(4px); + background: #3b8eea; /* Light blue */ + filter: blur(3px); /* Slightly lighter blur */ opacity: 0; animation: loading-indicator-ball-anim 9s infinite; } @@ -154,4 +159,7 @@ .loading-indicator-text:after { content: var(--blazor-load-percentage-text, "Loading..."); + color: #555; /* Darker text for contrast */ + font-size: 1.2rem; + font-family: 'Arial', sans-serif; } diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/wwwroot/modern/loading-animation.js b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/wwwroot/modern/loading-animation.js new file mode 100644 index 0000000..8c79602 --- /dev/null +++ b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/wwwroot/modern/loading-animation.js @@ -0,0 +1,134 @@ +(function () { + function startLoader() { + const count = document.querySelector(".opensilver-odometer"); + const loader = document.querySelector(".opensilver-loader-progress-bar"); + + if (!count || !loader) return; + + loader.style.width = "0%"; + + const observer = new MutationObserver(updateCount); + function updateCount() { + const loadPercentageText = getComputedStyle(document.documentElement) + .getPropertyValue("--blazor-load-percentage-text") + .trim(); + const loadPercentage = parseInt(loadPercentageText.replace(/"/g, "")); + const currentValue = isNaN(loadPercentage) ? 0 : loadPercentage; + + animateCounter(currentValue); + loader.style.width = currentValue + "%"; + + if (currentValue === 100) { + observer.disconnect(); + return; + } + } + + observer.observe(document.documentElement, { + attributes: true, + attributeFilter: ["style"], + }); + + updateCount(); + } + + function animateCounter(newValue) { + newValue = Math.min(newValue, 100); + + const count = Array.from(document.querySelectorAll(".opensilver-odometer")); + const currentValue = count.map((span) => span.textContent).join(""); + const newValueString = String(newValue).padStart(3, "0"); + for (let i = 0; i < newValueString.length; i++) { + if (newValueString[i] !== currentValue[i]) { + gsap.to(count[i], { + y: -4, + opacity: 0.5, + duration: 0.075, + ease: "none", + onComplete: () => { + count[i].textContent = newValueString[i]; + gsap.fromTo( + count[i], + { y: 4, opacity: 0.5 }, + { y: 0, opacity: 1, duration: 0.075, ease: "none" } + ); + }, + }); + } + } + + if (newValue === 100 && currentValue !== "100") { + gsap.to(count[1], { + y: -4, + opacity: 0.5, + duration: 0.075, + ease: "none", + onComplete: () => { + count[1].textContent = "0"; + gsap.fromTo( + count[1], + { y: 4, opacity: 0.5 }, + { y: 0, opacity: 1, duration: 0.075, ease: "none" } + ); + }, + }); + + gsap.to(count[2], { + y: -4, + opacity: 0.5, + duration: 0.075, + ease: "none", + onComplete: () => { + count[2].textContent = "0"; + gsap.fromTo( + count[2], + { y: 4, opacity: 0.5 }, + { y: 0, opacity: 1, duration: 0.075, ease: "none" } + ); + }, + }); + } + } + + function onDomReady() { + startLoader(); + + function startAnimations() { + gsap.to(".opensilver-loader-progress", { + width: "60vw", + opacity: 1, + duration: 1.25, + ease: "power1.out", + delay: 0.4, + }); + + gsap.to(".opensilver-counter-container", { + opacity: 1, + duration: 0.3, + ease: "none", + delay: 1.1, + }); + + gsap.to(".opensilver-counter-container > .opensilver-odometer", { + transform: "translateY(0)", + duration: 0.3, + ease: "none", + delay: 1.1, + }); + } + + startAnimations(); + } + + const script = document.createElement('script'); + script.setAttribute('type', 'application/javascript'); + script.setAttribute('src', 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js'); + script.addEventListener('load', function () { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', onDomReady); + } else { + onDomReady(); + } + }); + document.head.appendChild(script); +})(); \ No newline at end of file diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/wwwroot/modern/loading-indicator.css b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/wwwroot/modern/loading-indicator.css new file mode 100644 index 0000000..5eb9e1e --- /dev/null +++ b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication.Browser/wwwroot/modern/loading-indicator.css @@ -0,0 +1,74 @@ + +html body { + background: var(--opensilver-loading-background-color); +} + +.opensilver-loading-indicator { + position: fixed; + top: 0; + left: 0; + display: flex; + justify-content: center; + align-items: center; + pointer-events: none; + height: 100vh; + width: 100vw; + overflow: hidden; + background: var(--opensilver-loading-background-color); +} + +.opensilver-loading-indicator .opensilver-loader-container { + display: flex; + justify-content: center; + align-items: center; + gap: 8px; +} + +.opensilver-loading-indicator .opensilver-loader { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 10px; + width: 100%; + height: 100%; + margin-left: 20px; +} + +.opensilver-loading-indicator .opensilver-loader-progress { + display: flex; + justify-content: flex-start; + align-items: center; + width: 0; + max-width: 200px; + height: 4px; + border-radius: 12px; + background-color: var(--opensilver-loading-progress-bg); +} + +.opensilver-loading-indicator .opensilver-loader-progress-bar { + width: 0%; + height: 5px; + border-radius: 12px; + background-color: var(--opensilver-loading-progress-bar-color); + transition: width 0.75s ease; +} + +.opensilver-loading-indicator .opensilver-counter-container { + align-self: end; + display: flex; + justify-content: end; + align-items: center; + font-family: sans-serif; + font-size: clamp(0.8rem, 1.4vw, 1.6rem); + font-weight: 500; + width: 100%; + min-width: 26px; + line-height: 1; + gap: 1px; + color: var(--opensilver-loading-counter-color); +} + +.opensilver-loading-indicator .opensilver-counter-container > .opensilver-odometer { + transform: translateY(4px); +} diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/App.xaml b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/App.xaml index b9ec891..7266969 100644 --- a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/App.xaml +++ b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/App.xaml @@ -8,4 +8,5 @@ +$ext_appxamltheme$ diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/MainPage.xaml b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/MainPage.xaml index 0c16c99..2fdcd6e 100644 --- a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/MainPage.xaml +++ b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/MainPage.xaml @@ -4,9 +4,10 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:$ext_safeprojectname$" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d"> + mc:Ignorable="d" + Foreground="$ext_pageforeground$"> - + diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/OpenSilverApplication.vbproj b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/OpenSilverApplication.vbproj index 73675ad..7dc2066 100644 --- a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/OpenSilverApplication.vbproj +++ b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/OpenSilverApplication.vbproj @@ -7,7 +7,7 @@ - + $ext_themesnugetpackage$ diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/OpenSilverApplication.vstemplate b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/OpenSilverApplication.vstemplate index c97ff12..025b758 100644 --- a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/OpenSilverApplication.vstemplate +++ b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/OpenSilverApplication.vstemplate @@ -9,9 +9,6 @@ App.xaml.vb MainPage.xaml MainPage.xaml.vb - - launchSettings.json - \ No newline at end of file diff --git a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/Properties/launchSettings.json b/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/Properties/launchSettings.json deleted file mode 100644 index c6f934e..0000000 --- a/src/OpenSilverVBApplicationTemplate/OpenSilverVBApplication/Properties/launchSettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "profiles": { - "$ext_safeprojectname$": { - "commandName": "Executable", - "executablePath": "cmd", - "commandLineArgs": "/c start \"\" \"http://www.opensilver.net/permalinks/wrong_startup_project.aspx\"" - } - } -} \ No newline at end of file diff --git a/src/OpenSilverVBClassLibraryTemplate/OpenSilverClassLibrary.vbproj b/src/OpenSilverVBClassLibraryTemplate/OpenSilverClassLibrary.vbproj index d0184a3..e20ba36 100644 --- a/src/OpenSilverVBClassLibraryTemplate/OpenSilverClassLibrary.vbproj +++ b/src/OpenSilverVBClassLibraryTemplate/OpenSilverClassLibrary.vbproj @@ -7,7 +7,7 @@ - +