public void IntegrateWith(IAgent agent) { // TODO: Refactor this into shared code between iOS and Android. realAgent = agent as iOSAgent; if (realAgent == null) { return; } if (realAgent.ViewHierarchyHandlerManager == null) { return; } try { realAgent.ViewHierarchyHandlerManager.AddViewHierarchyHandler(HierarchyKind, new iOSFormsViewHierarchyHandler(realAgent)); realAgent.RepresentationManager.AddProvider(new FormsRepresentationProvider()); if (realAgent.ClientSessionUri.SessionKind == ClientSessionKind.Workbook) { realAgent.RegisterResetStateHandler(ResetStateHandler); Log.Debug(TAG, "Initializing Xamarin.Forms."); Xamarin.Forms.Forms.Init(); Log.Debug(TAG, "Creating base Xamarin.Forms application."); var app = new WorkbookApplication { MainPage = new ContentPage() }; Log.Debug(TAG, "Creating view controller for main page and setting it as root."); UIApplication.SharedApplication.KeyWindow.RootViewController = app.MainPage.CreateViewController(); } Log.Info(TAG, "Registered Xamarin.Forms agent integration!"); } catch (Exception e) { Log.Error(TAG, "Could not register Xamarin.Forms agent integration.", e); } }
// Usage: Xamarin.Interactive.Console.exe {IdentifyAgentRequest args} // Passing no arguments is supported for debug scenarios. static void Main() => WorkbookApplication.RunAgentOnCurrentThread <ConsoleAgent> (MacIntegration.Integrate);
// Usage: Xamarin.Workbooks.DotNetCore {IdentifyAgentRequest args} // Passing no arguments is supported for debug scenarios. static void Main() => WorkbookApplication.RunAgentOnCurrentThread <DotNetCoreAgent> ();