, Xamarin.Forms . Xamarin.Forms.Labs( NuGet) XFormsApplicationDelegate. GitHub.
public partial class AppDelegate : XFormsApplicationDelegate
{
IXFormsApp DI:
private void SetIoc()
{
var resolverContainer = new SimpleContainer();
var app = new XFormsAppiOS();
app.Init(this);
resolverContainer.Register<IXFormsApp>(app);
Resolver.SetResolver(resolverContainer.GetResolver());
}
DI, /PCL- Resolver. . .
var app = Resolver.Resolve<IXFormsApp>();
if (app == null)
{
return;
}
app.Closing += (o, e) => Debug.WriteLine("Application Closing");
app.Error += (o, e) => Debug.WriteLine("Application Error");
app.Initialize += (o, e) => Debug.WriteLine("Application Initialized");
app.Resumed += (o, e) => Debug.WriteLine("Application Resumed");
app.Rotation += (o, e) => Debug.WriteLine("Application Rotated");
app.Startup += (o, e) => Debug.WriteLine("Application Startup");
app.Suspended += (o, e) => Debug.WriteLine("Application Suspended");