diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Assets/AboutAssets.txt b/QSharpXamDemo/QSharpXamDemo.Android/Assets/AboutAssets.txt new file mode 100644 index 0000000..072563f --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.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 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/QSharpXamDemo/QSharpXamDemo.Android/MainActivity.cs b/QSharpXamDemo/QSharpXamDemo.Android/MainActivity.cs new file mode 100644 index 0000000..d65a8e8 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.Android/MainActivity.cs @@ -0,0 +1,36 @@ +using System; + +using Android.App; +using Android.Content.PM; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using Android.OS; +using Serilog; + +namespace QSharpXamDemo.Droid +{ + [Activity(Label = "QSharpXamDemo", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] + public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity + { + protected override void OnCreate(Bundle savedInstanceState) + { + TabLayoutResource = Resource.Layout.Tabbar; + ToolbarResource = Resource.Layout.Toolbar; + + base.OnCreate(savedInstanceState); + + Log.Logger = new LoggerConfiguration().WriteTo.AndroidLog().MinimumLevel.Debug().CreateLogger(); + + Xamarin.Essentials.Platform.Init(this, savedInstanceState); + global::Xamarin.Forms.Forms.Init(this, savedInstanceState); + LoadApplication(new App()); + } + public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) + { + Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); + + base.OnRequestPermissionsResult(requestCode, permissions, grantResults); + } + } +} \ No newline at end of file diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Properties/AndroidManifest.xml b/QSharpXamDemo/QSharpXamDemo.Android/Properties/AndroidManifest.xml new file mode 100644 index 0000000..b043757 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.Android/Properties/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Properties/AssemblyInfo.cs b/QSharpXamDemo/QSharpXamDemo.Android/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..aea06e1 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.Android/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Android.App; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("QSharpXamDemo.Android")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("QSharpXamDemo.Android")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +// Add some common permissions, these can be removed if not needed +[assembly: UsesPermission(Android.Manifest.Permission.Internet)] +[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)] diff --git a/QSharpXamDemo/QSharpXamDemo.Android/QSharpXamDemo.Android.csproj b/QSharpXamDemo/QSharpXamDemo.Android/QSharpXamDemo.Android.csproj new file mode 100644 index 0000000..750e15f --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.Android/QSharpXamDemo.Android.csproj @@ -0,0 +1,110 @@ + + + + Debug + AnyCPU + {4F7F13C7-85EF-431F-AB03-B2494F0F4C7F} + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {c9e5eea5-ca05-42a1-839b-61506e0a37df} + Library + QSharpXamDemo.Droid + QSharpXamDemo.Android + True + True + Resources\Resource.designer.cs + Resource + Properties\AndroidManifest.xml + Resources + Assets + false + v9.0 + true + true + Xamarin.Android.Net.AndroidClientHandler + + + + + true + portable + false + bin\Debug + DEBUG; + prompt + 4 + None + + + true + portable + true + bin\Release + prompt + 4 + true + false + + + + + + + + + + + + + 0.2.0.64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {51cd2579-79c9-49a9-b68d-93cbe878baa1} + QSharp + + + {48097AD8-2188-4F99-8092-E4EFD7571268} + QSharpXamDemo + + + + + + + + + \ No newline at end of file diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/AboutResources.txt b/QSharpXamDemo/QSharpXamDemo.Android/Resources/AboutResources.txt new file mode 100644 index 0000000..cb30f20 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.Android/Resources/AboutResources.txt @@ -0,0 +1,50 @@ +Images, layout descriptions, binary blobs and string dictionaries can be included +in your application as resource files. Various Android APIs are designed to +operate on the resource IDs instead of dealing with images, strings or binary blobs +directly. + +For example, a sample Android app that contains a user interface layout (main.xml), +an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) +would keep its resources in the "Resources" directory of the application: + +Resources/ + drawable-hdpi/ + icon.png + + drawable-ldpi/ + icon.png + + drawable-mdpi/ + icon.png + + layout/ + main.xml + + values/ + strings.xml + +In order to get the build system to recognize Android resources, set the build action to +"AndroidResource". The native Android APIs do not operate directly with filenames, but +instead operate on resource IDs. When you compile an Android application that uses resources, +the build system will package the resources for distribution and generate a class called +"Resource" that contains the tokens for each one of the resources included. For example, +for the above Resources layout, this is what the Resource class would expose: + +public class Resource { + public class drawable { + public const int icon = 0x123; + } + + public class layout { + public const int main = 0x456; + } + + public class strings { + public const int first_string = 0xabc; + public const int second_string = 0xbcd; + } +} + +You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main +to reference the layout/main.xml file, or Resource.strings.first_string to reference the first +string in the dictionary file values/strings.xml. diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/layout/Tabbar.xml b/QSharpXamDemo/QSharpXamDemo.Android/Resources/layout/Tabbar.xml new file mode 100644 index 0000000..ad1f87d --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.Android/Resources/layout/Tabbar.xml @@ -0,0 +1,11 @@ + + diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/layout/Toolbar.xml b/QSharpXamDemo/QSharpXamDemo.Android/Resources/layout/Toolbar.xml new file mode 100644 index 0000000..aabd0a3 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.Android/Resources/layout/Toolbar.xml @@ -0,0 +1,9 @@ + + diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-anydpi-v26/icon.xml b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-anydpi-v26/icon.xml new file mode 100644 index 0000000..88d1d0a --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-anydpi-v26/icon.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-anydpi-v26/icon_round.xml b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-anydpi-v26/icon_round.xml new file mode 100644 index 0000000..88d1d0a --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-anydpi-v26/icon_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-hdpi/icon.png b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-hdpi/icon.png new file mode 100644 index 0000000..4623ca2 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-hdpi/icon.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-hdpi/launcher_foreground.png b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-hdpi/launcher_foreground.png new file mode 100644 index 0000000..a89e5bb Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-hdpi/launcher_foreground.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-mdpi/icon.png b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-mdpi/icon.png new file mode 100644 index 0000000..9b1d25e Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-mdpi/icon.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-mdpi/launcher_foreground.png b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-mdpi/launcher_foreground.png new file mode 100644 index 0000000..431a8a0 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-mdpi/launcher_foreground.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xhdpi/icon.png b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xhdpi/icon.png new file mode 100644 index 0000000..844dfe5 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xhdpi/icon.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xhdpi/launcher_foreground.png b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xhdpi/launcher_foreground.png new file mode 100644 index 0000000..9e9e4f8 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xhdpi/launcher_foreground.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xxhdpi/icon.png b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xxhdpi/icon.png new file mode 100644 index 0000000..e20ec9a Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xxhdpi/icon.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xxhdpi/launcher_foreground.png b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xxhdpi/launcher_foreground.png new file mode 100644 index 0000000..5f1e135 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xxhdpi/launcher_foreground.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xxxhdpi/icon.png b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xxxhdpi/icon.png new file mode 100644 index 0000000..8a08bf7 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xxxhdpi/icon.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png new file mode 100644 index 0000000..aca9f8d Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/values/colors.xml b/QSharpXamDemo/QSharpXamDemo.Android/Resources/values/colors.xml new file mode 100644 index 0000000..d9f6e0b --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.Android/Resources/values/colors.xml @@ -0,0 +1,7 @@ + + + #FFFFFF + #3F51B5 + #303F9F + #FF4081 + diff --git a/QSharpXamDemo/QSharpXamDemo.Android/Resources/values/styles.xml b/QSharpXamDemo/QSharpXamDemo.Android/Resources/values/styles.xml new file mode 100644 index 0000000..17a2eb0 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.Android/Resources/values/styles.xml @@ -0,0 +1,30 @@ + + + + + + + + + diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/AppDelegate.cs b/QSharpXamDemo/QSharpXamDemo.iOS/AppDelegate.cs new file mode 100644 index 0000000..bc74b29 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.iOS/AppDelegate.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using Foundation; +using UIKit; +using Serilog; +namespace QSharpXamDemo.iOS +{ + // The UIApplicationDelegate for the application. This class is responsible for launching the + // User Interface of the application, as well as listening (and optionally responding) to + // application events from iOS. + [Register("AppDelegate")] + public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate + { + // + // This method is invoked when the application has loaded and is ready to run. In this + // method you should instantiate the window, load the UI into it and then make the window + // visible. + // + // You have 17 seconds to return from this method, or iOS will terminate your application. + // + public override bool FinishedLaunching(UIApplication app, NSDictionary options) + { + global::Xamarin.Forms.Forms.Init(); + Log.Logger = new LoggerConfiguration().WriteTo.NSLog().MinimumLevel.Debug().CreateLogger(); + LoadApplication(new App()); + + return base.FinishedLaunching(app, options); + } + } +} diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..98f4d03 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,117 @@ +{ + "images": [ + { + "scale": "2x", + "size": "20x20", + "idiom": "iphone", + "filename": "Icon40.png" + }, + { + "scale": "3x", + "size": "20x20", + "idiom": "iphone", + "filename": "Icon60.png" + }, + { + "scale": "2x", + "size": "29x29", + "idiom": "iphone", + "filename": "Icon58.png" + }, + { + "scale": "3x", + "size": "29x29", + "idiom": "iphone", + "filename": "Icon87.png" + }, + { + "scale": "2x", + "size": "40x40", + "idiom": "iphone", + "filename": "Icon80.png" + }, + { + "scale": "3x", + "size": "40x40", + "idiom": "iphone", + "filename": "Icon120.png" + }, + { + "scale": "2x", + "size": "60x60", + "idiom": "iphone", + "filename": "Icon120.png" + }, + { + "scale": "3x", + "size": "60x60", + "idiom": "iphone", + "filename": "Icon180.png" + }, + { + "scale": "1x", + "size": "20x20", + "idiom": "ipad", + "filename": "Icon20.png" + }, + { + "scale": "2x", + "size": "20x20", + "idiom": "ipad", + "filename": "Icon40.png" + }, + { + "scale": "1x", + "size": "29x29", + "idiom": "ipad", + "filename": "Icon29.png" + }, + { + "scale": "2x", + "size": "29x29", + "idiom": "ipad", + "filename": "Icon58.png" + }, + { + "scale": "1x", + "size": "40x40", + "idiom": "ipad", + "filename": "Icon40.png" + }, + { + "scale": "2x", + "size": "40x40", + "idiom": "ipad", + "filename": "Icon80.png" + }, + { + "scale": "1x", + "size": "76x76", + "idiom": "ipad", + "filename": "Icon76.png" + }, + { + "scale": "2x", + "size": "76x76", + "idiom": "ipad", + "filename": "Icon152.png" + }, + { + "scale": "2x", + "size": "83.5x83.5", + "idiom": "ipad", + "filename": "Icon167.png" + }, + { + "scale": "1x", + "size": "1024x1024", + "idiom": "ios-marketing", + "filename": "Icon1024.png" + } + ], + "properties": {}, + "info": { + "version": 1, + "author": "xcode" + } +} \ No newline at end of file diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png new file mode 100644 index 0000000..9174c98 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png new file mode 100644 index 0000000..9c60a17 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png new file mode 100644 index 0000000..448d6ef Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png new file mode 100644 index 0000000..8524768 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png new file mode 100644 index 0000000..60a6470 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png new file mode 100644 index 0000000..45268a6 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png new file mode 100644 index 0000000..6a6c77a Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png new file mode 100644 index 0000000..cc7edcf Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png new file mode 100644 index 0000000..1ad04f0 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png new file mode 100644 index 0000000..2dd5262 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png new file mode 100644 index 0000000..b058cae Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png new file mode 100644 index 0000000..02e47a2 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png new file mode 100644 index 0000000..4954a4b Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Entitlements.plist b/QSharpXamDemo/QSharpXamDemo.iOS/Entitlements.plist new file mode 100644 index 0000000..e9a3005 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.iOS/Entitlements.plist @@ -0,0 +1,7 @@ + + + + + + + diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Info.plist b/QSharpXamDemo/QSharpXamDemo.iOS/Info.plist new file mode 100644 index 0000000..d1c7985 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.iOS/Info.plist @@ -0,0 +1,38 @@ + + + + + UIDeviceFamily + + 1 + 2 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + MinimumOSVersion + 8.0 + CFBundleDisplayName + QSharpXamDemo + CFBundleIdentifier + com.companyname.QSharpXamDemo + CFBundleVersion + 1.0 + UILaunchStoryboardName + LaunchScreen + CFBundleName + QSharpXamDemo + XSAppIconAssets + Assets.xcassets/AppIcon.appiconset + + diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Main.cs b/QSharpXamDemo/QSharpXamDemo.iOS/Main.cs new file mode 100644 index 0000000..5feba49 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.iOS/Main.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using Foundation; +using UIKit; + +namespace QSharpXamDemo.iOS +{ + public class Application + { + // 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, "AppDelegate"); + } + } +} diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Properties/AssemblyInfo.cs b/QSharpXamDemo/QSharpXamDemo.iOS/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ea74fc0 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.iOS/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("QSharpXamDemo.iOS")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("QSharpXamDemo.iOS")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/QSharpXamDemo.iOS.csproj b/QSharpXamDemo/QSharpXamDemo.iOS/QSharpXamDemo.iOS.csproj new file mode 100644 index 0000000..e83f584 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.iOS/QSharpXamDemo.iOS.csproj @@ -0,0 +1,142 @@ + + + + Debug + iPhoneSimulator + 8.0.30703 + 2.0 + {9A10344E-F9FB-4319-9665-CB7E78FCF4F4} + {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {6143fdea-f3c2-4a09-aafa-6e230626515e} + Exe + QSharpXamDemo.iOS + Resources + QSharpXamDemo.iOS + true + NSUrlSessionHandler + automatic + + + true + full + false + bin\iPhoneSimulator\Debug + DEBUG + prompt + 4 + x86_64 + None + true + + + none + true + bin\iPhoneSimulator\Release + prompt + 4 + None + x86_64 + + + true + full + false + bin\iPhone\Debug + DEBUG + prompt + 4 + ARM64 + iPhone Developer + true + Entitlements.plist + None + -all + + + none + true + bin\iPhone\Release + prompt + 4 + ARM64 + iPhone Developer + Entitlements.plist + + + + + + + + + + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + false + + + + + + + + + + + + + 2.9.0 + + + 0.2.0.64 + + + + + + + + {48097AD8-2188-4F99-8092-E4EFD7571268} + QSharpXamDemo + + + \ No newline at end of file diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default-568h@2x.png b/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default-568h@2x.png new file mode 100644 index 0000000..26c6461 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default-568h@2x.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default-Portrait.png b/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default-Portrait.png new file mode 100644 index 0000000..5d0d1ab Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default-Portrait.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default-Portrait@2x.png b/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default-Portrait@2x.png new file mode 100644 index 0000000..0ee2688 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default-Portrait@2x.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default.png b/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default.png new file mode 100644 index 0000000..b74643c Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default@2x.png b/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default@2x.png new file mode 100644 index 0000000..dbd6bd3 Binary files /dev/null and b/QSharpXamDemo/QSharpXamDemo.iOS/Resources/Default@2x.png differ diff --git a/QSharpXamDemo/QSharpXamDemo.iOS/Resources/LaunchScreen.storyboard b/QSharpXamDemo/QSharpXamDemo.iOS/Resources/LaunchScreen.storyboard new file mode 100644 index 0000000..a639c2f --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo.iOS/Resources/LaunchScreen.storyboard @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/QSharpXamDemo/QSharpXamDemo/App.xaml b/QSharpXamDemo/QSharpXamDemo/App.xaml new file mode 100644 index 0000000..d3b2d21 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo/App.xaml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/QSharpXamDemo/QSharpXamDemo/App.xaml.cs b/QSharpXamDemo/QSharpXamDemo/App.xaml.cs new file mode 100644 index 0000000..d2e9ea5 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo/App.xaml.cs @@ -0,0 +1,28 @@ +using System; +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace QSharpXamDemo +{ + public partial class App : Application + { + public App() + { + InitializeComponent(); + + MainPage = new NavigationPage(new MainPage()); + } + + protected override void OnStart() + { + } + + protected override void OnSleep() + { + } + + protected override void OnResume() + { + } + } +} diff --git a/QSharpXamDemo/QSharpXamDemo/AssemblyInfo.cs b/QSharpXamDemo/QSharpXamDemo/AssemblyInfo.cs new file mode 100644 index 0000000..c859952 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using Xamarin.Forms.Xaml; + +[assembly: XamlCompilation(XamlCompilationOptions.Compile)] \ No newline at end of file diff --git a/QSharpXamDemo/QSharpXamDemo/CueListPage.xaml b/QSharpXamDemo/QSharpXamDemo/CueListPage.xaml new file mode 100644 index 0000000..1569e32 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo/CueListPage.xaml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/QSharpXamDemo/QSharpXamDemo/CueListPage.xaml.cs b/QSharpXamDemo/QSharpXamDemo/CueListPage.xaml.cs new file mode 100644 index 0000000..f9543a7 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo/CueListPage.xaml.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Diagnostics; +using System.Net.Http.Headers; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using System.Xml; +using QSharp; +using QSharpXamDemo.ViewModels; +using Serilog; +using Xamarin.Essentials; +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace QSharpXamDemo +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class CueListPage : ContentPage + { + private QWorkspace connectedWorkspace; + public CueListPage(QWorkspace workspace) + { + InitializeComponent(); + + connectedWorkspace = workspace; + connectedWorkspace.WorkspaceUpdated += Workspace_WorkspaceUpdated; + connectedWorkspace.connectWithPasscode("1234"); + connectedWorkspace.defaultSendUpdatesOSC = true; + connectedWorkspace.CueListChangedPlaybackPosition += ConnectedWorkspace_CueListChangedPlaybackPosition; + } + + void ConnectedWorkspace_CueListChangedPlaybackPosition(object source, QCueListChangedPlaybackPositionArgs args) + { + Device.BeginInvokeOnMainThread(() => + { + selectedCueGrid.BindingContext = new SelectedQCueViewModel(connectedWorkspace.cueWithID(args.cueID)); + }); + } + + void Workspace_WorkspaceUpdated(object source, QWorkspaceUpdatedArgs args) + { + Log.Debug("[demo] Workspace has been updated"); + foreach (var cue in connectedWorkspace.cueLists) + { + if(cue.cues.Count > 0) + { + List cueAddTasks = new List(); + foreach(var aCue in cue.cues) + { + var cueAddTask = new Task(() => + { + Grid cueGrid = cueToGrid(aCue); + Device.BeginInvokeOnMainThread(() => + { + cueListsGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); + cueListsGrid.Children.Add(cueGrid, 0, aCue.sortIndex); + }); + }); + + cueAddTask.Start(); + cueAddTasks.Add(cueAddTask); + } + break; //only load first cue list with cues. + } + } + } + + Grid cueToGrid(QCue cue) + { + Grid cueGrid = new Grid { RowSpacing = 0 }; + QCueViewModel qCueViewModel = new QCueViewModel(cue); + cueGrid.RowDefinitions = new RowDefinitionCollection(); + cueGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(40) }); + var cueLabel = new Label + { + BindingContext = qCueViewModel, + HorizontalOptions = LayoutOptions.StartAndExpand, + VerticalTextAlignment = TextAlignment.Center + }; + cueLabel.SetBinding(Label.TextProperty, "name", BindingMode.OneWay); + var cueBackground = new Frame + { + BindingContext = qCueViewModel, + Opacity = 0.75, + HasShadow = false, + CornerRadius = 0, + }; + cueBackground.SetBinding(BackgroundColorProperty, "color",BindingMode.OneWay); + + var cueSelectedIndicator = new Frame + { + BindingContext = qCueViewModel, + BackgroundColor = Color.Blue, + HasShadow = false + }; + cueSelectedIndicator.SetBinding(IsVisibleProperty, "IsSelected"); + + cueGrid.Children.Add(cueSelectedIndicator, 0, 0); + cueGrid.Children.Add(cueBackground, 0, 0); + cueGrid.Children.Add(cueLabel, 0, 0); + + int rows = 1; + if (cue.cues.Count > 0) + { + foreach (var aCue in cue.cues) + { + cueGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); + var aCueGrid = cueToGrid(aCue); + aCueGrid.Margin = new Thickness(10, 0, 0, 0); + cueGrid.Children.Add(aCueGrid, 0, aCue.sortIndex + 1); + rows++; + } + + var cueFrame = new Frame + { + BackgroundColor = Color.Transparent, + BorderColor = Color.Black + }; + + cueGrid.Children.Add(cueFrame); + Grid.SetRowSpan(cueFrame, rows); + + } + return cueGrid; + } + } +} \ No newline at end of file diff --git a/QSharpXamDemo/QSharpXamDemo/MainPage.xaml b/QSharpXamDemo/QSharpXamDemo/MainPage.xaml new file mode 100644 index 0000000..13ce5eb --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo/MainPage.xaml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/QSharpXamDemo/QSharpXamDemo/MainPage.xaml.cs b/QSharpXamDemo/QSharpXamDemo/MainPage.xaml.cs new file mode 100644 index 0000000..ae9e93a --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo/MainPage.xaml.cs @@ -0,0 +1,56 @@ +using System; +using System.ComponentModel; +using Xamarin.Forms; +using QSharp; +using System.Collections.ObjectModel; +using System.Collections.Generic; + +namespace QSharpXamDemo +{ + // Learn more about making custom code visible in the Xamarin.Forms previewer + // by visiting https://aka.ms/xamarinforms-previewer + [DesignTimeVisible(false)] + public partial class MainPage : ContentPage + { + public ObservableCollection servers = new ObservableCollection(); + public MainPage() + { + InitializeComponent(); + serverListView.ItemsSource = servers; + QBrowser browser = new QBrowser(); + browser.ServerUpdatedWorkspaces += Browser_ServerUpdatedWorkspaces; + serverListView.ItemSelected += ServerListView_ItemSelected; + + } + + async void ServerListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) + { + QWorkspace selectedWorkspace = e.SelectedItem as QWorkspace; + Console.WriteLine($"[demo] workspace: {selectedWorkspace.nameWithoutPathExtension} has been selected"); + await Navigation.PushAsync(new CueListPage(selectedWorkspace)); + } + + private void Browser_ServerUpdatedWorkspaces(object source, QServerUpdatedArgs args) + { + Console.WriteLine(args.server.name); + + ServerGroup serverGroup = new ServerGroup(args.server.name); + serverGroup.AddRange(args.server.workspaces); + + Device.BeginInvokeOnMainThread(() => + { + servers.Add(serverGroup); + + }); + } + } + + public class ServerGroup : List{ + public string name { get; set; } + + public ServerGroup(string name) + { + this.name = name; + } + } +} diff --git a/QSharpXamDemo/QSharpXamDemo/QSharpXamDemo.csproj b/QSharpXamDemo/QSharpXamDemo/QSharpXamDemo.csproj new file mode 100644 index 0000000..612fc98 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo/QSharpXamDemo.csproj @@ -0,0 +1,32 @@ + + + + netstandard2.1 + true + + + + portable + true + + + + + + + + + + + + + + + + + + + MSBuild:UpdateDesignTimeXaml + + + \ No newline at end of file diff --git a/QSharpXamDemo/QSharpXamDemo/ViewModels/QCueViewModel.cs b/QSharpXamDemo/QSharpXamDemo/ViewModels/QCueViewModel.cs new file mode 100644 index 0000000..799d336 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo/ViewModels/QCueViewModel.cs @@ -0,0 +1,65 @@ +using QSharp; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using Xamarin.Forms; +namespace QSharpXamDemo.ViewModels +{ + public class QCueViewModel : INotifyPropertyChanged + { + QCue cue; + bool isSelected = false; + public event PropertyChangedEventHandler PropertyChanged; + + public QCueViewModel(QCue cue) + { + this.cue = cue; + this.cue.workspace.CueListChangedPlaybackPosition += Workspace_CueListChangedPlaybackPosition; + } + + void OnPropertyChanged([CallerMemberName] string name = "") + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); + } + + private void Workspace_CueListChangedPlaybackPosition(object source, QCueListChangedPlaybackPositionArgs args) + { + IsSelected = args.cueID == cue.uid; + } + + public string name { + get + { + return cue.nonEmptyName; + } + + set + { + cue.name = value; + } + } + + public Color color + { + get + { + return Color.FromHex(cue.color.Hex); + } + set + { + cue.color = new QColor("none"); + } + } + + public bool IsSelected { + get + { + return isSelected; + } + set + { + isSelected = value; + OnPropertyChanged(); + } + } + } +} diff --git a/QSharpXamDemo/QSharpXamDemo/ViewModels/SelectedQCueViewModel.cs b/QSharpXamDemo/QSharpXamDemo/ViewModels/SelectedQCueViewModel.cs new file mode 100644 index 0000000..2b19715 --- /dev/null +++ b/QSharpXamDemo/QSharpXamDemo/ViewModels/SelectedQCueViewModel.cs @@ -0,0 +1,46 @@ +using QSharp; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using Xamarin.Forms; +namespace QSharpXamDemo.ViewModels +{ + public class SelectedQCueViewModel : INotifyPropertyChanged + { + QCue cue; + public event PropertyChangedEventHandler PropertyChanged; + + public SelectedQCueViewModel(QCue cue) + { + this.cue = cue; + } + + void OnPropertyChanged([CallerMemberName] string name = "") + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); + } + + public string name { + get + { + return cue.nonEmptyName; + } + + set + { + cue.name = value; + } + } + + public Color color + { + get + { + return Color.FromHex(cue.color.Hex); + } + set + { + cue.color = new QColor("none"); + } + } + } +}