EventBusByXamairnAndroid 1.0.2

dotnet add package EventBusByXamairnAndroid --version 1.0.2                
NuGet\Install-Package EventBusByXamairnAndroid -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EventBusByXamairnAndroid" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EventBusByXamairnAndroid --version 1.0.2                
#r "nuget: EventBusByXamairnAndroid, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EventBusByXamairnAndroid as a Cake Addin
#addin nuget:?package=EventBusByXamairnAndroid&version=1.0.2

// Install EventBusByXamairnAndroid as a Cake Tool
#tool nuget:?package=EventBusByXamairnAndroid&version=1.0.2                
介绍

仿安卓eventbus源码的xamarin.android 版本的 eventbus

软件架构

C#(.Net Standard2.0)

注册

EventBus.Default.Register(object); 注意:object参数必须是继承自 Activity

public class MainActivity : AppCompatActivity
{
    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);
        SetContentView(Resource.Layout.activity_main);
        //注册
        EventBus.Default.Register(this);
    }
}
接收消息
[Subscribe(threadMode:ThreadMode.Main|Async)]
public void test(string msg)
{            
    //取决于threadMode参数
    //threadMode 参数
    //Main 接收消息在主线程
    //Async 接收消息在异步线程

}
Post消息

发送文本

EventBus.Default.Post("文本消息");

发送对象

EventBus.Default.Post(new EventMessage("对象"));
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 435 8/29/2022

最新版:1.0.2