Skip to content

Commit

Permalink
Fixes to GA
Browse files Browse the repository at this point in the history
  • Loading branch information
naweed committed Jun 10, 2022
1 parent 3f47b1e commit 8d49632
Show file tree
Hide file tree
Showing 34 changed files with 125 additions and 63 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A simple scientific calculator built uisng .NET MAUI Preview 14. Based ont his [
This is a full working app. The following enhancements are in the pipeline:
* Implement nested scientific operators (for auto bracket closing)
* Implement statistical operators (row 1 operators)
* Test on iOS and Windows
* Test on iOS

## Screen Shots
### Original Behance Design
Expand Down
12 changes: 5 additions & 7 deletions src/App.xaml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MauiScientificCalculator"
x:Class="MauiScientificCalculator.App">
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MauiScientificCalculator"
x:Class="MauiScientificCalculator.App">
<Application.Resources>
<ResourceDictionary>

<!-- Colors -->
<Color x:Key="PrimaryColor">#EFBB31</Color>
<Color x:Key="SecondaryColor">White</Color>
Expand All @@ -29,7 +27,7 @@
<Setter Property="HorizontalOptions" Value="Fill" />
<Setter Property="BackgroundColor" Value="Transparent" />
</Style>


<!-- Button Styles -->
<Style TargetType="Button" x:Key="NumberButtonStyle">
Expand Down
28 changes: 25 additions & 3 deletions src/App.xaml.cs
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
namespace MauiScientificCalculator;
#if WINDOWS
using Microsoft.UI;
using Microsoft.UI.Windowing;
using Windows.Graphics;
#endif

namespace MauiScientificCalculator;

public partial class App : Application
{
public App()
const int WindowWidth = 540;
const int WindowHeight = 1000;

public App()
{
InitializeComponent();

MainPage = new CalculatorPage();
Microsoft.Maui.Handlers.WindowHandler.Mapper.AppendToMapping(nameof(IWindow), (handler, view) =>
{
#if WINDOWS
var mauiWindow = handler.VirtualView;
var nativeWindow = handler.PlatformView;
nativeWindow.Activate();
IntPtr windowHandle = WinRT.Interop.WindowNative.GetWindowHandle(nativeWindow);
WindowId windowId = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(windowHandle);
AppWindow appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(windowId);
appWindow.Resize(new SizeInt32(WindowWidth, WindowHeight));
#endif
});

MainPage = new CalculatorPage();
}
}
Empty file modified src/GlobalUsings.cs
100644 → 100755
Empty file.
7 changes: 3 additions & 4 deletions src/MauiProgram.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ public static class MauiProgram
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();

builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("Cairo-Light.ttf", "RegularFont");
fonts.AddFont("Cairo-ExtraLight.ttf", "LightFont");
});
fonts.AddFont("Cairo-Light.ttf", "RegularFont");
fonts.AddFont("Cairo-ExtraLight.ttf", "LightFont");
});

return builder.Build();
}
Expand Down
38 changes: 17 additions & 21 deletions src/MauiScientificCalculator.csproj
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
Expand All @@ -7,39 +7,38 @@
<RootNamespace>MauiScientificCalculator</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>false</ImplicitUsings>
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
<ImplicitUsings>disable</ImplicitUsings>

<!-- Display name -->
<ApplicationTitle>Sci-Calc</ApplicationTitle>
<ApplicationTitle>MauiScientificCalculator</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.xgeno.mauiscientificcalculator</ApplicationId>
<ApplicationId Condition="$(TargetFramework.Contains('-windows'))">ED8D773E-C298-4AF9-8613-958426E68DDC</ApplicationId>
<ApplicationId>com.companyname.mauiscientificcalculator</ApplicationId>
<ApplicationIdGuid>D4CE5FA1-B95E-4D04-A744-7C296BA7EC94</ApplicationIdGuid>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<!-- Required for C# Hot Reload -->
<UseInterpreter Condition="'$(Configuration)' == 'Debug'">True</UseInterpreter>

<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
</PropertyGroup>

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\appicon.svg" ForegroundFile="Resources\appiconfg.svg" Color="#EFBB31" />
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#EFBB31" />

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\appiconfg.svg" Color="#EFBB31" BaseSize="128,128" />
<MauiSplashScreen Include="Resources\AppIcon\appiconfg.svg" Color="#EFBB31" BaseSize="128,128" />

<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />

<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />

<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
Expand All @@ -53,8 +52,6 @@

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0-preview4" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.3.1" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.1.0" />
<PackageReference Include="NCalcSync" Version="3.4.0" />
</ItemGroup>

Expand All @@ -64,9 +61,8 @@
</MauiXaml>
</ItemGroup>

<PropertyGroup Condition="$(TargetFramework.Contains('-windows'))">
<OutputType>WinExe</OutputType>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
<Folder Include="Resources\Styles\" />
</ItemGroup>

</Project>
14 changes: 7 additions & 7 deletions src/MauiScientificCalculator.sln
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31611.283
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiScientificCalculator", "MauiScientificCalculator.csproj", "{0584915C-1DC3-4DE6-BBBC-2C9AEEDEF25A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiScientificCalculator", "MauiScientificCalculator.csproj", "{0928233A-881C-4EBF-948D-849CB5162852}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0584915C-1DC3-4DE6-BBBC-2C9AEEDEF25A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0584915C-1DC3-4DE6-BBBC-2C9AEEDEF25A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0584915C-1DC3-4DE6-BBBC-2C9AEEDEF25A}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{0584915C-1DC3-4DE6-BBBC-2C9AEEDEF25A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0584915C-1DC3-4DE6-BBBC-2C9AEEDEF25A}.Release|Any CPU.Build.0 = Release|Any CPU
{0584915C-1DC3-4DE6-BBBC-2C9AEEDEF25A}.Release|Any CPU.Deploy.0 = Release|Any CPU
{0928233A-881C-4EBF-948D-849CB5162852}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0928233A-881C-4EBF-948D-849CB5162852}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0928233A-881C-4EBF-948D-849CB5162852}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{0928233A-881C-4EBF-948D-849CB5162852}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0928233A-881C-4EBF-948D-849CB5162852}.Release|Any CPU.Build.0 = Release|Any CPU
{0928233A-881C-4EBF-948D-849CB5162852}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion src/Platforms/Android/AndroidManifest.xml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" />
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
2 changes: 1 addition & 1 deletion src/Platforms/Android/MainActivity.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace MauiScientificCalculator;

[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
}
Empty file modified src/Platforms/Android/MainApplication.cs
100644 → 100755
Empty file.
Empty file modified src/Platforms/Android/Resources/values/colors.xml
100644 → 100755
Empty file.
Empty file modified src/Platforms/MacCatalyst/AppDelegate.cs
100644 → 100755
Empty file.
Empty file modified src/Platforms/MacCatalyst/Info.plist
100644 → 100755
Empty file.
Empty file modified src/Platforms/MacCatalyst/Program.cs
100644 → 100755
Empty file.
16 changes: 16 additions & 0 deletions src/Platforms/Tizen/Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using Microsoft.Maui;
using Microsoft.Maui.Hosting;

namespace MauiScientificCalculator;

class Program : MauiApplication
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();

static void Main(string[] args)
{
var app = new Program();
app.Run(args);
}
}
15 changes: 15 additions & 0 deletions src/Platforms/Tizen/tizen-manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.companyname.MauiScientificCalculator" version="1.0.0" api-version="7" xmlns="http://tizen.org/ns/packages">
<profile name="common" />
<ui-application appid="com.companyname.MauiScientificCalculator" exec="MauiScientificCalculator.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
<label>MauiScientificCalculator</label>
<icon>appicon.xhigh.png</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
</ui-application>
<shortcut-list />
<privileges>
<privilege>http://tizen.org/privilege/internet</privilege>
</privileges>
<dependencies />
<provides-appdefined-privileges />
</manifest>
Empty file modified src/Platforms/Windows/App.xaml
100644 → 100755
Empty file.
Empty file modified src/Platforms/Windows/App.xaml.cs
100644 → 100755
Empty file.
14 changes: 12 additions & 2 deletions src/Platforms/Windows/Package.appxmanifest
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">

<Identity Publisher="CN=User Name" />
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.0" />

<Properties>
<DisplayName>$placeholder$</DisplayName>
<PublisherDisplayName>User Name</PublisherDisplayName>
<Logo>$placeholder$.png</Logo>
</Properties>

<Dependencies>
Expand All @@ -22,7 +24,15 @@

<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$">
<uap:VisualElements />
<uap:VisualElements
DisplayName="$placeholder$"
Description="$placeholder$"
Square150x150Logo="$placeholder$.png"
Square44x44Logo="$placeholder$.png"
BackgroundColor="transparent">
<uap:DefaultTile Square71x71Logo="$placeholder$.png" Wide310x150Logo="$placeholder$.png" Square310x310Logo="$placeholder$.png" />
<uap:SplashScreen Image="$placeholder$.png" />
</uap:VisualElements>
</Application>
</Applications>

Expand Down
Empty file modified src/Platforms/Windows/app.manifest
100644 → 100755
Empty file.
Empty file modified src/Platforms/iOS/AppDelegate.cs
100644 → 100755
Empty file.
Empty file modified src/Platforms/iOS/Info.plist
100644 → 100755
Empty file.
Empty file modified src/Platforms/iOS/Program.cs
100644 → 100755
Empty file.
Empty file modified src/Properties/launchSettings.json
100644 → 100755
Empty file.
File renamed without changes
File renamed without changes
Empty file modified src/Resources/Fonts/Cairo-ExtraLight.ttf
100644 → 100755
Empty file.
Empty file modified src/Resources/Fonts/Cairo-Light.ttf
100644 → 100755
Empty file.
Empty file modified src/Resources/Images/dotnet_bot.svg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/Resources/Raw/AboutAssets.txt
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "MauiAsset":
this directory (and child directories). Deployment of the asset to your application
is automatically handled by the following `MauiAsset` Build Action within your `.csproj`.

<MauiAsset Include="AboutAssets.txt" />
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />

These files will be deployed with you package and will be accessible using Essentials:

Expand Down
8 changes: 8 additions & 0 deletions src/Resources/Splash/splash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/ViewModels/CalculatorPageViewModel.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private string NormalizeInputString()

var retString = InputText;

foreach(var key in _opMapper.Keys)
foreach (var key in _opMapper.Keys)
{
retString = retString.Replace(key, _opMapper[key]);
}
Expand Down
14 changes: 7 additions & 7 deletions src/Views/CalculatorPage.xaml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Expand All @@ -8,7 +8,7 @@
<Grid
RowDefinitions="*,68,48,44,44,48,64,64,64,64"
ColumnDefinitions="*,*,*,*,*">

<!-- Color Answer Row -->
<BoxView
VerticalOptions="Fill"
Expand All @@ -25,7 +25,7 @@
Grid.Row="2"
Grid.RowSpan="4"
Grid.ColumnSpan="5"/>

<!-- Input Area -->
<Frame
HasShadow="False"
Expand Down Expand Up @@ -74,7 +74,7 @@
HorizontalOptions="End"
Grid.Column="1"
Style="{StaticResource ResultLabelStyle}"
Margin="16,0"/>
Margin="16,0"/>

</Grid>

Expand Down Expand Up @@ -263,8 +263,8 @@
Style="{StaticResource ScientificOperatorButtonStyle}"
Text=")"
Command="{Binding RegionOperatorCommand}"
CommandParameter=")" />
CommandParameter=")" />



<!-- Mathematical Operators -->
Expand Down Expand Up @@ -464,4 +464,4 @@

</Grid>

</ContentPage>
</ContentPage>
9 changes: 3 additions & 6 deletions src/Views/CalculatorPage.xaml.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ namespace MauiScientificCalculator.Views;

public partial class CalculatorPage : ContentPage
{
private CalculatorPageViewModel calcViewModel;

public CalculatorPage()
{
InitializeComponent();

//Initialize the view model
calcViewModel = new CalculatorPageViewModel();
this.BindingContext = calcViewModel;
}
//Initialize the view model
this.BindingContext = new CalculatorPageViewModel();
}
}

0 comments on commit 8d49632

Please sign in to comment.