-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a solution to test calling constructors
- Loading branch information
1 parent
f674da6
commit c63f026
Showing
22 changed files
with
790 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?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:Laerdal.Dfu.Bindings.iOS.TestBindings" | ||
x:Class="Laerdal.Dfu.Bindings.iOS.TestBindings.App"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="Resources/Styles/Colors.xaml" /> | ||
<ResourceDictionary Source="Resources/Styles/Styles.xaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Laerdal.Dfu.Bindings.iOS.TestBindings; | ||
|
||
public partial class App : Application | ||
{ | ||
public App() | ||
{ | ||
InitializeComponent(); | ||
|
||
MainPage = new AppShell(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<Shell | ||
x:Class="Laerdal.Dfu.Bindings.iOS.TestBindings.AppShell" | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:local="clr-namespace:Laerdal.Dfu.Bindings.iOS.TestBindings" | ||
Shell.FlyoutBehavior="Disabled" | ||
Title="Laerdal.Dfu.Bindings.iOS.TestBindings"> | ||
|
||
<ShellContent | ||
Title="Home" | ||
ContentTemplate="{DataTemplate local:MainPage}" | ||
Route="MainPage" /> | ||
|
||
</Shell> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Laerdal.Dfu.Bindings.iOS.TestBindings; | ||
|
||
public partial class AppShell : Shell | ||
{ | ||
public AppShell() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
Laerdal.Dfu.Bindings.iOS.TestBindings/Laerdal.Dfu.Bindings.iOS.TestBindings.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0-ios</TargetFramework> | ||
|
||
<OutputType>Exe</OutputType> | ||
<RootNamespace>Laerdal.Dfu.Bindings.iOS.TestBindings</RootNamespace> | ||
<UseMaui>true</UseMaui> | ||
<SingleProject>true</SingleProject> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<!-- Display name --> | ||
<ApplicationTitle>Laerdal.Dfu.Bindings.iOS.TestBindings</ApplicationTitle> | ||
|
||
<!-- App Identifier --> | ||
<ApplicationId>com.companyname.laerdal.dfu.bindings.ios.testbindings</ApplicationId> | ||
|
||
<!-- Versions --> | ||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> | ||
<ApplicationVersion>1</ApplicationVersion> | ||
|
||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<!-- App Icon --> | ||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4"/> | ||
|
||
<!-- Splash Screen --> | ||
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128"/> | ||
|
||
<!-- Images --> | ||
<MauiImage Include="Resources\Images\*"/> | ||
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185"/> | ||
|
||
<!-- Custom Fonts --> | ||
<MauiFont Include="Resources\Fonts\*"/> | ||
|
||
<!-- Raw Assets (also remove the "Resources\Raw" prefix) --> | ||
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)"/> | ||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)"/> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-ios'"> | ||
<PackageReference Include="Laerdal.Dfu.Bindings.iOS" Version="4.13.0-local.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?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" | ||
x:Class="Laerdal.Dfu.Bindings.iOS.TestBindings.MainPage"> | ||
|
||
<ScrollView> | ||
<VerticalStackLayout | ||
Padding="30,0" | ||
Spacing="25"> | ||
<Image | ||
Source="dotnet_bot.png" | ||
HeightRequest="185" | ||
Aspect="AspectFit" | ||
SemanticProperties.Description="dot net bot in a race car number eight" /> | ||
|
||
<Label | ||
Text="Hello, World!" | ||
Style="{StaticResource Headline}" | ||
SemanticProperties.HeadingLevel="Level1" /> | ||
|
||
<Label | ||
Text="Welcome to .NET Multi-platform App UI" | ||
Style="{StaticResource SubHeadline}" | ||
SemanticProperties.HeadingLevel="Level2" | ||
SemanticProperties.Description="Welcome to dot net Multi platform App U I" /> | ||
|
||
<Button | ||
x:Name="CounterBtn" | ||
Text="Click me" | ||
SemanticProperties.Hint="Counts the number of times you click" | ||
Clicked="OnCounterClicked" | ||
HorizontalOptions="Fill" /> | ||
|
||
<Button | ||
x:Name="TestBtn" | ||
Text="Create instances" | ||
SemanticProperties.Hint="Creates instances of the test classes" | ||
Clicked="OnTestClicked" | ||
HorizontalOptions="Fill" /> | ||
</VerticalStackLayout> | ||
</ScrollView> | ||
|
||
</ContentPage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
namespace Laerdal.Dfu.Bindings.iOS.TestBindings; | ||
|
||
public partial class MainPage : ContentPage | ||
{ | ||
int count = 0; | ||
|
||
public MainPage() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void OnCounterClicked(object sender, EventArgs e) | ||
{ | ||
count++; | ||
|
||
if (count == 1) | ||
CounterBtn.Text = $"Clicked {count} time"; | ||
else | ||
CounterBtn.Text = $"Clicked {count} times"; | ||
|
||
SemanticScreenReader.Announce(CounterBtn.Text); | ||
} | ||
|
||
private void OnTestClicked(object? sender, EventArgs e) | ||
{ | ||
#if __ANDROID__ | ||
Laerdal.Dfu.Bindings.Android.DfuServiceInitiator initiator = | ||
new Laerdal.Dfu.Bindings.Android.DfuServiceInitiator("deviceId"); | ||
Console.WriteLine($"Laerdal.Dfu.Bindings.Android.BuildConfig.BuildType: {Laerdal.Dfu.Bindings.Android.BuildConfig.BuildType}"); | ||
Console.WriteLine($"Laerdal.Dfu.Bindings.Android.BuildConfig.Debug: {Laerdal.Dfu.Bindings.Android.BuildConfig.Debug}"); | ||
Console.WriteLine($"Laerdal.Dfu.Bindings.Android.BuildConfig.VersionCode: {Laerdal.Dfu.Bindings.Android.BuildConfig.VersionCode}"); | ||
Console.WriteLine($"Laerdal.Dfu.Bindings.Android.BuildConfig.VersionName: {Laerdal.Dfu.Bindings.Android.BuildConfig.VersionName}"); | ||
Console.WriteLine($"Laerdal.Dfu.Bindings.Android.BuildConfig.LibraryPackageName: {Laerdal.Dfu.Bindings.Android.BuildConfig.LibraryPackageName}"); | ||
Console.WriteLine($"Laerdal.Dfu.Bindings.Android.DfuServiceInitiator.DefaultPrnValue: {Laerdal.Dfu.Bindings.Android.DfuServiceInitiator.DefaultPrnValue}"); | ||
Console.WriteLine($"Laerdal.Dfu.Bindings.Android.DfuServiceInitiator.DefaultMbrSize: {Laerdal.Dfu.Bindings.Android.DfuServiceInitiator.DefaultMbrSize}"); | ||
Console.WriteLine($"Laerdal.Dfu.Bindings.Android.DfuServiceInitiator.DefaultScanTimeout: {Laerdal.Dfu.Bindings.Android.DfuServiceInitiator.DefaultScanTimeout}"); | ||
#elif __IOS__ | ||
|
||
Laerdal.Dfu.Bindings.iOS.DFUFirmware firmware = new Laerdal.Dfu.Bindings.iOS.DFUFirmware(new Foundation.NSUrl("", false), out var _); | ||
|
||
Laerdal.Dfu.Bindings.iOS.DFUServiceInitiator initiator = | ||
new Laerdal.Dfu.Bindings.iOS.DFUServiceInitiator(CoreFoundation.DispatchQueue.GetGlobalQueue(CoreFoundation | ||
.DispatchQueuePriority.Default), | ||
CoreFoundation.DispatchQueue.GetGlobalQueue(CoreFoundation | ||
.DispatchQueuePriority.Default), | ||
CoreFoundation.DispatchQueue.GetGlobalQueue(CoreFoundation | ||
.DispatchQueuePriority.Default), | ||
CoreFoundation.DispatchQueue.GetGlobalQueue(CoreFoundation | ||
.DispatchQueuePriority.Default), | ||
null); | ||
#endif | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Laerdal.Dfu.Bindings.iOS.TestBindings; | ||
|
||
public static class MauiProgram | ||
{ | ||
public static MauiApp CreateMauiApp() | ||
{ | ||
var builder = MauiApp.CreateBuilder(); | ||
builder.UseMauiApp<App>() | ||
.ConfigureFonts(fonts => { | ||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); | ||
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); | ||
}); | ||
|
||
#if DEBUG | ||
builder.Logging.AddDebug(); | ||
#endif | ||
|
||
return builder.Build(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
Laerdal.Dfu.Bindings.iOS.TestBindings/Platforms/iOS/AppDelegate.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using Foundation; | ||
|
||
namespace Laerdal.Dfu.Bindings.iOS.TestBindings; | ||
|
||
[Register("AppDelegate")] | ||
public class AppDelegate : MauiUIApplicationDelegate | ||
{ | ||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); | ||
} |
32 changes: 32 additions & 0 deletions
32
Laerdal.Dfu.Bindings.iOS.TestBindings/Platforms/iOS/Info.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?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>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<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> |
16 changes: 16 additions & 0 deletions
16
Laerdal.Dfu.Bindings.iOS.TestBindings/Platforms/iOS/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using ObjCRuntime; | ||
|
||
using UIKit; | ||
|
||
namespace Laerdal.Dfu.Bindings.iOS.TestBindings; | ||
|
||
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)); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
Laerdal.Dfu.Bindings.iOS.TestBindings/Resources/AppIcon/appicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions
8
Laerdal.Dfu.Bindings.iOS.TestBindings/Resources/AppIcon/appiconfg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+105 KB
Laerdal.Dfu.Bindings.iOS.TestBindings/Resources/Fonts/OpenSans-Regular.ttf
Binary file not shown.
Binary file added
BIN
+108 KB
Laerdal.Dfu.Bindings.iOS.TestBindings/Resources/Fonts/OpenSans-Semibold.ttf
Binary file not shown.
Binary file added
BIN
+68.2 KB
Laerdal.Dfu.Bindings.iOS.TestBindings/Resources/Images/dotnet_bot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
Laerdal.Dfu.Bindings.iOS.TestBindings/Resources/Raw/AboutAssets.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Any raw assets you want to be deployed with your application can be placed in | ||
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="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" /> | ||
|
||
These files will be deployed with you package and will be accessible using Essentials: | ||
|
||
async Task LoadMauiAsset() | ||
{ | ||
using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); | ||
using var reader = new StreamReader(stream); | ||
|
||
var contents = reader.ReadToEnd(); | ||
} |
8 changes: 8 additions & 0 deletions
8
Laerdal.Dfu.Bindings.iOS.TestBindings/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.
45 changes: 45 additions & 0 deletions
45
Laerdal.Dfu.Bindings.iOS.TestBindings/Resources/Styles/Colors.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<?xaml-comp compile="true" ?> | ||
<ResourceDictionary | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"> | ||
|
||
<!-- Note: For Android please see also Platforms\Android\Resources\values\colors.xml --> | ||
|
||
<Color x:Key="Primary">#512BD4</Color> | ||
<Color x:Key="PrimaryDark">#ac99ea</Color> | ||
<Color x:Key="PrimaryDarkText">#242424</Color> | ||
<Color x:Key="Secondary">#DFD8F7</Color> | ||
<Color x:Key="SecondaryDarkText">#9880e5</Color> | ||
<Color x:Key="Tertiary">#2B0B98</Color> | ||
|
||
<Color x:Key="White">White</Color> | ||
<Color x:Key="Black">Black</Color> | ||
<Color x:Key="Magenta">#D600AA</Color> | ||
<Color x:Key="MidnightBlue">#190649</Color> | ||
<Color x:Key="OffBlack">#1f1f1f</Color> | ||
|
||
<Color x:Key="Gray100">#E1E1E1</Color> | ||
<Color x:Key="Gray200">#C8C8C8</Color> | ||
<Color x:Key="Gray300">#ACACAC</Color> | ||
<Color x:Key="Gray400">#919191</Color> | ||
<Color x:Key="Gray500">#6E6E6E</Color> | ||
<Color x:Key="Gray600">#404040</Color> | ||
<Color x:Key="Gray900">#212121</Color> | ||
<Color x:Key="Gray950">#141414</Color> | ||
|
||
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource Primary}"/> | ||
<SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource Secondary}"/> | ||
<SolidColorBrush x:Key="TertiaryBrush" Color="{StaticResource Tertiary}"/> | ||
<SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource White}"/> | ||
<SolidColorBrush x:Key="BlackBrush" Color="{StaticResource Black}"/> | ||
|
||
<SolidColorBrush x:Key="Gray100Brush" Color="{StaticResource Gray100}"/> | ||
<SolidColorBrush x:Key="Gray200Brush" Color="{StaticResource Gray200}"/> | ||
<SolidColorBrush x:Key="Gray300Brush" Color="{StaticResource Gray300}"/> | ||
<SolidColorBrush x:Key="Gray400Brush" Color="{StaticResource Gray400}"/> | ||
<SolidColorBrush x:Key="Gray500Brush" Color="{StaticResource Gray500}"/> | ||
<SolidColorBrush x:Key="Gray600Brush" Color="{StaticResource Gray600}"/> | ||
<SolidColorBrush x:Key="Gray900Brush" Color="{StaticResource Gray900}"/> | ||
<SolidColorBrush x:Key="Gray950Brush" Color="{StaticResource Gray950}"/> | ||
</ResourceDictionary> |
Oops, something went wrong.