I am creating my first custom app using Monobjc for Mac OS.

I successfully tested and created from scratch the HelloCocoa sample app and
compiled it with nant from
http://www.monobjc.net/index.php?page=cocoa-application 

 

Now I am trying to convert my simple custom .NET program (already compiled)
to monobjc.

I think I have to call the custom code in the <MyApp>Controller.cs file
(shown below).

I am following this Controller.cs code but was wondering how to call my
custom code.  Do I have to copy all the C# project cs files into the folder
with the Controller.cs file and change all the namespaces or something or
just call it directly somehow?

 

Thanks.

 

By the way what should I put in the 'awakeFrom Nib' procedure?

 

        [ObjectiveCMessage("showMessage:")] 

        public void ShowMessage(Id sender) 

        { 

              // ?? Is this where I put the call to my custom app code ??
And how do I call it ?

 

 

using System; 

using Monobjc.Cocoa; 

  

namespace Monobjc.MyCustomApp 

{ 

    [ObjectiveCClass] 

    public class HelloController : NSObject 

    { 

        // The field maps the IBOutlet defined in Interface Builder 

        [ObjectiveCField] 

        public NSWindow myWindow; 

  

        public HelloController() { } 

  

        public HelloController(IntPtr nativePointer) : base(nativePointer) {
} 

 

        // The method maps the message defined in Interface Builder 

        [ObjectiveCMessage("showMessage:")] 

        public void ShowMessage(Id sender) 

        { 

                NSRect frame = this.myWindow.Frame; 

                AppKitFramework.NSRunAlertPanel("HelloCocoa",
String.Format("Size of window is {0}x{1}. Useless isn't it ?",
frame.size.width, frame.size.height), "OK", null, null); 

        } 

  

        [ObjectiveCMessage("awakeFromNib")] 

        public void AwakeFromNib() 

        { 

            // Do anything you want here 

        } 

    } 

}

 

 

Reply via email to