apps Mac application Xamarin.Mac Web application ASP .NET MVC, ASP .NET Web API Game Unity, Paradox, Unreal Engine Mobile (iOS, Android, WP) MonoTouch, Mono for Android Embedded, IoT .NET Framework Embedded Cloud Windows Azure, AWS
to Objects • Array • List<T> • Stream • etc… LINQ to XML • XML • JSON LINQ to Events • User (input) • Sensor device (input) • Web service (notification) • etc... あらゆるものがイベント
InputField Left; public InputField Right; public Text Result; void Start() { var left = this.Left .OnValueChangeAsObservable() .Select(x => int.Parse(x)); var right = this.Right .OnValueChangeAsObservable() .Select(x => int.Parse(x)); left.CombineLatest(right, (l, r) => l + r) .SubscribeToText(this.Result); } }
// Presenter public class UpDownPresenter : MonoBehaviour { // View public Button UpButton; public Button DownButton; public Text ScoreText; // Model [InspectorDisplay] public IntReactiveProperty Score; private void Start() { this.UpButton.OnClickAsObservable().Subscribe(_ => this.Score.Value++); this.DownButton.OnClickAsObservable().Subscribe(_ => this.Score.Value--); this.Score.SubscribeToText(this.ScoreText); } } Passive View Presenter (Supervising Controller) Model updates view state-change events user events update model
// Presenter public class UpDownPresenter : MonoBehaviour { // View public Button UpButton; public Button DownButton; public Text ScoreText; // Model [InspectorDisplay] public IntReactiveProperty Score; private void Start() { this.UpButton.OnClickAsObservable().Subscribe(_ => this.Score.Value++); this.DownButton.OnClickAsObservable().Subscribe(_ => this.Score.Value--); this.Score.SubscribeToText(this.ScoreText); } } Passive View Presenter (Supervising Controller) Model updates view state-change events user events update model user events を受信した Presenter が Model (Score) を update
// Presenter public class UpDownPresenter : MonoBehaviour { // View public Button UpButton; public Button DownButton; public Text ScoreText; // Model [InspectorDisplay] public IntReactiveProperty Score; private void Start() { this.UpButton.OnClickAsObservable().Subscribe(_ => this.Score.Value++); this.DownButton.OnClickAsObservable().Subscribe(_ => this.Score.Value--); this.Score.SubscribeToText(this.ScoreText); } } Passive View Presenter (Supervising Controller) Model updates view state-change events user events update model Model が state-change event を配信 (ReactiveProperty<int> のイベント ストリーム)