diff --git a/MAUICalculator/App.xaml.cs b/MAUICalculator/App.xaml.cs index 8c36ce6..5bcd6d6 100644 --- a/MAUICalculator/App.xaml.cs +++ b/MAUICalculator/App.xaml.cs @@ -1,11 +1,13 @@ namespace MAUICalculator +using Microsoft.Maui.Controls; + +namespace YourNamespace { public partial class App : Application { public App() { InitializeComponent(); - MainPage = new AppShell(); } } diff --git a/MAUICalculator/AppShell.xaml.cs b/MAUICalculator/AppShell.xaml.cs index 3c4318a..fb20b0f 100644 --- a/MAUICalculator/AppShell.xaml.cs +++ b/MAUICalculator/AppShell.xaml.cs @@ -1,10 +1,15 @@ namespace MAUICalculator +using System; +using Microsoft.Maui.Controls; + +namespace YourNamespace { public partial class AppShell : Shell { public AppShell() { InitializeComponent(); + Routing.RegisterRoute(nameof(SubPage), typeof(SubPage)); } } } diff --git a/MAUICalculator/MauiProgram.cs b/MAUICalculator/MauiProgram.cs index b79779f..4cc812b 100644 --- a/MAUICalculator/MauiProgram.cs +++ b/MAUICalculator/MauiProgram.cs @@ -1,6 +1,8 @@ using Microsoft.Extensions.Logging; - +using Microsoft.Maui; +using Microsoft.Maui.Hosting; namespace MAUICalculator +namespace YourNamespace { public static class MauiProgram { @@ -12,14 +14,10 @@ public static MauiApp CreateMauiApp() .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); - fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); }); -#if DEBUG - builder.Logging.AddDebug(); -#endif - return builder.Build(); } } } + diff --git a/MAUICalculator/SubPage.xaml.cs b/MAUICalculator/SubPage.xaml.cs index 0f9a3b9..c973dc7 100644 --- a/MAUICalculator/SubPage.xaml.cs +++ b/MAUICalculator/SubPage.xaml.cs @@ -1,9 +1,39 @@ namespace MAUICalculator; +using System; +using Microsoft.Maui.Controls; -public partial class SubPage : ContentPage +namespace YourNamespace { - public SubPage() - { - InitializeComponent(); - } -} \ No newline at end of file + public partial class SubPage : ContentPage + { + public SubPage() + { + InitializeComponent(); + } + + // Method to handle DEL button click + void OnDelButtonClicked(object sender, EventArgs e) + { + if (displayLabel.Text.Length > 0) + { + if (displayLabel.Text.EndsWith("=")) + { + displayLabel.Text = ""; + } + else + { + displayLabel.Text = displayLabel.Text.Remove(displayLabel.Text.Length - 1); + } + } + } + + // Method to handle AC button click + void OnAcButtonClicked(object sender, EventArgs e) + { + displayLabel.Text = ""; + lastNumber = 0; + } + + // Other methods for button clicks... + } +}