/
iOSPlaygroundViewController.cs
72 lines (60 loc) · 2.23 KB
/
iOSPlaygroundViewController.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Drawing;
using System.Reactive.Concurrency;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using ReactiveUI;
using ReactiveUI.Routing;
using System.ComponentModel;
namespace iOSPlayground
{
public partial class iOSPlaygroundViewController : UIViewController, IViewFor<iOSPlaygroundViewModel>, INotifyPropertyChanged
{
#region Boring copy-paste code I want to die
iOSPlaygroundViewModel _ViewModel;
public iOSPlaygroundViewModel ViewModel {
get { return _ViewModel; }
set {
if (_ViewModel == value) return;
_ViewModel = value;
if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("ViewModel"));
}
}
object IViewFor.ViewModel {
get { return ViewModel; }
set { ViewModel = (iOSPlaygroundViewModel)value; }
}
public event PropertyChangedEventHandler PropertyChanged;
#endregion
public iOSPlaygroundViewController() : base ("iOSPlaygroundViewController", null)
{
}
public override void DidReceiveMemoryWarning()
{
// Releases the view if it doesn't have a superview.
base.DidReceiveMemoryWarning();
// Release any cached data, images, etc that aren't in use.
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
RxApp.DeferredScheduler.Schedule(() => Console.WriteLine("Bar"));
}
public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
{
// Return true for supported orientations
return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
}
}
public class iOSPlaygroundViewModel : ReactiveObject, IRoutableViewModel
{
public string UrlPathSegment {
get { return "Initial View"; }
}
public IScreen HostScreen { get; protected set; }
public iOSPlaygroundViewModel(IScreen hostScreen)
{
HostScreen = hostScreen ?? RxApp.GetService<IScreen>();
}
}
}