From 7704f85bfae931a4d266ebddc04e6ac1d2152a2f Mon Sep 17 00:00:00 2001 From: Alexander Zabluda Date: Fri, 20 Oct 2017 12:45:01 +0200 Subject: [PATCH] Add quick and dirty WcfSample.Android application. We have to wait for https://github.com/dotnet/sdk/issues/491 (as per http://www.natemcmaster.com/blog/2017/03/09/vs2015-to-vs2017-upgrade/) until we get better support for Xamarin.Android projects in dotnet/sdk. For now the project is excluded from the build. Enthusiasts may reactivate it in VS - Build - Configuration Manager. --- InfoCarrier.Core.sln | 11 +- .../WcfSample.Android/Assets/AboutAssets.txt | 19 ++ sample/WcfSample.Android/MainActivity.cs | 92 ++++++++++ .../Properties/AndroidManifest.xml | 9 + .../Properties/AssemblyInfo.cs | 31 ++++ .../Resources/AboutResources.txt | 44 +++++ .../Resources/Resource.Designer.cs | 118 +++++++++++++ .../Resources/layout/Main.axml | 27 +++ .../Resources/mipmap-hdpi/Icon.png | Bin 0 -> 2201 bytes .../Resources/mipmap-mdpi/Icon.png | Bin 0 -> 1410 bytes .../Resources/mipmap-xhdpi/Icon.png | Bin 0 -> 3237 bytes .../Resources/mipmap-xxhdpi/Icon.png | Bin 0 -> 5414 bytes .../Resources/mipmap-xxxhdpi/Icon.png | Bin 0 -> 7825 bytes .../Resources/values/Strings.xml | 5 + .../WcfSample.Android.csproj | 166 ++++++++++++++++++ sample/WcfSample.Android/packages.config | 72 ++++++++ 16 files changed, 591 insertions(+), 3 deletions(-) create mode 100644 sample/WcfSample.Android/Assets/AboutAssets.txt create mode 100644 sample/WcfSample.Android/MainActivity.cs create mode 100644 sample/WcfSample.Android/Properties/AndroidManifest.xml create mode 100644 sample/WcfSample.Android/Properties/AssemblyInfo.cs create mode 100644 sample/WcfSample.Android/Resources/AboutResources.txt create mode 100644 sample/WcfSample.Android/Resources/Resource.Designer.cs create mode 100644 sample/WcfSample.Android/Resources/layout/Main.axml create mode 100644 sample/WcfSample.Android/Resources/mipmap-hdpi/Icon.png create mode 100644 sample/WcfSample.Android/Resources/mipmap-mdpi/Icon.png create mode 100644 sample/WcfSample.Android/Resources/mipmap-xhdpi/Icon.png create mode 100644 sample/WcfSample.Android/Resources/mipmap-xxhdpi/Icon.png create mode 100644 sample/WcfSample.Android/Resources/mipmap-xxxhdpi/Icon.png create mode 100644 sample/WcfSample.Android/Resources/values/Strings.xml create mode 100644 sample/WcfSample.Android/WcfSample.Android.csproj create mode 100644 sample/WcfSample.Android/packages.config diff --git a/InfoCarrier.Core.sln b/InfoCarrier.Core.sln index fca5aca..f9894d0 100644 --- a/InfoCarrier.Core.sln +++ b/InfoCarrier.Core.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26730.16 +VisualStudioVersion = 15.0.27004.2005 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfoCarrier.Core", "src\InfoCarrier.Core\InfoCarrier.Core.csproj", "{6B24F793-C93B-4869-A99B-AC51EE2C82AF}" EndProject @@ -15,9 +15,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{4A57BB EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WcfSample.Shared", "sample\WcfSample.Shared\WcfSample.Shared.csproj", "{4AF12B6E-9979-4146-86BC-F59F6D00E4A0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WcfSample.Server", "sample\WcfSample.Server\WcfSample.Server.csproj", "{C43F891C-7548-4E22-B0C6-A5E931BEC278}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WcfSample.Server", "sample\WcfSample.Server\WcfSample.Server.csproj", "{C43F891C-7548-4E22-B0C6-A5E931BEC278}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WcfSample.Client", "sample\WcfSample.Client\WcfSample.Client.csproj", "{27B10A37-901E-4A3E-A2E3-4B48C62F0EB9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WcfSample.Client", "sample\WcfSample.Client\WcfSample.Client.csproj", "{27B10A37-901E-4A3E-A2E3-4B48C62F0EB9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WcfSample.Android", "sample\WcfSample.Android\WcfSample.Android.csproj", "{A26F1176-705E-490A-ADE3-F8B12DE1D970}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -45,6 +47,8 @@ Global {27B10A37-901E-4A3E-A2E3-4B48C62F0EB9}.Debug|Any CPU.Build.0 = Debug|Any CPU {27B10A37-901E-4A3E-A2E3-4B48C62F0EB9}.Release|Any CPU.ActiveCfg = Release|Any CPU {27B10A37-901E-4A3E-A2E3-4B48C62F0EB9}.Release|Any CPU.Build.0 = Release|Any CPU + {A26F1176-705E-490A-ADE3-F8B12DE1D970}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A26F1176-705E-490A-ADE3-F8B12DE1D970}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -55,6 +59,7 @@ Global {4AF12B6E-9979-4146-86BC-F59F6D00E4A0} = {4A57BB06-6B50-4CF8-A601-E5572247FB5F} {C43F891C-7548-4E22-B0C6-A5E931BEC278} = {4A57BB06-6B50-4CF8-A601-E5572247FB5F} {27B10A37-901E-4A3E-A2E3-4B48C62F0EB9} = {4A57BB06-6B50-4CF8-A601-E5572247FB5F} + {A26F1176-705E-490A-ADE3-F8B12DE1D970} = {4A57BB06-6B50-4CF8-A601-E5572247FB5F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {ADB840D9-C641-42AF-907B-8FE9280E9A8D} diff --git a/sample/WcfSample.Android/Assets/AboutAssets.txt b/sample/WcfSample.Android/Assets/AboutAssets.txt new file mode 100644 index 0000000..ee39886 --- /dev/null +++ b/sample/WcfSample.Android/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 you 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"); \ No newline at end of file diff --git a/sample/WcfSample.Android/MainActivity.cs b/sample/WcfSample.Android/MainActivity.cs new file mode 100644 index 0000000..3eb2c9a --- /dev/null +++ b/sample/WcfSample.Android/MainActivity.cs @@ -0,0 +1,92 @@ +// Copyright (c) on/off it-solutions gmbh. All rights reserved. +// Licensed under the MIT license. See license.txt file in the project root for license information. + +namespace WcfSample +{ + using System; + using System.Linq; + using System.Threading; + using System.Threading.Tasks; + using global::Android.App; + using global::Android.OS; + using global::Android.Widget; + using InfoCarrier.Core.Client; + using InfoCarrier.Core.Common; + using Microsoft.EntityFrameworkCore; + + [Activity(Label = "WcfSample.Android", MainLauncher = true, Icon = "@mipmap/icon")] + public class MainActivity : Activity + { + protected override void OnCreate(Bundle savedInstanceState) + { + base.OnCreate(savedInstanceState); + + // Set our view from the "main" layout resource + this.SetContentView(Resource.Layout.Main); + + // Get our button from the layout resource, + // and attach an event to it + Button button = this.FindViewById