forked from reactiveui/ReactiveUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWatchListActivity.cs
44 lines (36 loc) · 1.4 KB
/
WatchListActivity.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.OS;
using Android.Widget;
using MobileSample_Android.ViewModels;
using MobileSample_Android.Views;
using ReactiveUI;
using Android.Views;
namespace MobileSample_Android
{
//[Activity(Label = "AndroidPlayground", MainLauncher = true)]
public class WatchListActivity : ReactiveActivity<WatchListViewModel>
{
public Button OpenMarket { get; private set; }
public Button CloseMarket { get; private set; }
public Button Reset { get; private set; }
public ListView WatchList { get; private set; }
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.WatchList);
ViewModel = new WatchListViewModel();
this.WireUpControls();
var adapter = new ReactiveListAdapter<WatchListItemViewModel>(
ViewModel.Stocks,
(viewModel, parent) => new WatchListItemView(viewModel, this, parent));
WatchList.Adapter = adapter;
this.BindCommand(ViewModel, vm => vm.OpenMarketCommand, c => c.OpenMarket);
this.BindCommand(ViewModel, vm => vm.CloseMarketCommand, c => c.CloseMarket);
this.BindCommand(ViewModel, vm => vm.ResetCommand, c => c.Reset);
}
}
}