第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

RX:如何將 IObservable<object> 綁定到屬性 (ReactiveUI)

RX:如何將 IObservable<object> 綁定到屬性 (ReactiveUI)

C#
LEATH 2022-12-24 14:27:53
我上課MyClient時(shí)有IObservable<IStatus>( Client.StatusStream())?,F(xiàn)在我想結(jié)合ReactiveXand ReactiveUI。但是文檔沒有提供任何如何一起使用它們的示例。到目前為止,我已經(jīng)嘗試了一些擴(kuò)展方法 (fe .ToProperty),但它們不起作用。public partial class MainWindow : ReactiveWindow<AppViewModel>{    public MainWindow()    {        InitializeComponent();        ViewModel = App.Container.GetInstance<AppViewModel>();        this.WhenActivated(r =>            {                this.OneWayBind(ViewModel, viewModel => viewModel.Status.AoiStatus, view => view.StatusTxtbl.Text).DisposeWith(r);                this.OneWayBind(ViewModel, viewModel => viewModel.Status.OperationMode, view => view.OpModeTxtbl.Text).DisposeWith(r);                this.OneWayBind(ViewModel, viewModel => viewModel.Status.TestPlan, view => view.TestplanTxtbl.Text).DisposeWith(r);            });    }    private async void ButtonGetStatus_OnClick(object sender, RoutedEventArgs e)    {        // the manual mode to get the actual status information        var status = await ViewModel.Client.GetStatusAsync();        ViewModel.Status = status;    }}public class AppViewModel : ReactiveObject{    private IStatus _Status;    public IStatus Status    {        get => _Status;        set => this.RaiseAndSetIfChanged(ref _Status, value);    }    public MyClient Client { get; }    public AppViewModel(MyClient client)    {        Client = client;        // automatically pushes every new status information        Client.StatusStream(); // <- How to get the data out there?    }}
查看完整描述

1 回答

?
呼喚遠(yuǎn)方

TA貢獻(xiàn)1856條經(jīng)驗(yàn) 獲得超11個(gè)贊

定義Status輸出屬性

public class AppViewModel : ReactiveObject

{

    private readonly ObservableAsPropertyHelper<IStatus> _status;

    public string Status => _status.Value;


    public MyClient Client { get; }


    public AppViewModel(MyClient client)

    {

        Client = client;

        Client.StatusStream().ToProperty(this, x => x.Status, out _status);

    }

}


查看完整回答
反對(duì) 回復(fù) 2022-12-24
  • 1 回答
  • 0 關(guān)注
  • 95 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)