I’ve been using non-OOP languages (Mostly scripting or web development) such as Lua for a prety long time. I’m becoming quite advanced in C# now, but I’ve hit a rock as far as my current project is concerned.
I’m making a sort of game where you make a 2D environment out of various types of things.
I’m using an example I found on the web of porting XNA into a winform, and it works perfectly, no lag or anything.
But that’s not my problem. I have absolutely NO IDEA how to make an instanced class communicate with another instanced class that the instanced class didn’t instance.
Basically, I’ve made an “Insert” interface with a button to insert a peice of terrain, which then is meant to apear in Treeview1. How can I tell the form to “reply” that the user has picked the terrain (I’m using an enum for what they picked), and tell the form to add a node to the treeview?
There are a few ways object instances can communicate. Often they will raise events and the other instance may have registered an event handler on that event.
Sometimes they will raise an event and a controller instance will have a registered handler and it will have references to various other instances and figure out what to do.