mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
Merge pull request #10 from nventive/dev/djo/ios-integrate
Enable for iOS
This commit is contained in:
commit
a550a60428
7 changed files with 54 additions and 30 deletions
|
@ -12,88 +12,94 @@ namespace CalculationManager
|
||||||
{
|
{
|
||||||
public static class NativeDispatch
|
public static class NativeDispatch
|
||||||
{
|
{
|
||||||
[DllImport("CalcManager")]
|
#if __IOS__
|
||||||
|
private const string DllPath = "__Internal"; // https://docs.microsoft.com/en-us/xamarin/ios/platform/native-interop
|
||||||
|
#else
|
||||||
|
private const string DllPath = "CalcManager";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
[DllImport(DllPath)]
|
||||||
public static extern IntPtr CalculatorManager_Create(ref CalculatorManager_CreateParams parms);
|
public static extern IntPtr CalculatorManager_Create(ref CalculatorManager_CreateParams parms);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_SendCommand(IntPtr nativeManager, Command command);
|
public static extern void CalculatorManager_SendCommand(IntPtr nativeManager, Command command);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_SetRadix(IntPtr nativeManager, RADIX_TYPE iRadixType);
|
public static extern void CalculatorManager_SetRadix(IntPtr nativeManager, RADIX_TYPE iRadixType);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_Reset(IntPtr nativeManager, bool clearMemory);
|
public static extern void CalculatorManager_Reset(IntPtr nativeManager, bool clearMemory);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_SetStandardMode(IntPtr nativeManager);
|
public static extern void CalculatorManager_SetStandardMode(IntPtr nativeManager);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_SetScientificMode(IntPtr nativeManager);
|
public static extern void CalculatorManager_SetScientificMode(IntPtr nativeManager);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_SetProgrammerMode(IntPtr nativeManager);
|
public static extern void CalculatorManager_SetProgrammerMode(IntPtr nativeManager);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_MemorizeNumber(IntPtr nativeManager);
|
public static extern void CalculatorManager_MemorizeNumber(IntPtr nativeManager);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_MemorizedNumberLoad(IntPtr nativeManager, int value);
|
public static extern void CalculatorManager_MemorizedNumberLoad(IntPtr nativeManager, int value);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_MemorizedNumberAdd(IntPtr nativeManager, int value);
|
public static extern void CalculatorManager_MemorizedNumberAdd(IntPtr nativeManager, int value);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_MemorizedNumberSubtract(IntPtr nativeManager, int value);
|
public static extern void CalculatorManager_MemorizedNumberSubtract(IntPtr nativeManager, int value);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_MemorizedNumberClear(IntPtr nativeManager, int value);
|
public static extern void CalculatorManager_MemorizedNumberClear(IntPtr nativeManager, int value);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_MemorizedNumberClearAll(IntPtr nativeManager);
|
public static extern void CalculatorManager_MemorizedNumberClearAll(IntPtr nativeManager);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern bool CalculatorManager_IsEngineRecording(IntPtr nativeManager);
|
public static extern bool CalculatorManager_IsEngineRecording(IntPtr nativeManager);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_SetMemorizedNumbersString(IntPtr nativeManager);
|
public static extern void CalculatorManager_SetMemorizedNumbersString(IntPtr nativeManager);
|
||||||
|
|
||||||
[DllImport("CalcManager", CharSet = CharSet.Unicode)]
|
[DllImport(DllPath, CharSet = CharSet.Unicode)]
|
||||||
public static extern string CalculatorManager_GetResultForRadix(IntPtr nativeManager, int radix, int precision);
|
public static extern string CalculatorManager_GetResultForRadix(IntPtr nativeManager, int radix, int precision);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_SetPrecision(IntPtr nativeManager, int precision);
|
public static extern void CalculatorManager_SetPrecision(IntPtr nativeManager, int precision);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_UpdateMaxIntDigits(IntPtr nativeManager);
|
public static extern void CalculatorManager_UpdateMaxIntDigits(IntPtr nativeManager);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern char CalculatorManager_DecimalSeparator(IntPtr nativeManager);
|
public static extern char CalculatorManager_DecimalSeparator(IntPtr nativeManager);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern bool CalculatorManager_RemoveHistoryItem(IntPtr nativeManager, int uIdx);
|
public static extern bool CalculatorManager_RemoveHistoryItem(IntPtr nativeManager, int uIdx);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_ClearHistory(IntPtr nativeManager);
|
public static extern void CalculatorManager_ClearHistory(IntPtr nativeManager);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern int CalculatorManager_MaxHistorySize(IntPtr nativeManager);
|
public static extern int CalculatorManager_MaxHistorySize(IntPtr nativeManager);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern Command CalculatorManager_GetCurrentDegreeMode(IntPtr nativeManager);
|
public static extern Command CalculatorManager_GetCurrentDegreeMode(IntPtr nativeManager);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern void CalculatorManager_SetInHistoryItemLoadMode(IntPtr nativeManager, bool isHistoryItemLoadMode);
|
public static extern void CalculatorManager_SetInHistoryItemLoadMode(IntPtr nativeManager, bool isHistoryItemLoadMode);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern IntPtr CalculatorManager_GetHistoryItems(IntPtr nativeManager);
|
public static extern IntPtr CalculatorManager_GetHistoryItems(IntPtr nativeManager);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern IntPtr CalculatorManager_GetHistoryItemsWithMode(IntPtr nativeManager, CALCULATOR_MODE mode);
|
public static extern IntPtr CalculatorManager_GetHistoryItemsWithMode(IntPtr nativeManager, CALCULATOR_MODE mode);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern IntPtr CalculatorManager_GetHistoryItem(IntPtr nativeManager, int uIdx);
|
public static extern IntPtr CalculatorManager_GetHistoryItem(IntPtr nativeManager, int uIdx);
|
||||||
|
|
||||||
[DllImport("CalcManager")]
|
[DllImport(DllPath)]
|
||||||
public static extern CommandType IExpressionCommand_GetCommandType(IntPtr pExpressionCommand);
|
public static extern CommandType IExpressionCommand_GetCommandType(IntPtr pExpressionCommand);
|
||||||
|
|
||||||
public delegate IntPtr GetCEngineStringFunc(IntPtr state, IntPtr id);
|
public delegate IntPtr GetCEngineStringFunc(IntPtr state, IntPtr id);
|
||||||
|
|
|
@ -573,7 +573,7 @@ namespace CalculatorApp.ViewModel
|
||||||
|
|
||||||
m_decimalSeparator = LocalizationSettings.GetInstance().GetDecimalSeparator();
|
m_decimalSeparator = LocalizationSettings.GetInstance().GetDecimalSeparator();
|
||||||
|
|
||||||
#if !__WASM__
|
#if !__WASM__ && !__IOS__
|
||||||
if (CoreWindow.GetForCurrentThread() != null)
|
if (CoreWindow.GetForCurrentThread() != null)
|
||||||
{
|
{
|
||||||
// Must have a CoreWindow to access the resource context.
|
// Must have a CoreWindow to access the resource context.
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
<MtouchArch>x86_64</MtouchArch>
|
<MtouchArch>x86_64</MtouchArch>
|
||||||
<MtouchLink>None</MtouchLink>
|
<MtouchLink>None</MtouchLink>
|
||||||
<MtouchDebug>true</MtouchDebug>
|
<MtouchDebug>true</MtouchDebug>
|
||||||
|
<MtouchExtraArgs>-gcc_flags "-lc++ -lstdc++"</MtouchExtraArgs>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||||
<DebugType>portable</DebugType>
|
<DebugType>portable</DebugType>
|
||||||
|
@ -35,6 +36,7 @@
|
||||||
<MtouchLink>None</MtouchLink>
|
<MtouchLink>None</MtouchLink>
|
||||||
<MtouchArch>x86_64</MtouchArch>
|
<MtouchArch>x86_64</MtouchArch>
|
||||||
<ConsolePause>false</ConsolePause>
|
<ConsolePause>false</ConsolePause>
|
||||||
|
<MtouchExtraArgs>-gcc_flags "-lc++ -lstdc++"</MtouchExtraArgs>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
@ -49,6 +51,7 @@
|
||||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||||
<CodesignKey>iPhone Developer</CodesignKey>
|
<CodesignKey>iPhone Developer</CodesignKey>
|
||||||
<MtouchDebug>true</MtouchDebug>
|
<MtouchDebug>true</MtouchDebug>
|
||||||
|
<MtouchExtraArgs>-gcc_flags "-lc++ -lstdc++"</MtouchExtraArgs>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
|
@ -60,6 +63,7 @@
|
||||||
<MtouchArch>ARM64</MtouchArch>
|
<MtouchArch>ARM64</MtouchArch>
|
||||||
<ConsolePause>false</ConsolePause>
|
<ConsolePause>false</ConsolePause>
|
||||||
<CodesignKey>iPhone Developer</CodesignKey>
|
<CodesignKey>iPhone Developer</CodesignKey>
|
||||||
|
<MtouchExtraArgs>-gcc_flags "-lc++ -lstdc++"</MtouchExtraArgs>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
|
||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
|
@ -88,9 +92,12 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Main.cs" />
|
<Compile Include="Main.cs" />
|
||||||
<None Include="Info.plist" />
|
<None Include="Info.plist">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Content Include="Entitlements.plist" />
|
<Content Include="Entitlements.plist" />
|
||||||
|
<BundleResource Include="Resources\Fonts\CalcMDL2.ttf" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
@ -104,6 +111,16 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1457" />
|
<PackageReference Include="Uno.UI" Version="1.45.0-dev.1457" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup Condition=" '$(Platform)' == 'iPhoneSimulator' ">
|
||||||
|
<NativeReference Include="Native References/x86_64/libCalcManager.a">
|
||||||
|
<Kind>Static</Kind>
|
||||||
|
</NativeReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup Condition=" '$(Platform)' == 'iPhone' ">
|
||||||
|
<NativeReference Include="Native References/arm64/libCalcManager.a">
|
||||||
|
<Kind>Static</Kind>
|
||||||
|
</NativeReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="..\Calculator.Shared\Calculator.Shared.projitems" Label="Shared" Condition="Exists('..\Calculator.Shared\Calculator.Shared.projitems')" />
|
<Import Project="..\Calculator.Shared\Calculator.Shared.projitems" Label="Shared" Condition="Exists('..\Calculator.Shared\Calculator.Shared.projitems')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
|
@ -41,6 +41,7 @@
|
||||||
<key>UIAppFonts</key>
|
<key>UIAppFonts</key>
|
||||||
<array>
|
<array>
|
||||||
<string>Fonts/winjs-symbols.ttf</string>
|
<string>Fonts/winjs-symbols.ttf</string>
|
||||||
|
<string>Fonts/CalcMDL2.ttf</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
BIN
src/Calculator.iOS/Native References/arm64/libCalcManager.a
Normal file
BIN
src/Calculator.iOS/Native References/arm64/libCalcManager.a
Normal file
Binary file not shown.
BIN
src/Calculator.iOS/Native References/x86_64/libCalcManager.a
Normal file
BIN
src/Calculator.iOS/Native References/x86_64/libCalcManager.a
Normal file
Binary file not shown.
BIN
src/Calculator.iOS/Resources/Fonts/CalcMDL2.ttf
Normal file
BIN
src/Calculator.iOS/Resources/Fonts/CalcMDL2.ttf
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue