diff --git a/ShellDemo/ShellDemo.csproj b/ShellDemo/ShellDemo.csproj index 24f007d..73aec0d 100644 --- a/ShellDemo/ShellDemo.csproj +++ b/ShellDemo/ShellDemo.csproj @@ -12,17 +12,24 @@ com.openmaui.shelldemo 1.0.0 - - true + true true + - + + + true + net9.0-android;net9.0-ios;net9.0-maccatalyst;net9.0-windows10.0.19041.0 + + + + linux-x64;linux-arm64 - - + + diff --git a/ShellDemo/run.sh b/ShellDemo/run.sh new file mode 100755 index 0000000..c198116 --- /dev/null +++ b/ShellDemo/run.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Set .NET environment for desktop launcher compatibility +export DOTNET_ROOT="$HOME/.dotnet" +export PATH="$DOTNET_ROOT:$PATH" + +cd "$(dirname "$0")/bin/Debug/net9.0" +exec ./ShellDemo "$@" diff --git a/TodoApp/TodoApp.csproj b/TodoApp/TodoApp.csproj index ced557b..e1ea4d9 100644 --- a/TodoApp/TodoApp.csproj +++ b/TodoApp/TodoApp.csproj @@ -12,17 +12,24 @@ com.openmaui.todoapp 1.0.0 - - true + true true + - + + + true + net9.0-android;net9.0-ios;net9.0-maccatalyst;net9.0-windows10.0.19041.0 + + + + linux-x64;linux-arm64 - - + + diff --git a/TodoApp/run.sh b/TodoApp/run.sh new file mode 100755 index 0000000..b571003 --- /dev/null +++ b/TodoApp/run.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Set .NET environment for desktop launcher compatibility +export DOTNET_ROOT="$HOME/.dotnet" +export PATH="$DOTNET_ROOT:$PATH" + +cd "$(dirname "$0")/bin/Debug/net9.0" +exec ./TodoApp "$@" diff --git a/WebViewDemo/App.xaml.cs b/WebViewDemo/App.xaml.cs index b792f50..bd34ee1 100644 --- a/WebViewDemo/App.xaml.cs +++ b/WebViewDemo/App.xaml.cs @@ -1,4 +1,4 @@ -// App.xaml.cs - Main Application with NavigationPage and Theme Support +// App.xaml.cs - Main Application with Theme Support using Microsoft.Maui.Controls; @@ -6,8 +6,6 @@ namespace WebViewDemo; public partial class App : Application { - public static NavigationPage? NavigationPage { get; private set; } - public App() { InitializeComponent(); @@ -15,24 +13,18 @@ public partial class App : Application protected override Window CreateWindow(IActivationState? activationState) { - // Determine current theme for navigation bar colors - var isDarkMode = Current?.RequestedTheme == AppTheme.Dark; - var barBackground = isDarkMode ? Color.FromArgb("#3949AB") : Color.FromArgb("#5C6BC0"); - - NavigationPage = new NavigationPage(new WebViewPage()) + return new Window(new WebViewPage()) { - Title = "OpenMaui WebView Demo", - BarBackgroundColor = barBackground, - BarTextColor = Colors.White + Title = "OpenMaui Browser" }; + } - // Update navigation bar when theme changes - Current!.RequestedThemeChanged += (s, e) => - { - var dark = e.RequestedTheme == AppTheme.Dark; - NavigationPage.BarBackgroundColor = dark ? Color.FromArgb("#3949AB") : Color.FromArgb("#5C6BC0"); - }; + public static void ToggleTheme() + { + if (Current is null) return; - return new Window(NavigationPage); + Current.UserAppTheme = Current.UserAppTheme == AppTheme.Dark + ? AppTheme.Light + : AppTheme.Dark; } } diff --git a/WebViewDemo/Pages/WebViewPage.xaml b/WebViewDemo/Pages/WebViewPage.xaml index 1a4e97e..fe2b924 100644 --- a/WebViewDemo/Pages/WebViewPage.xaml +++ b/WebViewDemo/Pages/WebViewPage.xaml @@ -2,14 +2,13 @@ @@ -22,6 +21,7 @@ HeightRequest="36" Padding="8" BackgroundColor="Transparent" + VerticalOptions="Center" Clicked="OnBackClicked" ToolTipProperties.Text="Go Back" /> @@ -33,6 +33,7 @@ HeightRequest="36" Padding="8" BackgroundColor="Transparent" + VerticalOptions="Center" Clicked="OnForwardClicked" ToolTipProperties.Text="Go Forward" /> @@ -44,6 +45,7 @@ HeightRequest="36" Padding="8" BackgroundColor="Transparent" + VerticalOptions="Center" Clicked="OnReloadClicked" ToolTipProperties.Text="Reload Page" /> @@ -53,7 +55,8 @@ StrokeThickness="1" Stroke="{AppThemeBinding Light={StaticResource BorderLight}, Dark={StaticResource BorderDark}}" Padding="8,4" - Margin="4,0"> + Margin="4,0" + VerticalOptions="Center"> @@ -78,6 +81,7 @@ Padding="8" BackgroundColor="{StaticResource AccentColor}" CornerRadius="18" + VerticalOptions="Center" Clicked="OnGoClicked" ToolTipProperties.Text="Navigate" /> @@ -89,6 +93,7 @@ HeightRequest="36" Padding="8" BackgroundColor="Transparent" + VerticalOptions="Center" Clicked="OnLoadHtmlClicked" ToolTipProperties.Text="Load Demo HTML" /> @@ -100,8 +105,21 @@ HeightRequest="36" Padding="8" BackgroundColor="Transparent" + VerticalOptions="Center" Clicked="OnEvalJsClicked" ToolTipProperties.Text="Run JavaScript" /> + + + diff --git a/WebViewDemo/Pages/WebViewPage.xaml.cs b/WebViewDemo/Pages/WebViewPage.xaml.cs index be3272c..6309554 100644 --- a/WebViewDemo/Pages/WebViewPage.xaml.cs +++ b/WebViewDemo/Pages/WebViewPage.xaml.cs @@ -249,4 +249,20 @@ public partial class WebViewPage : ContentPage Console.WriteLine($"[WebViewPage] JS Error: {ex.Message}"); } } + + private void OnThemeToggleClicked(object? sender, EventArgs e) + { + Console.WriteLine("[WebViewPage] Theme toggle clicked"); + Console.WriteLine($"[WebViewPage] Before: UserAppTheme={Application.Current?.UserAppTheme}, RequestedTheme={Application.Current?.RequestedTheme}"); + + App.ToggleTheme(); + + Console.WriteLine($"[WebViewPage] After: UserAppTheme={Application.Current?.UserAppTheme}, RequestedTheme={Application.Current?.RequestedTheme}"); + + var theme = Application.Current?.UserAppTheme == AppTheme.Dark ? "Dark" : "Light"; + StatusLabel.Text = $"Theme: {theme}"; + + // Debug: Check what the ImageButton Source is now + Console.WriteLine($"[WebViewPage] ThemeToggleButton.Source = {ThemeToggleButton.Source}"); + } } diff --git a/WebViewDemo/Resources/Images/arrow_back_dark.svg b/WebViewDemo/Resources/Images/arrow_back_dark.svg index 5687c18..4bf1a98 100644 --- a/WebViewDemo/Resources/Images/arrow_back_dark.svg +++ b/WebViewDemo/Resources/Images/arrow_back_dark.svg @@ -1 +1,3 @@ - + + + diff --git a/WebViewDemo/Resources/Images/arrow_back_light.svg b/WebViewDemo/Resources/Images/arrow_back_light.svg index b7460b1..e044fc9 100644 --- a/WebViewDemo/Resources/Images/arrow_back_light.svg +++ b/WebViewDemo/Resources/Images/arrow_back_light.svg @@ -1 +1,3 @@ - + + + diff --git a/WebViewDemo/Resources/Images/arrow_forward_dark.svg b/WebViewDemo/Resources/Images/arrow_forward_dark.svg index c010393..0951608 100644 --- a/WebViewDemo/Resources/Images/arrow_forward_dark.svg +++ b/WebViewDemo/Resources/Images/arrow_forward_dark.svg @@ -1 +1,3 @@ - + + + diff --git a/WebViewDemo/Resources/Images/arrow_forward_light.svg b/WebViewDemo/Resources/Images/arrow_forward_light.svg index e555ac3..6d09b60 100644 --- a/WebViewDemo/Resources/Images/arrow_forward_light.svg +++ b/WebViewDemo/Resources/Images/arrow_forward_light.svg @@ -1 +1,3 @@ - + + + diff --git a/WebViewDemo/Resources/Images/code_dark.svg b/WebViewDemo/Resources/Images/code_dark.svg index fe9b690..3fac9b2 100644 --- a/WebViewDemo/Resources/Images/code_dark.svg +++ b/WebViewDemo/Resources/Images/code_dark.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + diff --git a/WebViewDemo/Resources/Images/code_light.svg b/WebViewDemo/Resources/Images/code_light.svg index d92782a..5ec615e 100644 --- a/WebViewDemo/Resources/Images/code_light.svg +++ b/WebViewDemo/Resources/Images/code_light.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + diff --git a/WebViewDemo/Resources/Images/dark_mode.svg b/WebViewDemo/Resources/Images/dark_mode.svg new file mode 100644 index 0000000..542282b --- /dev/null +++ b/WebViewDemo/Resources/Images/dark_mode.svg @@ -0,0 +1,3 @@ + + + diff --git a/WebViewDemo/Resources/Images/light_mode.svg b/WebViewDemo/Resources/Images/light_mode.svg new file mode 100644 index 0000000..22b42e6 --- /dev/null +++ b/WebViewDemo/Resources/Images/light_mode.svg @@ -0,0 +1,3 @@ + + + diff --git a/WebViewDemo/Resources/Images/play_arrow_dark.svg b/WebViewDemo/Resources/Images/play_arrow_dark.svg index 4b84d66..db9f06d 100644 --- a/WebViewDemo/Resources/Images/play_arrow_dark.svg +++ b/WebViewDemo/Resources/Images/play_arrow_dark.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + diff --git a/WebViewDemo/Resources/Images/play_arrow_light.svg b/WebViewDemo/Resources/Images/play_arrow_light.svg index d393f01..61eb73b 100644 --- a/WebViewDemo/Resources/Images/play_arrow_light.svg +++ b/WebViewDemo/Resources/Images/play_arrow_light.svg @@ -1 +1,3 @@ - \ No newline at end of file + + + diff --git a/WebViewDemo/Resources/Images/refresh_dark.svg b/WebViewDemo/Resources/Images/refresh_dark.svg index 57aa697..8757c72 100644 --- a/WebViewDemo/Resources/Images/refresh_dark.svg +++ b/WebViewDemo/Resources/Images/refresh_dark.svg @@ -1 +1,3 @@ - + + + diff --git a/WebViewDemo/Resources/Images/refresh_light.svg b/WebViewDemo/Resources/Images/refresh_light.svg index 1726529..c50f915 100644 --- a/WebViewDemo/Resources/Images/refresh_light.svg +++ b/WebViewDemo/Resources/Images/refresh_light.svg @@ -1 +1,3 @@ - + + + diff --git a/WebViewDemo/Resources/Images/send_dark.svg b/WebViewDemo/Resources/Images/send_dark.svg index 73c4883..866c191 100644 --- a/WebViewDemo/Resources/Images/send_dark.svg +++ b/WebViewDemo/Resources/Images/send_dark.svg @@ -1 +1,3 @@ - + + + diff --git a/WebViewDemo/Resources/Images/send_light.svg b/WebViewDemo/Resources/Images/send_light.svg index 184dd8f..866c191 100644 --- a/WebViewDemo/Resources/Images/send_light.svg +++ b/WebViewDemo/Resources/Images/send_light.svg @@ -1 +1,3 @@ - + + + diff --git a/WebViewDemo/WebViewDemo.csproj b/WebViewDemo/WebViewDemo.csproj index fbc1aed..79df46c 100644 --- a/WebViewDemo/WebViewDemo.csproj +++ b/WebViewDemo/WebViewDemo.csproj @@ -12,17 +12,24 @@ com.openmaui.webviewdemo 1.0.0 - - true + true true + - + + + true + net9.0-android;net9.0-ios;net9.0-maccatalyst;net9.0-windows10.0.19041.0 + + + + linux-x64;linux-arm64 - - + + @@ -31,9 +38,12 @@ - + - + + + + diff --git a/WebViewDemo/run.sh b/WebViewDemo/run.sh new file mode 100755 index 0000000..0441137 --- /dev/null +++ b/WebViewDemo/run.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Set .NET environment for desktop launcher compatibility +export DOTNET_ROOT="$HOME/.dotnet" +export PATH="$DOTNET_ROOT:$PATH" + +cd "$(dirname "$0")/bin/Debug/net9.0" +exec ./WebViewDemo "$@" diff --git "a/windowhandler\\|mapcontent" "b/windowhandler\\|mapcontent" new file mode 100644 index 0000000..a630a7f --- /dev/null +++ "b/windowhandler\\|mapcontent" @@ -0,0 +1,5 @@ +sleep: invalid time interval ‘cd’ +sleep: invalid time interval ‘/home/friedel/Documents/Gitea/maui-linux-samples/ShellDemo/bin/Debug/net9.0’ +sleep: invalid time interval ‘timeout’ +sleep: invalid time interval ‘./ShellDemo’ +Try 'sleep --help' for more information.