Skip to content

Commit

Permalink
Initial Check-in
Browse files Browse the repository at this point in the history
  • Loading branch information
naweed committed Mar 29, 2022
1 parent 8888c25 commit c9dad74
Show file tree
Hide file tree
Showing 30 changed files with 1,226 additions and 0 deletions.
115 changes: 115 additions & 0 deletions src/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?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.Resources>
<ResourceDictionary>

<!-- Colors -->
<Color x:Key="PrimaryColor">#EFBB31</Color>
<Color x:Key="SecondaryColor">White</Color>
<Color x:Key="PageBackgroundColor">#16191E</Color>
<Color x:Key="BorderColor">#33777777</Color>

<!-- Content Page Style -->
<Style TargetType="ContentPage" ApplyToDerivedTypes="True">
<Setter Property="NavigationPage.HasNavigationBar" Value="False" />
<Setter Property="BackgroundColor" Value="{StaticResource PageBackgroundColor}" />
</Style>

<!-- Grid Styles -->
<Style TargetType="Grid">
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0" />
<Setter Property="RowSpacing" Value="0" />
<Setter Property="ColumnSpacing" Value="0" />
<Setter Property="VerticalOptions" Value="Fill" />
<Setter Property="HorizontalOptions" Value="Fill" />
<Setter Property="BackgroundColor" Value="Transparent" />
</Style>


<!-- Button Styles -->
<Style TargetType="Button" x:Key="NumberButtonStyle">
<Setter Property="FontSize" Value="22" />
<Setter Property="FontFamily" Value="RegularFont" />
<Setter Property="TextColor" Value="White" />
<Setter Property="BackgroundColor" Value="#202731" />
<Setter Property="BorderWidth" Value="0" />
<Setter Property="BorderColor" Value="{StaticResource BorderColor}" />
<Setter Property="VerticalOptions" Value="Fill" />
<Setter Property="HorizontalOptions" Value="Fill" />
<Setter Property="CornerRadius" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0,0,1,1" />
<Setter Property="FontAutoScalingEnabled" Value="False" />
</Style>

<Style TargetType="Button" x:Key="OperatorButtonStyle">
<Setter Property="FontSize" Value="22" />
<Setter Property="FontFamily" Value="RegularFont" />
<Setter Property="TextColor" Value="Black" />
<Setter Property="BackgroundColor" Value="#EFBB31" />
<Setter Property="BorderWidth" Value="0" />
<Setter Property="BorderColor" Value="{StaticResource BorderColor}" />
<Setter Property="VerticalOptions" Value="Fill" />
<Setter Property="HorizontalOptions" Value="Fill" />
<Setter Property="CornerRadius" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0,0,1,1" />
<Setter Property="FontAutoScalingEnabled" Value="False" />
</Style>

<Style TargetType="Button" x:Key="ScientificOperatorButtonStyle">
<Setter Property="FontSize" Value="14" />
<Setter Property="FontFamily" Value="RegularFont" />
<Setter Property="TextColor" Value="White" />
<Setter Property="BackgroundColor" Value="#2C3240" />
<Setter Property="BorderWidth" Value="1" />
<Setter Property="BorderColor" Value="{StaticResource BorderColor}" />
<Setter Property="VerticalOptions" Value="Fill" />
<Setter Property="HorizontalOptions" Value="Fill" />
<Setter Property="CornerRadius" Value="6" />
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="6,6" />
<Setter Property="Shadow">
<Shadow
Brush="Black"
Offset="6,6"
Radius="12"
Opacity="0.5"/>
</Setter>
<Setter Property="FontAutoScalingEnabled" Value="False" />
</Style>


<!-- Label Styles -->
<Style TargetType="Label" x:Key="EqualsLabelStyle">
<Setter Property="FontSize" Value="28" />
<Setter Property="TextColor" Value="#EFBB31" />
<Setter Property="FontFamily" Value="LightFont" />
<Setter Property="LineBreakMode" Value="TailTruncation" />
<Setter Property="FontAutoScalingEnabled" Value="False" />
</Style>

<Style TargetType="Label" x:Key="ResultLabelStyle">
<Setter Property="FontSize" Value="28" />
<Setter Property="TextColor" Value="White" />
<Setter Property="FontFamily" Value="RegularFont" />
<Setter Property="LineBreakMode" Value="TailTruncation" />
<Setter Property="FontAutoScalingEnabled" Value="False" />
</Style>

<Style TargetType="Label" x:Key="InputBoxLabelStyle">
<Setter Property="FontSize" Value="32" />
<Setter Property="TextColor" Value="White" />
<Setter Property="FontFamily" Value="LightFont" />
<Setter Property="LineBreakMode" Value="WordWrap" />
<Setter Property="FontAutoScalingEnabled" Value="False" />
</Style>

</ResourceDictionary>
</Application.Resources>
</Application>
11 changes: 11 additions & 0 deletions src/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace MauiScientificCalculator;

public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new CalculatorPage();
}
}
21 changes: 21 additions & 0 deletions src/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//System Specific
global using System;
global using System.Collections.Generic;

//Maui Specific
global using Microsoft.Maui;
global using Microsoft.Maui.Controls;
global using Microsoft.Maui.Controls.Hosting;
global using Microsoft.Maui.Essentials;
global using Microsoft.Maui.Hosting;

//Toolkit Specific
global using CommunityToolkit.Mvvm.ComponentModel;
global using CommunityToolkit.Mvvm.Input;

//App Specific
global using MauiScientificCalculator.Views;
global using MauiScientificCalculator.ViewModels;

//Others
global using NCalc;
19 changes: 19 additions & 0 deletions src/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace MauiScientificCalculator;

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");
});

return builder.Build();
}
}
79 changes: 79 additions & 0 deletions src/MauiScientificCalculator.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>MauiScientificCalculator</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>false</ImplicitUsings>
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>

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

<!-- App Identifier -->
<ApplicationId>com.xgeno.mauiscientificcalculator</ApplicationId>
<ApplicationId Condition="$(TargetFramework.Contains('-windows'))">ED8D773E-C298-4AF9-8613-958426E68DDC</ApplicationId>

<!-- 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="$(TargetFramework.Contains('-windows'))">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</TargetPlatformMinVersion>
</PropertyGroup>

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

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\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) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<!-- Required - WinUI does not yet have buildTransitive for everything -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
</ItemGroup>

<ItemGroup>
<None Remove="Resources\Fonts\Cairo-ExtraLight.ttf" />
<None Remove="Resources\Fonts\Cairo-Light.ttf" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0-preview2" />
<PackageReference Include="NCalcSync" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
<MauiXaml Update="Views\CalculatorPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>

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

</Project>
27 changes: 27 additions & 0 deletions src/MauiScientificCalculator.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

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}"
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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions src/Platforms/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +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" />
</manifest>
10 changes: 10 additions & 0 deletions src/Platforms/Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Android.App;
using Android.Content.PM;
using Android.OS;

namespace MauiScientificCalculator;

[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize)]
public class MainActivity : MauiAppCompatActivity
{
}
15 changes: 15 additions & 0 deletions src/Platforms/Android/MainApplication.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Android.App;
using Android.Runtime;

namespace MauiScientificCalculator;

[Application]
public class MainApplication : MauiApplication
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}

protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
6 changes: 6 additions & 0 deletions src/Platforms/Android/Resources/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#512BD4</color>
<color name="colorPrimaryDark">#2B0B98</color>
<color name="colorAccent">#2B0B98</color>
</resources>
9 changes: 9 additions & 0 deletions src/Platforms/MacCatalyst/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Foundation;

namespace MauiScientificCalculator;

[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
30 changes: 30 additions & 0 deletions src/Platforms/MacCatalyst/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string>
</dict>
</plist>
15 changes: 15 additions & 0 deletions src/Platforms/MacCatalyst/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using ObjCRuntime;
using UIKit;

namespace MauiScientificCalculator;

public class Program
{
// 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));
}
}
8 changes: 8 additions & 0 deletions src/Platforms/Windows/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<maui:MauiWinUIApplication
x:Class="MauiScientificCalculator.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:MauiScientificCalculator.WinUI">

</maui:MauiWinUIApplication>
Loading

0 comments on commit c9dad74

Please sign in to comment.