Skip to content

Instantly share code, notes, and snippets.

@tmiz
Created December 14, 2011 06:13
Show Gist options
  • Save tmiz/1475476 to your computer and use it in GitHub Desktop.
Save tmiz/1475476 to your computer and use it in GitHub Desktop.
Example MonoMac 0001
using System;
using System.Collections.Generic;
using System.Linq;
using MonoMac.Foundation;
using MonoMac.AppKit;
namespace MonoDemoProject
{
public partial class MainWindowController : MonoMac.AppKit.NSWindowController
{
#region Constructors
// Called when created from unmanaged code
public MainWindowController (IntPtr handle) : base (handle)
{
Initialize ();
}
// Called when created directly from a XIB file
[Export ("initWithCoder:")]
public MainWindowController (NSCoder coder) : base (coder)
{
Initialize ();
count = 0; //incert code:(1)
}
// Call to load from the XIB/NIB file
public MainWindowController () : base ("MainWindow")
{
Initialize ();
}
// Shared initialization code
void Initialize ()
{
}
#endregion
// incert code:(2)
private uint count;
partial void click (MonoMac.Foundation.NSObject sender)
{
string value = string.Format("count:{0}", count);
mainLabel.SetValueForKey((NSString)value, (NSString)"stringValue");
if (uint.MaxValue > count) {
count += 1;
}
}
//strongly typed window accessor
public new MainWindow Window {
get {
return (MainWindow)base.Window;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment