Appendix B
Copy
MainActivity.cs
using System; using Android.App; using Android.Content; using Android.Runtime; using Android.Views; using Android.Widget; using Android.OS; using Aras.IOM; namespace ArasAndroid { [Activity(Label = “ArasAndroid”, MainLauncher = true, Icon = "@drawable/icon”)] public class MainActivity : Activity { int count = 1; protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // 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<Button>(Resource.Id.MyButton); button.Click += async delegate { //create connection to Innovator server HttpServerConnection connection = IomFactory.CreateHttpServerConnection(“http://localhost/InnovatorServer/Server/InnovatorServer.aspx”, “InnovatorSolutions”, “admin”, “innovator”); //login try { Item user = await connection.LoginAsync(); } catch (Exception e) { throw e; } //create innovator and send a request to the server Innovator innovator = IomFactory.CreateInnovator(connection); Item queryVariable = innovator.newItem(“Variable”, “get”); queryVariable.setProperty(“name”, “IncludedSolutions”); Item variable = await queryVariable.applyAsync(); if (variable.isError()) { throw new Exception(variable.getErrorString()); } button.Text = variable.getProperty(“value”); }; } } }