From a5b29a30f28fd9d9efe2f792fe1a4ebc63a1506e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Barrera?= Date: Sat, 30 Apr 2022 11:03:31 +0200 Subject: [PATCH 1/3] migrate RC2 --- NethereumExplorer.Maui/App.xaml.cs | 20 ++--- NethereumExplorer.Maui/GlobalUsings.cs | 9 +++ NethereumExplorer.Maui/MainPage.xaml.cs | 12 +-- NethereumExplorer.Maui/MauiProgram.cs | 75 ++++--------------- .../NethereumExplorer.Maui.csproj | 24 +----- .../Platforms/MacCatalyst/AppDelegate.cs | 11 ++- .../Platforms/MacCatalyst/Program.cs | 17 ++--- .../Platforms/Windows/App.xaml | 3 +- .../Platforms/Windows/App.xaml.cs | 39 ++++------ .../Platforms/Windows/Package.appxmanifest | 24 +----- .../Platforms/iOS/AppDelegate.cs | 11 ++- .../Platforms/iOS/Program.cs | 17 ++--- NethereumExplorer.Maui/ServicesExtensions.cs | 44 +++++++++++ 13 files changed, 123 insertions(+), 183 deletions(-) create mode 100644 NethereumExplorer.Maui/GlobalUsings.cs create mode 100644 NethereumExplorer.Maui/ServicesExtensions.cs diff --git a/NethereumExplorer.Maui/App.xaml.cs b/NethereumExplorer.Maui/App.xaml.cs index 6c8cc1d..dfce5b1 100644 --- a/NethereumExplorer.Maui/App.xaml.cs +++ b/NethereumExplorer.Maui/App.xaml.cs @@ -1,17 +1,11 @@ -using Microsoft.Maui; -using Microsoft.Maui.Controls; -using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific; -using Application = Microsoft.Maui.Controls.Application; +namespace NethereumExplorer.Maui; -namespace NethereumExplorer.Maui +public partial class App : Application { - public partial class App : Application - { - public App() - { - InitializeComponent(); + public App() + { + InitializeComponent(); - MainPage = new MainPage(); - } - } + MainPage = new MainPage(); + } } diff --git a/NethereumExplorer.Maui/GlobalUsings.cs b/NethereumExplorer.Maui/GlobalUsings.cs new file mode 100644 index 0000000..f25dc10 --- /dev/null +++ b/NethereumExplorer.Maui/GlobalUsings.cs @@ -0,0 +1,9 @@ +global using System; +global using Microsoft.Maui; +global using Microsoft.Maui.Controls; +global using Microsoft.Maui.Hosting; +global using Microsoft.Maui.Controls.Hosting; +global using Blazor.FlexGrid; +global using Microsoft.Extensions.DependencyInjection; +global using NethereumExplorer.Services; +global using NethereumExplorer.ViewModels; \ No newline at end of file diff --git a/NethereumExplorer.Maui/MainPage.xaml.cs b/NethereumExplorer.Maui/MainPage.xaml.cs index 8bb820e..4bcdcaf 100644 --- a/NethereumExplorer.Maui/MainPage.xaml.cs +++ b/NethereumExplorer.Maui/MainPage.xaml.cs @@ -1,13 +1,9 @@ -using System; -using Microsoft.Maui.Controls; +namespace NethereumExplorer.Maui; -namespace NethereumExplorer.Maui +public partial class MainPage : ContentPage { - public partial class MainPage : ContentPage + public MainPage() { - public MainPage() - { - InitializeComponent(); - } + InitializeComponent(); } } diff --git a/NethereumExplorer.Maui/MauiProgram.cs b/NethereumExplorer.Maui/MauiProgram.cs index cb14556..c1a885e 100644 --- a/NethereumExplorer.Maui/MauiProgram.cs +++ b/NethereumExplorer.Maui/MauiProgram.cs @@ -1,66 +1,19 @@ -using Microsoft.AspNetCore.Components.WebView.Maui; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Maui; -using Microsoft.Maui.Hosting; -using Microsoft.Maui.Controls.Compatibility; -using Microsoft.Maui.Controls.Hosting; -using NethereumExplorer.Services; -using NethereumExplorer.ViewModels; -using Blazor.FlexGrid; -using System.Net.Http; +namespace NethereumExplorer.Maui; -namespace NethereumExplorer.Maui +public static class MauiProgram { - public static class MauiProgram - { - public static MauiApp CreateMauiApp() - { - - var builder = MauiApp.CreateBuilder(); - builder - .RegisterBlazorMauiWebView() - .UseMauiApp() - .ConfigureFonts(fonts => - { - fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); - }); + public static MauiApp CreateMauiApp() + { - builder.Services.AddBlazorWebView(); - - var services = builder.Services; - - var web3ServiceProvider = new Web3ProviderService(); - var accountsService = new AccountsService(web3ServiceProvider); - var newBlockProcessingService = new NewBlockProcessingService(web3ServiceProvider); - var toastsViewModel = new ToastsViewModel(); - var blocksViewModel = new BlocksViewModel(newBlockProcessingService); - var latestBlockTransactionsViewModel = new LatestBlockTransactionsViewModel(web3ServiceProvider); - var newAccountPrivateKeyViewModel = new NewAccountPrivateKeyViewModel(); - var accountsViewModel = new AccountsViewModel(accountsService, newAccountPrivateKeyViewModel); - var accountsTransactionMonitoringService = new AccountsTransactionMonitoringService(accountsService, web3ServiceProvider); - - services.AddSingleton((x) => web3ServiceProvider); - services.AddSingleton((x) => accountsService); - services.AddSingleton(newBlockProcessingService); - services.AddSingleton(toastsViewModel); - services.AddSingleton(blocksViewModel); - services.AddSingleton(latestBlockTransactionsViewModel); - services.AddTransient(); - services.AddSingleton(accountsViewModel); - services.AddSingleton(newAccountPrivateKeyViewModel); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(accountsTransactionMonitoringService); - services.AddSingleton(); - services.AddSingleton(); - - - services.AddFlexGrid(cfg => + var builder = MauiApp.CreateBuilder(); + builder + .UseMauiApp() + .ConfigureFonts(fonts => { - cfg.ApplyConfiguration(new TransactionsViewModelGridConfiguration()); - }); + fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); + }) + .ConfigureServices(); - return builder.Build(); - } - } -} + return builder.Build(); + } +} \ No newline at end of file diff --git a/NethereumExplorer.Maui/NethereumExplorer.Maui.csproj b/NethereumExplorer.Maui/NethereumExplorer.Maui.csproj index 60f58d0..8e9669a 100644 --- a/NethereumExplorer.Maui/NethereumExplorer.Maui.csproj +++ b/NethereumExplorer.Maui/NethereumExplorer.Maui.csproj @@ -16,6 +16,7 @@ com.companyname.NethereumExplorer.Maui + 1.0 1 @@ -24,7 +25,8 @@ 14.2 14.0 21.0 - 10.0.18362.0 + 10.0.17763.0 + 10.0.17763.0 @@ -40,17 +42,6 @@ - - - - - - - - - WinExe - win-x64 - @@ -67,15 +58,6 @@ - - - - - - - - - diff --git a/NethereumExplorer.Maui/Platforms/MacCatalyst/AppDelegate.cs b/NethereumExplorer.Maui/Platforms/MacCatalyst/AppDelegate.cs index 0d4cf4b..a0cba02 100644 --- a/NethereumExplorer.Maui/Platforms/MacCatalyst/AppDelegate.cs +++ b/NethereumExplorer.Maui/Platforms/MacCatalyst/AppDelegate.cs @@ -2,11 +2,10 @@ using Microsoft.Maui; using Microsoft.Maui.Hosting; -namespace NethereumExplorer.Maui +namespace NethereumExplorer.Maui; + +[Register("AppDelegate")] +public class AppDelegate : MauiUIApplicationDelegate { - [Register("AppDelegate")] - public class AppDelegate : MauiUIApplicationDelegate - { - protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); - } + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); } \ No newline at end of file diff --git a/NethereumExplorer.Maui/Platforms/MacCatalyst/Program.cs b/NethereumExplorer.Maui/Platforms/MacCatalyst/Program.cs index 6bb35af..da797c2 100644 --- a/NethereumExplorer.Maui/Platforms/MacCatalyst/Program.cs +++ b/NethereumExplorer.Maui/Platforms/MacCatalyst/Program.cs @@ -1,15 +1,14 @@ using UIKit; -namespace NethereumExplorer.Maui +namespace NethereumExplorer.Maui; + +public class Program { - public class Program + // This is the main entry point of the application. + static void Main(string[] args) { - // This is the main entry point of the application. - static void Main(string[] args) - { - // if you want to use a different Application Delegate class from "AppDelegate" - // you can specify it here. - UIApplication.Main(args, null, typeof(AppDelegate)); - } + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); } } \ No newline at end of file diff --git a/NethereumExplorer.Maui/Platforms/Windows/App.xaml b/NethereumExplorer.Maui/Platforms/Windows/App.xaml index 82577b3..8e84463 100644 --- a/NethereumExplorer.Maui/Platforms/Windows/App.xaml +++ b/NethereumExplorer.Maui/Platforms/Windows/App.xaml @@ -2,7 +2,6 @@ x:Class="NethereumExplorer.Maui.WinUI.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:maui="using:Microsoft.Maui" - xmlns:local="using:NethereumExplorer.Maui.WinUI"> + xmlns:maui="using:Microsoft.Maui"> diff --git a/NethereumExplorer.Maui/Platforms/Windows/App.xaml.cs b/NethereumExplorer.Maui/Platforms/Windows/App.xaml.cs index 7841e04..6ddc6e6 100644 --- a/NethereumExplorer.Maui/Platforms/Windows/App.xaml.cs +++ b/NethereumExplorer.Maui/Platforms/Windows/App.xaml.cs @@ -1,34 +1,21 @@ -using Microsoft.Maui; -using Microsoft.Maui.Hosting; -using Microsoft.UI.Xaml; -using Windows.ApplicationModel; - -// To learn more about WinUI, the WinUI project structure, +// To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. -namespace NethereumExplorer.Maui.WinUI +namespace NethereumExplorer.Maui.WinUI; + +/// +/// Provides application-specific behavior to supplement the default Application class. +/// +public partial class App : MauiWinUIApplication { /// - /// Provides application-specific behavior to supplement the default Application class. + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). /// - public partial class App : MauiWinUIApplication + public App() { - /// - /// Initializes the singleton application object. This is the first line of authored code - /// executed, and as such is the logical equivalent of main() or WinMain(). - /// - public App() - { - this.InitializeComponent(); - } - - protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); - - protected override void OnLaunched(LaunchActivatedEventArgs args) - { - base.OnLaunched(args); - - Microsoft.Maui.Essentials.Platform.OnLaunched(args); - } + this.InitializeComponent(); } + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); } diff --git a/NethereumExplorer.Maui/Platforms/Windows/Package.appxmanifest b/NethereumExplorer.Maui/Platforms/Windows/Package.appxmanifest index 5eb27e3..07ea51c 100644 --- a/NethereumExplorer.Maui/Platforms/Windows/Package.appxmanifest +++ b/NethereumExplorer.Maui/Platforms/Windows/Package.appxmanifest @@ -14,7 +14,6 @@ NethereumExplorer.Maui Microsoft - Assets\appiconStoreLogo.png @@ -27,27 +26,8 @@ - - - - - - - - - - + + diff --git a/NethereumExplorer.Maui/Platforms/iOS/AppDelegate.cs b/NethereumExplorer.Maui/Platforms/iOS/AppDelegate.cs index 0d4cf4b..a0cba02 100644 --- a/NethereumExplorer.Maui/Platforms/iOS/AppDelegate.cs +++ b/NethereumExplorer.Maui/Platforms/iOS/AppDelegate.cs @@ -2,11 +2,10 @@ using Microsoft.Maui; using Microsoft.Maui.Hosting; -namespace NethereumExplorer.Maui +namespace NethereumExplorer.Maui; + +[Register("AppDelegate")] +public class AppDelegate : MauiUIApplicationDelegate { - [Register("AppDelegate")] - public class AppDelegate : MauiUIApplicationDelegate - { - protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); - } + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); } \ No newline at end of file diff --git a/NethereumExplorer.Maui/Platforms/iOS/Program.cs b/NethereumExplorer.Maui/Platforms/iOS/Program.cs index 6bb35af..da797c2 100644 --- a/NethereumExplorer.Maui/Platforms/iOS/Program.cs +++ b/NethereumExplorer.Maui/Platforms/iOS/Program.cs @@ -1,15 +1,14 @@ using UIKit; -namespace NethereumExplorer.Maui +namespace NethereumExplorer.Maui; + +public class Program { - public class Program + // This is the main entry point of the application. + static void Main(string[] args) { - // This is the main entry point of the application. - static void Main(string[] args) - { - // if you want to use a different Application Delegate class from "AppDelegate" - // you can specify it here. - UIApplication.Main(args, null, typeof(AppDelegate)); - } + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); } } \ No newline at end of file diff --git a/NethereumExplorer.Maui/ServicesExtensions.cs b/NethereumExplorer.Maui/ServicesExtensions.cs new file mode 100644 index 0000000..7242dd4 --- /dev/null +++ b/NethereumExplorer.Maui/ServicesExtensions.cs @@ -0,0 +1,44 @@ +namespace NethereumExplorer.Maui; + +internal static class ServicesExtensions +{ + public static MauiAppBuilder ConfigureServices(this MauiAppBuilder builder) + { + var services = builder.Services; + + services.AddMauiBlazorWebView(); + + var web3ServiceProvider = new Web3ProviderService(); + var accountsService = new AccountsService(web3ServiceProvider); + var newBlockProcessingService = new NewBlockProcessingService(web3ServiceProvider); + var toastsViewModel = new ToastsViewModel(); + var blocksViewModel = new BlocksViewModel(newBlockProcessingService); + var latestBlockTransactionsViewModel = new LatestBlockTransactionsViewModel(web3ServiceProvider); + var newAccountPrivateKeyViewModel = new NewAccountPrivateKeyViewModel(); + var accountsViewModel = new AccountsViewModel(accountsService, newAccountPrivateKeyViewModel); + var accountsTransactionMonitoringService = new AccountsTransactionMonitoringService(accountsService, web3ServiceProvider); + + services.AddSingleton((x) => web3ServiceProvider); + services.AddSingleton((x) => accountsService); + services.AddSingleton(newBlockProcessingService); + services.AddSingleton(toastsViewModel); + services.AddSingleton(blocksViewModel); + services.AddSingleton(latestBlockTransactionsViewModel); + services.AddTransient(); + services.AddSingleton(accountsViewModel); + services.AddSingleton(newAccountPrivateKeyViewModel); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(accountsTransactionMonitoringService); + services.AddSingleton(); + services.AddSingleton(); + + + services.AddFlexGrid(cfg => + { + cfg.ApplyConfiguration(new TransactionsViewModelGridConfiguration()); + }); + + return builder; + } +} From d1aa993c78744c5a81b76e31ad5a1b187f26c393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Barrera?= Date: Sat, 30 Apr 2022 11:41:55 +0200 Subject: [PATCH 2/3] add tizen platform --- .../NethereumExplorer.Maui.csproj | 3 +++ NethereumExplorer.Maui/Platforms/Tizen/Main.cs | 16 ++++++++++++++++ .../Platforms/Tizen/tizen-manifest.xml | 15 +++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 NethereumExplorer.Maui/Platforms/Tizen/Main.cs create mode 100644 NethereumExplorer.Maui/Platforms/Tizen/tizen-manifest.xml diff --git a/NethereumExplorer.Maui/NethereumExplorer.Maui.csproj b/NethereumExplorer.Maui/NethereumExplorer.Maui.csproj index 8e9669a..0d41bad 100644 --- a/NethereumExplorer.Maui/NethereumExplorer.Maui.csproj +++ b/NethereumExplorer.Maui/NethereumExplorer.Maui.csproj @@ -3,6 +3,8 @@ net6.0-ios;net6.0-android;net6.0-maccatalyst $(TargetFrameworks);net6.0-windows10.0.19041 + + Exe NethereumExplorer.Maui true @@ -27,6 +29,7 @@ 21.0 10.0.17763.0 10.0.17763.0 + 6.5 diff --git a/NethereumExplorer.Maui/Platforms/Tizen/Main.cs b/NethereumExplorer.Maui/Platforms/Tizen/Main.cs new file mode 100644 index 0000000..03f5979 --- /dev/null +++ b/NethereumExplorer.Maui/Platforms/Tizen/Main.cs @@ -0,0 +1,16 @@ +using System; +using Microsoft.Maui; +using Microsoft.Maui.Hosting; + +namespace NethereumExplorer.Maui; + +class Program : MauiApplication +{ + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + + static void Main(string[] args) + { + var app = new Program(); + app.Run(args); + } +} diff --git a/NethereumExplorer.Maui/Platforms/Tizen/tizen-manifest.xml b/NethereumExplorer.Maui/Platforms/Tizen/tizen-manifest.xml new file mode 100644 index 0000000..6ee42ee --- /dev/null +++ b/NethereumExplorer.Maui/Platforms/Tizen/tizen-manifest.xml @@ -0,0 +1,15 @@ + + + + + + appicon.xhigh.png + + + + + http://tizen.org/privilege/internet + + + + \ No newline at end of file From 57e0ce858c8683956742fd2856a292e4a36b1af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Barrera?= Date: Sat, 30 Apr 2022 11:03:31 +0200 Subject: [PATCH 3/3] migrate RC2 --- NethereumExplorer.Maui/App.xaml.cs | 20 ++--- NethereumExplorer.Maui/GlobalUsings.cs | 9 +++ NethereumExplorer.Maui/MainPage.xaml.cs | 12 +-- NethereumExplorer.Maui/MauiProgram.cs | 75 ++++--------------- .../NethereumExplorer.Maui.csproj | 30 ++------ .../Platforms/MacCatalyst/AppDelegate.cs | 11 ++- .../Platforms/MacCatalyst/Program.cs | 17 ++--- .../Platforms/Windows/App.xaml | 3 +- .../Platforms/Windows/App.xaml.cs | 39 ++++------ .../Platforms/Windows/Package.appxmanifest | 24 +----- .../Platforms/iOS/AppDelegate.cs | 11 ++- .../Platforms/iOS/Program.cs | 17 ++--- NethereumExplorer.Maui/ServicesExtensions.cs | 44 +++++++++++ 13 files changed, 126 insertions(+), 186 deletions(-) create mode 100644 NethereumExplorer.Maui/GlobalUsings.cs create mode 100644 NethereumExplorer.Maui/ServicesExtensions.cs diff --git a/NethereumExplorer.Maui/App.xaml.cs b/NethereumExplorer.Maui/App.xaml.cs index 6c8cc1d..dfce5b1 100644 --- a/NethereumExplorer.Maui/App.xaml.cs +++ b/NethereumExplorer.Maui/App.xaml.cs @@ -1,17 +1,11 @@ -using Microsoft.Maui; -using Microsoft.Maui.Controls; -using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific; -using Application = Microsoft.Maui.Controls.Application; +namespace NethereumExplorer.Maui; -namespace NethereumExplorer.Maui +public partial class App : Application { - public partial class App : Application - { - public App() - { - InitializeComponent(); + public App() + { + InitializeComponent(); - MainPage = new MainPage(); - } - } + MainPage = new MainPage(); + } } diff --git a/NethereumExplorer.Maui/GlobalUsings.cs b/NethereumExplorer.Maui/GlobalUsings.cs new file mode 100644 index 0000000..f25dc10 --- /dev/null +++ b/NethereumExplorer.Maui/GlobalUsings.cs @@ -0,0 +1,9 @@ +global using System; +global using Microsoft.Maui; +global using Microsoft.Maui.Controls; +global using Microsoft.Maui.Hosting; +global using Microsoft.Maui.Controls.Hosting; +global using Blazor.FlexGrid; +global using Microsoft.Extensions.DependencyInjection; +global using NethereumExplorer.Services; +global using NethereumExplorer.ViewModels; \ No newline at end of file diff --git a/NethereumExplorer.Maui/MainPage.xaml.cs b/NethereumExplorer.Maui/MainPage.xaml.cs index 8bb820e..4bcdcaf 100644 --- a/NethereumExplorer.Maui/MainPage.xaml.cs +++ b/NethereumExplorer.Maui/MainPage.xaml.cs @@ -1,13 +1,9 @@ -using System; -using Microsoft.Maui.Controls; +namespace NethereumExplorer.Maui; -namespace NethereumExplorer.Maui +public partial class MainPage : ContentPage { - public partial class MainPage : ContentPage + public MainPage() { - public MainPage() - { - InitializeComponent(); - } + InitializeComponent(); } } diff --git a/NethereumExplorer.Maui/MauiProgram.cs b/NethereumExplorer.Maui/MauiProgram.cs index cb14556..c1a885e 100644 --- a/NethereumExplorer.Maui/MauiProgram.cs +++ b/NethereumExplorer.Maui/MauiProgram.cs @@ -1,66 +1,19 @@ -using Microsoft.AspNetCore.Components.WebView.Maui; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Maui; -using Microsoft.Maui.Hosting; -using Microsoft.Maui.Controls.Compatibility; -using Microsoft.Maui.Controls.Hosting; -using NethereumExplorer.Services; -using NethereumExplorer.ViewModels; -using Blazor.FlexGrid; -using System.Net.Http; +namespace NethereumExplorer.Maui; -namespace NethereumExplorer.Maui +public static class MauiProgram { - public static class MauiProgram - { - public static MauiApp CreateMauiApp() - { - - var builder = MauiApp.CreateBuilder(); - builder - .RegisterBlazorMauiWebView() - .UseMauiApp() - .ConfigureFonts(fonts => - { - fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); - }); + public static MauiApp CreateMauiApp() + { - builder.Services.AddBlazorWebView(); - - var services = builder.Services; - - var web3ServiceProvider = new Web3ProviderService(); - var accountsService = new AccountsService(web3ServiceProvider); - var newBlockProcessingService = new NewBlockProcessingService(web3ServiceProvider); - var toastsViewModel = new ToastsViewModel(); - var blocksViewModel = new BlocksViewModel(newBlockProcessingService); - var latestBlockTransactionsViewModel = new LatestBlockTransactionsViewModel(web3ServiceProvider); - var newAccountPrivateKeyViewModel = new NewAccountPrivateKeyViewModel(); - var accountsViewModel = new AccountsViewModel(accountsService, newAccountPrivateKeyViewModel); - var accountsTransactionMonitoringService = new AccountsTransactionMonitoringService(accountsService, web3ServiceProvider); - - services.AddSingleton((x) => web3ServiceProvider); - services.AddSingleton((x) => accountsService); - services.AddSingleton(newBlockProcessingService); - services.AddSingleton(toastsViewModel); - services.AddSingleton(blocksViewModel); - services.AddSingleton(latestBlockTransactionsViewModel); - services.AddTransient(); - services.AddSingleton(accountsViewModel); - services.AddSingleton(newAccountPrivateKeyViewModel); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(accountsTransactionMonitoringService); - services.AddSingleton(); - services.AddSingleton(); - - - services.AddFlexGrid(cfg => + var builder = MauiApp.CreateBuilder(); + builder + .UseMauiApp() + .ConfigureFonts(fonts => { - cfg.ApplyConfiguration(new TransactionsViewModelGridConfiguration()); - }); + fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); + }) + .ConfigureServices(); - return builder.Build(); - } - } -} + return builder.Build(); + } +} \ No newline at end of file diff --git a/NethereumExplorer.Maui/NethereumExplorer.Maui.csproj b/NethereumExplorer.Maui/NethereumExplorer.Maui.csproj index 60f58d0..7b3453e 100644 --- a/NethereumExplorer.Maui/NethereumExplorer.Maui.csproj +++ b/NethereumExplorer.Maui/NethereumExplorer.Maui.csproj @@ -16,15 +16,17 @@ com.companyname.NethereumExplorer.Maui + 1.0 1 True - 14.2 - 14.0 - 21.0 - 10.0.18362.0 + 14.2 + 14.0 + 21.0 + 10.0.17763.0 + 10.0.17763.0 @@ -40,17 +42,6 @@ - - - - - - - - - WinExe - win-x64 - @@ -67,15 +58,6 @@ - - - - - - - - - diff --git a/NethereumExplorer.Maui/Platforms/MacCatalyst/AppDelegate.cs b/NethereumExplorer.Maui/Platforms/MacCatalyst/AppDelegate.cs index 0d4cf4b..a0cba02 100644 --- a/NethereumExplorer.Maui/Platforms/MacCatalyst/AppDelegate.cs +++ b/NethereumExplorer.Maui/Platforms/MacCatalyst/AppDelegate.cs @@ -2,11 +2,10 @@ using Microsoft.Maui; using Microsoft.Maui.Hosting; -namespace NethereumExplorer.Maui +namespace NethereumExplorer.Maui; + +[Register("AppDelegate")] +public class AppDelegate : MauiUIApplicationDelegate { - [Register("AppDelegate")] - public class AppDelegate : MauiUIApplicationDelegate - { - protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); - } + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); } \ No newline at end of file diff --git a/NethereumExplorer.Maui/Platforms/MacCatalyst/Program.cs b/NethereumExplorer.Maui/Platforms/MacCatalyst/Program.cs index 6bb35af..da797c2 100644 --- a/NethereumExplorer.Maui/Platforms/MacCatalyst/Program.cs +++ b/NethereumExplorer.Maui/Platforms/MacCatalyst/Program.cs @@ -1,15 +1,14 @@ using UIKit; -namespace NethereumExplorer.Maui +namespace NethereumExplorer.Maui; + +public class Program { - public class Program + // This is the main entry point of the application. + static void Main(string[] args) { - // This is the main entry point of the application. - static void Main(string[] args) - { - // if you want to use a different Application Delegate class from "AppDelegate" - // you can specify it here. - UIApplication.Main(args, null, typeof(AppDelegate)); - } + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); } } \ No newline at end of file diff --git a/NethereumExplorer.Maui/Platforms/Windows/App.xaml b/NethereumExplorer.Maui/Platforms/Windows/App.xaml index 82577b3..8e84463 100644 --- a/NethereumExplorer.Maui/Platforms/Windows/App.xaml +++ b/NethereumExplorer.Maui/Platforms/Windows/App.xaml @@ -2,7 +2,6 @@ x:Class="NethereumExplorer.Maui.WinUI.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:maui="using:Microsoft.Maui" - xmlns:local="using:NethereumExplorer.Maui.WinUI"> + xmlns:maui="using:Microsoft.Maui"> diff --git a/NethereumExplorer.Maui/Platforms/Windows/App.xaml.cs b/NethereumExplorer.Maui/Platforms/Windows/App.xaml.cs index 7841e04..6ddc6e6 100644 --- a/NethereumExplorer.Maui/Platforms/Windows/App.xaml.cs +++ b/NethereumExplorer.Maui/Platforms/Windows/App.xaml.cs @@ -1,34 +1,21 @@ -using Microsoft.Maui; -using Microsoft.Maui.Hosting; -using Microsoft.UI.Xaml; -using Windows.ApplicationModel; - -// To learn more about WinUI, the WinUI project structure, +// To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. -namespace NethereumExplorer.Maui.WinUI +namespace NethereumExplorer.Maui.WinUI; + +/// +/// Provides application-specific behavior to supplement the default Application class. +/// +public partial class App : MauiWinUIApplication { /// - /// Provides application-specific behavior to supplement the default Application class. + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). /// - public partial class App : MauiWinUIApplication + public App() { - /// - /// Initializes the singleton application object. This is the first line of authored code - /// executed, and as such is the logical equivalent of main() or WinMain(). - /// - public App() - { - this.InitializeComponent(); - } - - protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); - - protected override void OnLaunched(LaunchActivatedEventArgs args) - { - base.OnLaunched(args); - - Microsoft.Maui.Essentials.Platform.OnLaunched(args); - } + this.InitializeComponent(); } + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); } diff --git a/NethereumExplorer.Maui/Platforms/Windows/Package.appxmanifest b/NethereumExplorer.Maui/Platforms/Windows/Package.appxmanifest index 5eb27e3..07ea51c 100644 --- a/NethereumExplorer.Maui/Platforms/Windows/Package.appxmanifest +++ b/NethereumExplorer.Maui/Platforms/Windows/Package.appxmanifest @@ -14,7 +14,6 @@ NethereumExplorer.Maui Microsoft - Assets\appiconStoreLogo.png @@ -27,27 +26,8 @@ - - - - - - - - - - + + diff --git a/NethereumExplorer.Maui/Platforms/iOS/AppDelegate.cs b/NethereumExplorer.Maui/Platforms/iOS/AppDelegate.cs index 0d4cf4b..a0cba02 100644 --- a/NethereumExplorer.Maui/Platforms/iOS/AppDelegate.cs +++ b/NethereumExplorer.Maui/Platforms/iOS/AppDelegate.cs @@ -2,11 +2,10 @@ using Microsoft.Maui; using Microsoft.Maui.Hosting; -namespace NethereumExplorer.Maui +namespace NethereumExplorer.Maui; + +[Register("AppDelegate")] +public class AppDelegate : MauiUIApplicationDelegate { - [Register("AppDelegate")] - public class AppDelegate : MauiUIApplicationDelegate - { - protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); - } + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); } \ No newline at end of file diff --git a/NethereumExplorer.Maui/Platforms/iOS/Program.cs b/NethereumExplorer.Maui/Platforms/iOS/Program.cs index 6bb35af..da797c2 100644 --- a/NethereumExplorer.Maui/Platforms/iOS/Program.cs +++ b/NethereumExplorer.Maui/Platforms/iOS/Program.cs @@ -1,15 +1,14 @@ using UIKit; -namespace NethereumExplorer.Maui +namespace NethereumExplorer.Maui; + +public class Program { - public class Program + // This is the main entry point of the application. + static void Main(string[] args) { - // This is the main entry point of the application. - static void Main(string[] args) - { - // if you want to use a different Application Delegate class from "AppDelegate" - // you can specify it here. - UIApplication.Main(args, null, typeof(AppDelegate)); - } + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); } } \ No newline at end of file diff --git a/NethereumExplorer.Maui/ServicesExtensions.cs b/NethereumExplorer.Maui/ServicesExtensions.cs new file mode 100644 index 0000000..7242dd4 --- /dev/null +++ b/NethereumExplorer.Maui/ServicesExtensions.cs @@ -0,0 +1,44 @@ +namespace NethereumExplorer.Maui; + +internal static class ServicesExtensions +{ + public static MauiAppBuilder ConfigureServices(this MauiAppBuilder builder) + { + var services = builder.Services; + + services.AddMauiBlazorWebView(); + + var web3ServiceProvider = new Web3ProviderService(); + var accountsService = new AccountsService(web3ServiceProvider); + var newBlockProcessingService = new NewBlockProcessingService(web3ServiceProvider); + var toastsViewModel = new ToastsViewModel(); + var blocksViewModel = new BlocksViewModel(newBlockProcessingService); + var latestBlockTransactionsViewModel = new LatestBlockTransactionsViewModel(web3ServiceProvider); + var newAccountPrivateKeyViewModel = new NewAccountPrivateKeyViewModel(); + var accountsViewModel = new AccountsViewModel(accountsService, newAccountPrivateKeyViewModel); + var accountsTransactionMonitoringService = new AccountsTransactionMonitoringService(accountsService, web3ServiceProvider); + + services.AddSingleton((x) => web3ServiceProvider); + services.AddSingleton((x) => accountsService); + services.AddSingleton(newBlockProcessingService); + services.AddSingleton(toastsViewModel); + services.AddSingleton(blocksViewModel); + services.AddSingleton(latestBlockTransactionsViewModel); + services.AddTransient(); + services.AddSingleton(accountsViewModel); + services.AddSingleton(newAccountPrivateKeyViewModel); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(accountsTransactionMonitoringService); + services.AddSingleton(); + services.AddSingleton(); + + + services.AddFlexGrid(cfg => + { + cfg.ApplyConfiguration(new TransactionsViewModelGridConfiguration()); + }); + + return builder; + } +}