Xamarin Forms:如何为UWP在App.xaml.cs中一次添加多个初始化代码? [英] Xamarin Forms: How to add multiple init codes at a time in App.xaml.cs for UWP?

查看:143
本文介绍了Xamarin Forms:如何为UWP在App.xaml.cs中一次添加多个初始化代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在App.xaml.cs中,我同时具有圆圈图像和弹出图像的初始化代码.仅第一个代码有效,Xamarin.Forms.Forms.Init之后的代码无效.我当前的代码添加如下:

I have init codes of both circle image and pop up image in App.xaml.cs. Only the first code is working, the code after Xamarin.Forms.Forms.Init is not working. My current code is adding below:

   //ImageCircle
   var rendererAssemblies = new[]
    {
        typeof(ImageCircleRenderer).GetTypeInfo().Assembly
    };
    Xamarin.Forms.Forms.Init(e, rendererAssemblies);

    //Popup
    Rg.Plugins.Popup.Popup.Init();
    Xamarin.Forms.Forms.Init(e, Rg.Plugins.Popup.Popup.GetExtraAssemblies());

现在图像圈正在起作用,而弹出图像不起作用,如何一次添加多个初始化代码?

Now image circle is working and pop up image is not working, how to add multiple init codes at a time?

谢谢.

推荐答案

尝试一下:

//ImageCircle
var rendererAssemblies = new List<Assembly>
{
    typeof(ImageCircleRenderer).GetTypeInfo().Assembly
};

rendererAssemblies.AddRange(Rg.Plugins.Popup.Popup.GetExtraAssemblies());

//Popup
Rg.Plugins.Popup.Popup.Init();
Xamarin.Forms.Forms.Init(e, rendererAssemblies);

这篇关于Xamarin Forms:如何为UWP在App.xaml.cs中一次添加多个初始化代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆