Not knowing what you have accomplished already I will briefly describe what
I have done.  When I find time I'll post something with pictures.  My main
application is a Cocoa ObjC app that controls the GUI.  When the app starts
the very first thing I do is load my C# EXE, note not a DLL.  A bug/issue
exists that loading a DLL does not completely init the mono environment.

Using Monobjc I export my C# classes to the Cocoa world.  This is why the
mono executable must be properly initialized first, so that when the NIB
files are loaded by Cocoa it will find my registered mono classes.

In the NIB file I add an NSObject and set the class to be the name of my C#
class, say MonoObject.  Add some class outlets to the MonoObject in the NIB
file that point to array/tree controllers within that NIB file.  The tree
controller's mode should be class and the class name most likely will be
NSMutableDictionary, though it can be a class defined in mono as well.  You
can add keys to these controllers to make binding easier on the table
views.  Speaking of the table views, you simply point them to the tree
controller and bind as usual.

Back in your C# class you will have a NSTreeController variable that is
hooked up by monobjc to the tree controller in the NIB file.  Whenver
appropriate you can, from within C#, clear the tree controller data, add
data, remove data etc.  I call something like
treeController.addObject(<myobject>) where myobject is an instance of a C#
class.  That class then must register the methods to expose the keys you
have setup in the tree controller.

You most likely will need to send a reload data notification to the views
that use these tree controllers.  So you should also set class outlets that
point to these views so that you can send them reload data messages.
PostNotification is a nice way to send messages to your mono class so that
it can load the data as needed.

Another solution is to set your table view's/outline view's datasource to be
MonoObject.  Just provide the datasource methods in your C# class.  I have
not implemented this way but I think I'm leaning toward switching.

Not a lot of detail here but hopefully it helps.
Duane

On Fri, Nov 21, 2008 at 9:44 AM, Mario De Clippeleir <[EMAIL PROTECTED]>wrote:

>  Hi,
>
>
>
> I am trying monobjc to port an existing .NET application to the Mac. I
> would like to use a DLL in which an object model resides. When loading a
> file, the object model is being filled. This logic is all in the library.
>
> Now, my question is : if I want to use binding for the Mac gui, do I need
> the "wrap" the object classes from the library into Managed object classes ?
> What would be the best way to handle this ?
>
>
>
> On another note : In the latest monobjc distribution, I can't seem to get
> the TwoManyControllers project working. "The document TwoManyControllers.exe
> could not be opened. TwoManyControllers cannot open files in the EXE File
> format."
>
> I mean, it loads up, but you can't do anything…
>
> Does anyone else has this problem ?
>
>
>
> Thanks,
>
>
>
> Mario
>

Reply via email to