I am attempting to program a robotic arm, I have a C# project with many different classes running as a Console application that permits the robot to move to various places and to do certain tasks. The robot does not have a vision system.
On to the problem: I am using a kinect sensor to extract color and depth data in a WPF application (I am following a Kinect tutorial which does this) which the robot will then use to move to certain positions. The only problem is I have a separate Console application as mentioned above which has a heap of classes and functions. In the WPF application an event fires when all sensor information is ready. I want to place my entire Console Application code in the infinite while loop of the WPF project and then use the sensor information to then get the robot to move to certain locations.
Essentially what I am asking is where can I place code into the infinite while loop of the WPF Application ?
I think I might be completely misunderstanding how to use WPF applications, any help would be greatly appreciated.
I think you're misunderstanding how WPF is supposed to work. WPF is not supposed to be the structure in which all your code runs, it is supposed to be the layer which DISPLAYS your system. That is to say, that rather than "inserting your console application" into WPF and expecting WPF to do the leg work, you should put WPF on TOP of the console application.
Take a look into the MVVM pattern to see what I mean.
a quick google for "Introduction to MVVM" gave http://www.infragistics.com/community/blogs/anand_raja/archive/2012/02/20/the-model-view-viewmodel-101-part-1.aspx
For reference, your existing console code would fall into the model layer.
In very brief:
Model - your system, with NO LOGIC of how the system is displayed or used
ViewModel - a middle man layer that effectively defines how a user interacts with your system
View - a very thin, implementation specific version of your UI.