Skip to content
Browse files

So many hax to make this work :-/

  • Loading branch information...
1 parent 9d25190 commit 7370bd73a4a28e7da4ad11ea37e0611df1d1e164 @paulcbetts paulcbetts committed
View
30 iOSPlayground/AppBootstrapper.cs
@@ -5,6 +5,8 @@
using System.Runtime.Serialization;
using TinyIoC;
using MonoTouch.UIKit;
+using System.Linq;
+using System.Collections.Generic;
namespace iOSPlayground
{
@@ -28,10 +30,36 @@ public AppBootstrapper()
Kernel.Register(typeof(IViewFor<iOSPlaygroundViewModel>), typeof(iOSPlaygroundViewController));
Kernel.Register<IScreen>(this);
+ var toRegister = new Dictionary<Tuple<Type, String>, List<Type>>();
+
RxApp.ConfigureServiceLocator(
(t, s) => s != null ? Kernel.Resolve(t, s) : Kernel.Resolve(t),
(t, s) => Kernel.ResolveAll(t, true),
- (c, t, s) => { if (s != null) { Kernel.Register(t, c, s); } else { Kernel.Register(t, c); } } );
+ (c, t, s) => {
+ if (toRegister != null) {
+ var pair = Tuple.Create(t,s);
+ if (!toRegister.ContainsKey(pair)) {
+ toRegister[pair] = new List<Type>();
+ }
+ toRegister[pair].Add(c);
+ return;
+ }
+
+ if (s != null) {
+ Kernel.Register(t, c, s);
+ } else {
+ Kernel.Register(t, c);
+ }
+ });
+
+ foreach(var key in toRegister.Keys) {
+ var val = toRegister[key].Distinct();
+ Kernel.RegisterMultiple(key.Item1, val);
+ }
+
+ toRegister = null;
+
+ var items = Kernel.ResolveAll(typeof(ICreatesObservableForProperty), true).ToArray();
Router.Navigate.Go<iOSPlaygroundViewModel>();
}
View
2 iOSPlayground/Info.plist
@@ -8,5 +8,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
+ <key>MinimumOSVersion</key>
+ <string>5.0</string>
</dict>
</plist>
View
1 iOSPlayground/iOSPlayground.csproj
@@ -47,6 +47,7 @@
<IpaPackageName />
<MtouchI18n />
<MtouchArch>ARMv7</MtouchArch>
+ <MtouchLink>None</MtouchLink>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
View
13 iOSPlayground/iOSPlaygroundViewController.cs
@@ -6,6 +6,7 @@
using ReactiveUI;
using ReactiveUI.Routing;
using System.ComponentModel;
+using System.Runtime.Serialization;
namespace iOSPlayground
{
@@ -45,7 +46,8 @@ public override void DidReceiveMemoryWarning()
public override void ViewDidLoad()
{
base.ViewDidLoad();
- RxApp.DeferredScheduler.Schedule(() => Console.WriteLine("Bar"));
+
+ this.OneWayBind(ViewModel, x => x.TheGuid, x => x.TheGuid.Text);
}
public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientation toInterfaceOrientation)
@@ -57,15 +59,24 @@ public override bool ShouldAutorotateToInterfaceOrientation(UIInterfaceOrientati
public class iOSPlaygroundViewModel : ReactiveObject, IRoutableViewModel
{
+ [IgnoreDataMember]
public string UrlPathSegment {
get { return "Initial View"; }
}
+ [IgnoreDataMember]
public IScreen HostScreen { get; protected set; }
+ [DataMember] string _TheGuid;
+ public string TheGuid {
+ get { return _TheGuid; }
+ set { this.RaiseAndSetIfChanged(x => x.TheGuid, value); }
+ }
+
public iOSPlaygroundViewModel(IScreen hostScreen)
{
HostScreen = hostScreen ?? RxApp.GetService<IScreen>();
+ TheGuid = Guid.NewGuid().ToString();
}
}
}
View
24 iOSPlayground/iOSPlaygroundViewController.designer.cs
@@ -1,5 +1,6 @@
+// WARNING
//
-// This file has been generated automatically by MonoDevelop to store outlets and
+// This file has been generated automatically by Xamarin Studio to store outlets and
// actions made in the Xcode designer. If it is removed, they will be lost.
// Manual changes to this file may not be handled correctly.
//
@@ -7,11 +8,18 @@
namespace iOSPlayground
{
- [Register ("iOSPlaygroundViewController")]
- partial class iOSPlaygroundViewController
- {
- void ReleaseDesignerOutlets()
- {
- }
- }
+ [Register ("iOSPlaygroundViewController")]
+ partial class iOSPlaygroundViewController
+ {
+ [Outlet]
+ MonoTouch.UIKit.UILabel TheGuid { get; set; }
+
+ void ReleaseDesignerOutlets ()
+ {
+ if (TheGuid != null) {
+ TheGuid.Dispose ();
+ TheGuid = null;
+ }
+ }
+ }
}
View
61 iOSPlayground/iOSPlaygroundViewController.xib
@@ -38,39 +38,60 @@
<object class="IBUILabel" id="203465953">
<reference key="NSNextResponder" ref="774585933"/>
<int key="NSvFlags">292</int>
- <string key="NSFrame">{{138, 219}, {44, 21}}</string>
+ <string key="NSFrame">{{58, 219}, {205, 21}}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
- <string key="IBUIText">Hello.</string>
- <object class="NSColor" key="IBUITextColor">
+ <string key="IBUIText">Your GUID For The Day Is:</string>
+ <object class="NSColor" key="IBUITextColor" id="780457260">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
<string key="IBUIColorCocoaTouchKeyPath">darkTextColor</string>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
- <object class="IBUIFontDescription" key="IBUIFontDescription">
+ <object class="IBUIFontDescription" key="IBUIFontDescription" id="146311017">
<int key="type">1</int>
<double key="pointSize">17</double>
</object>
- <object class="NSFont" key="IBUIFont">
+ <object class="NSFont" key="IBUIFont" id="342891430">
<string key="NSName">Helvetica</string>
<double key="NSSize">17</double>
<int key="NSfFlags">16</int>
</object>
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
</object>
+ <object class="IBUILabel" id="455554258">
+ <reference key="NSNextResponder" ref="774585933"/>
+ <int key="NSvFlags">290</int>
+ <string key="NSFrame">{{20, 248}, {280, 21}}</string>
+ <reference key="NSSuperview" ref="774585933"/>
+ <reference key="NSWindow"/>
+ <string key="NSReuseIdentifierKey">_NS:9</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <int key="IBUIContentMode">7</int>
+ <bool key="IBUIUserInteractionEnabled">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <string key="IBUIText">Label</string>
+ <reference key="IBUITextColor" ref="780457260"/>
+ <nil key="IBUIHighlightedColor"/>
+ <int key="IBUIBaselineAdjustment">0</int>
+ <reference key="IBUIFontDescription" ref="146311017"/>
+ <reference key="IBUIFont" ref="342891430"/>
+ <bool key="IBUIAdjustsFontSizeToFit">NO</bool>
+ </object>
</array>
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
+ <reference key="NSNextKeyView" ref="203465953"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC43NQA</bytes>
@@ -93,6 +114,14 @@
</object>
<int key="connectionID">7</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">TheGuid</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="455554258"/>
+ </object>
+ <int key="connectionID">10</int>
+ </object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -118,6 +147,7 @@
<reference key="object" ref="774585933"/>
<array class="NSMutableArray" key="children">
<reference ref="203465953"/>
+ <reference ref="455554258"/>
</array>
<reference key="parent" ref="0"/>
</object>
@@ -126,6 +156,11 @@
<reference key="object" ref="203465953"/>
<reference key="parent" ref="774585933"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">9</int>
+ <reference key="object" ref="455554258"/>
+ <reference key="parent" ref="774585933"/>
+ </object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -135,18 +170,30 @@
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">8</int>
+ <int key="maxID">10</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">iOSPlaygroundViewController</string>
<string key="superclassName">UIViewController</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">TheGuid</string>
+ <string key="NS.object.0">UILabel</string>
+ </object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <string key="NS.key.0">TheGuid</string>
+ <object class="IBToOneOutletInfo" key="NS.object.0">
+ <string key="name">TheGuid</string>
+ <string key="candidateClassName">UILabel</string>
+ </object>
+ </object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/iOSPlaygroundViewController.h</string>

0 comments on commit 7370bd7

Please sign in to comment.
Something went wrong with that request. Please try again.