Skip to content

Instantly share code, notes, and snippets.

@kumpera
Created April 25, 2012 19:06
Show Gist options
  • Save kumpera/2492353 to your computer and use it in GitHub Desktop.
Save kumpera/2492353 to your computer and use it in GitHub Desktop.
diff --git a/TweetStation/Main.cs b/TweetStation/Main.cs
index e0efa09..4095e4d 100644
--- a/TweetStation/Main.cs
+++ b/TweetStation/Main.cs
@@ -40,7 +40,10 @@ namespace TweetStation
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
Util.ReportTime ("Entering Finished");
-
+ var t = new Thread (() => { while (true) {GC.Collect (); Thread.Sleep (400); } });
+ t.IsBackground = true;
+ t.Start ();
+
MainAppDelegate = this;
window.MakeKeyAndVisible ();
diff --git a/TweetStation/TweetStation.csproj b/TweetStation/TweetStation.csproj
index 6657de3..fc21a91 100644
--- a/TweetStation/TweetStation.csproj
+++ b/TweetStation/TweetStation.csproj
@@ -61,7 +61,6 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<MtouchI18n />
<DefineConstants>TRACE; DEBUGIMAGE</DefineConstants>
- <MtouchUseLlvm>true</MtouchUseLlvm>
<MtouchUseArmv7>false</MtouchUseArmv7>
<MtouchUseSGen>true</MtouchUseSGen>
<MtouchUseRefCounting>true</MtouchUseRefCounting>
diff --git a/TweetStation/UI/Timeline.cs b/TweetStation/UI/Timeline.cs
index ec3cce2..9724192 100644
--- a/TweetStation/UI/Timeline.cs
+++ b/TweetStation/UI/Timeline.cs
@@ -33,7 +33,29 @@ using System.Text;
using MonoTouch.ObjCRuntime;
namespace TweetStation {
-
+ [Register]
+ internal class LeCallback : NSObject {
+ Action<NSObject, EventArgs> callback;
+
+ public LeCallback (Action<NSObject, EventArgs> action) {
+ this.callback = action;
+ }
+
+ [Export ("InvokeAction:")]
+ [Preserve (Conditional = true)]
+ public void Call (NSObject sender)
+ {
+ callback (sender, EventArgs.Empty);
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ Console.WriteLine ("Le Callback GOT DISPOSED! {0:x}", (int)Handle);
+ base.Dispose (disposing);
+ }
+ }
+
+
// Base class for timeline views
public abstract partial class BaseTimelineViewController : DialogViewController
{
@@ -50,7 +72,7 @@ namespace TweetStation {
ReloadTimeline ();
};
Style = UITableViewStyle.Plain;
- NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Compose, delegate {
+ NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Compose, new LeCallback (delegate {
if (kind == TweetKind.Direct){
var sheet = Util.GetSheet ("");
sheet.AddButton (Locale.GetText ("New Tweet"));
@@ -76,7 +98,7 @@ namespace TweetStation {
} else {
Composer.Main.NewTweet (this);
}
- });
+ }), new Selector ("InvokeAction:"));
}
public TwitterAccount Account {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment