xamarin.forms - 如何用 F# 声明 Xamarin.Forms.Dependency?

标签 xamarin.forms f# microblink blinkid

我正在从 C# 移植这段代码:

using MicroBlink;

[assembly: Xamarin.Forms.Dependency (typeof (BlinkIDImplementation))]
namespace BlinkIDApp.iOS
{
    public class BlinkIDImplementation : IBlinkID
    {
        CustomDelegate customDelegate;
        bool isFrontCamera;

        public BlinkIDImplementation ()
        {
            customDelegate = new CustomDelegate ();

            BlinkID.Instance ().LicenseKey = "MZEFTUGV-******";
            BlinkID.Instance ().Delegate = customDelegate;
            isFrontCamera = false;
        }
    }
}

但是,这部分在F#中看不到怎么写:

[assembly: Xamarin.Forms.Dependency (typeof (BlinkIDImplementation))]

我尝试:

[<assembly: Xamarin.Forms.Dependency (typeof (BlinkIDImplementation))>]

然后我得到:

Error FS0841: This attribute is not valid for use on this language element. Assembly attributes should be attached to a 'do ()' declaration, if necessary within an F# module.

最佳答案

只写这个片段:

[<assembly: ...>]
do ()

关于xamarin.forms - 如何用 F# 声明 Xamarin.Forms.Dependency?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47106076/

相关文章:

ios - 将自定义框架链接到 xcode 中的库

ios - dyld : Library not loaded: @rpath/MicroBlink. 框架/MicroBlink

android - 更改许多控件的默认颜色

xamarin 表单与 mvvmcross 一起使用

recursion - 我有一个数字列表。我必须使用递归函数对重复的数字求和

multithreading - 为什么我在使用 Async.Parallel 时只有一个线程 id?

xml - 如何使用 FSharp 创建 XML 属性(而不是元素)?

webview - 如何在加载数据时获取WebView的进度,Xamarin.Forms

c# - Xamarin Forms Switch 如何记住和更新用户设置(推送通知)

ios - Microblink:在最新版本 4.9.1 中加载资源 uae_name_dictionary 失败