From 3c497bf4c9259781f5e85442e4ea56924a16fd2d Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 25 Jul 2018 15:49:50 +0200 Subject: add HelloworldXamarin scaffolding --- examples/csharp/HelloworldXamarin/.gitignore | 41 +++++ .../HelloworldXamarin/Droid/Assets/AboutAssets.txt | 19 ++ .../Droid/HelloworldXamarin.Droid.csproj | 67 +++++++ .../csharp/HelloworldXamarin/Droid/MainActivity.cs | 27 +++ .../Droid/Properties/AndroidManifest.xml | 6 + .../Droid/Properties/AssemblyInfo.cs | 27 +++ .../Droid/Resources/AboutResources.txt | 44 +++++ .../Droid/Resources/Resource.designer.cs | 63 +++++++ .../Droid/Resources/layout/Main.axml | 4 + .../Droid/Resources/mipmap-hdpi/Icon.png | Bin 0 -> 2201 bytes .../Droid/Resources/mipmap-mdpi/Icon.png | Bin 0 -> 1410 bytes .../Droid/Resources/mipmap-xhdpi/Icon.png | Bin 0 -> 3237 bytes .../Droid/Resources/mipmap-xxhdpi/Icon.png | Bin 0 -> 5414 bytes .../Droid/Resources/mipmap-xxxhdpi/Icon.png | Bin 0 -> 7825 bytes .../Droid/Resources/values/Strings.xml | 5 + .../csharp/HelloworldXamarin/HelloworldXamarin.sln | 45 +++++ .../HelloworldXamarin/HelloworldXamarin.projitems | 14 ++ .../HelloworldXamarin/HelloworldXamarin.shproj | 11 ++ .../HelloworldXamarin/HelloworldXamarin/MyClass.cs | 10 + .../csharp/HelloworldXamarin/iOS/AppDelegate.cs | 59 ++++++ .../AppIcon.appiconset/Contents.json | 202 +++++++++++++++++++++ .../iOS/Assets.xcassets/Contents.json | 6 + .../HelloworldXamarin/iOS/Entitlements.plist | 6 + .../iOS/HelloworldXamarin.iOS.csproj | 110 +++++++++++ examples/csharp/HelloworldXamarin/iOS/Info.plist | 48 +++++ .../HelloworldXamarin/iOS/LaunchScreen.storyboard | 27 +++ examples/csharp/HelloworldXamarin/iOS/Main.cs | 20 ++ .../csharp/HelloworldXamarin/iOS/Main.storyboard | 40 ++++ .../csharp/HelloworldXamarin/iOS/ViewController.cs | 34 ++++ .../iOS/ViewController.designer.cs | 25 +++ 30 files changed, 960 insertions(+) create mode 100644 examples/csharp/HelloworldXamarin/.gitignore create mode 100644 examples/csharp/HelloworldXamarin/Droid/Assets/AboutAssets.txt create mode 100644 examples/csharp/HelloworldXamarin/Droid/HelloworldXamarin.Droid.csproj create mode 100644 examples/csharp/HelloworldXamarin/Droid/MainActivity.cs create mode 100644 examples/csharp/HelloworldXamarin/Droid/Properties/AndroidManifest.xml create mode 100644 examples/csharp/HelloworldXamarin/Droid/Properties/AssemblyInfo.cs create mode 100644 examples/csharp/HelloworldXamarin/Droid/Resources/AboutResources.txt create mode 100644 examples/csharp/HelloworldXamarin/Droid/Resources/Resource.designer.cs create mode 100644 examples/csharp/HelloworldXamarin/Droid/Resources/layout/Main.axml create mode 100644 examples/csharp/HelloworldXamarin/Droid/Resources/mipmap-hdpi/Icon.png create mode 100644 examples/csharp/HelloworldXamarin/Droid/Resources/mipmap-mdpi/Icon.png create mode 100644 examples/csharp/HelloworldXamarin/Droid/Resources/mipmap-xhdpi/Icon.png create mode 100644 examples/csharp/HelloworldXamarin/Droid/Resources/mipmap-xxhdpi/Icon.png create mode 100644 examples/csharp/HelloworldXamarin/Droid/Resources/mipmap-xxxhdpi/Icon.png create mode 100644 examples/csharp/HelloworldXamarin/Droid/Resources/values/Strings.xml create mode 100644 examples/csharp/HelloworldXamarin/HelloworldXamarin.sln create mode 100644 examples/csharp/HelloworldXamarin/HelloworldXamarin/HelloworldXamarin.projitems create mode 100644 examples/csharp/HelloworldXamarin/HelloworldXamarin/HelloworldXamarin.shproj create mode 100644 examples/csharp/HelloworldXamarin/HelloworldXamarin/MyClass.cs create mode 100644 examples/csharp/HelloworldXamarin/iOS/AppDelegate.cs create mode 100644 examples/csharp/HelloworldXamarin/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 examples/csharp/HelloworldXamarin/iOS/Assets.xcassets/Contents.json create mode 100644 examples/csharp/HelloworldXamarin/iOS/Entitlements.plist create mode 100644 examples/csharp/HelloworldXamarin/iOS/HelloworldXamarin.iOS.csproj create mode 100644 examples/csharp/HelloworldXamarin/iOS/Info.plist create mode 100644 examples/csharp/HelloworldXamarin/iOS/LaunchScreen.storyboard create mode 100644 examples/csharp/HelloworldXamarin/iOS/Main.cs create mode 100644 examples/csharp/HelloworldXamarin/iOS/Main.storyboard create mode 100644 examples/csharp/HelloworldXamarin/iOS/ViewController.cs create mode 100644 examples/csharp/HelloworldXamarin/iOS/ViewController.designer.cs (limited to 'examples') diff --git a/examples/csharp/HelloworldXamarin/.gitignore b/examples/csharp/HelloworldXamarin/.gitignore new file mode 100644 index 0000000000..bf793edcc6 --- /dev/null +++ b/examples/csharp/HelloworldXamarin/.gitignore @@ -0,0 +1,41 @@ +# Autosave files +*~ + +# build +[Oo]bj/ +[Bb]in/ +packages/ +TestResults/ + +# globs +Makefile.in +*.DS_Store +*.sln.cache +*.suo +*.cache +*.pidb +*.userprefs +*.usertasks +config.log +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.user +*.tar.gz +tarballs/ +test-results/ +Thumbs.db +.vs/ + +# Mac bundle stuff +*.dmg +*.app + +# resharper +*_Resharper.* +*.Resharper + +# dotCover +*.dotCover diff --git a/examples/csharp/HelloworldXamarin/Droid/Assets/AboutAssets.txt b/examples/csharp/HelloworldXamarin/Droid/Assets/AboutAssets.txt new file mode 100644 index 0000000000..a9b0638eb1 --- /dev/null +++ b/examples/csharp/HelloworldXamarin/Droid/Assets/AboutAssets.txt @@ -0,0 +1,19 @@ +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 "AndroidAsset". + +These files will be deployed with your package and will be accessible using Android's +AssetManager, like this: + +public class ReadAsset : Activity +{ + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + InputStream input = Assets.Open ("my_asset.txt"); + } +} + +Additionally, some Android functions will automatically load asset files: + +Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); diff --git a/examples/csharp/HelloworldXamarin/Droid/HelloworldXamarin.Droid.csproj b/examples/csharp/HelloworldXamarin/Droid/HelloworldXamarin.Droid.csproj new file mode 100644 index 0000000000..20f1cedb87 --- /dev/null +++ b/examples/csharp/HelloworldXamarin/Droid/HelloworldXamarin.Droid.csproj @@ -0,0 +1,67 @@ + + + + Debug + AnyCPU + {B9B0D41C-1C07-4590-A919-5865E741B2EA} + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + HelloworldXamarin.Droid + HelloworldXamarin.Droid + v8.1 + True + Resources\Resource.designer.cs + Resource + Properties\AndroidManifest.xml + Resources + Assets + true + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + None + + + true + pdbonly + true + bin\Release + prompt + 4 + true + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/csharp/HelloworldXamarin/Droid/MainActivity.cs b/examples/csharp/HelloworldXamarin/Droid/MainActivity.cs new file mode 100644 index 0000000000..20982422f2 --- /dev/null +++ b/examples/csharp/HelloworldXamarin/Droid/MainActivity.cs @@ -0,0 +1,27 @@ +using Android.App; +using Android.Widget; +using Android.OS; + +namespace HelloworldXamarin.Droid +{ + [Activity(Label = "HelloworldXamarin", MainLauncher = true, Icon = "@mipmap/icon")] + public class MainActivity : Activity + { + int count = 1; + + protected override void OnCreate(Bundle savedInstanceState) + { + base.OnCreate(savedInstanceState); + + // Set our view from the "main" layout resource + SetContentView(Resource.Layout.Main); + + // Get our button from the layout resource, + // and attach an event to it + Button button = FindViewById + + + + + + + + + + + + + + + + diff --git a/examples/csharp/HelloworldXamarin/iOS/ViewController.cs b/examples/csharp/HelloworldXamarin/iOS/ViewController.cs new file mode 100644 index 0000000000..dfbaf084b6 --- /dev/null +++ b/examples/csharp/HelloworldXamarin/iOS/ViewController.cs @@ -0,0 +1,34 @@ +using System; + +using UIKit; + +namespace HelloworldXamarin.iOS +{ + public partial class ViewController : UIViewController + { + int count = 1; + + public ViewController(IntPtr handle) : base(handle) + { + } + + public override void ViewDidLoad() + { + base.ViewDidLoad(); + + // Perform any additional setup after loading the view, typically from a nib. + Button.AccessibilityIdentifier = "myButton"; + Button.TouchUpInside += delegate + { + var title = string.Format("{0} clicks!", count++); + Button.SetTitle(title, UIControlState.Normal); + }; + } + + public override void DidReceiveMemoryWarning() + { + base.DidReceiveMemoryWarning(); + // Release any cached data, images, etc that aren't in use. + } + } +} diff --git a/examples/csharp/HelloworldXamarin/iOS/ViewController.designer.cs b/examples/csharp/HelloworldXamarin/iOS/ViewController.designer.cs new file mode 100644 index 0000000000..2677a068dc --- /dev/null +++ b/examples/csharp/HelloworldXamarin/iOS/ViewController.designer.cs @@ -0,0 +1,25 @@ +// +// This file has been generated automatically by MonoDevelop to store outlets and +// actions made in the Xcode designer. If it is removed, they will be lost. +// Manual changes to this file may not be handled correctly. +// +using Foundation; + +namespace HelloworldXamarin.iOS +{ + [Register("ViewController")] + partial class ViewController + { + [Outlet] + UIKit.UIButton Button { get; set; } + + void ReleaseDesignerOutlets() + { + if (Button != null) + { + Button.Dispose(); + Button = null; + } + } + } +} -- cgit v1.2.3