Search code examples
c#winformsvariableskinectprojects

visual c# 2010 communicating between two projects


I am trying to create a windows form project, and use speech recognition for the Kinect with the Kinect to Windows SDK. I have

  • the form application project (p1) and
  • the Kinect speech project (p2) which is a command prompt.

I made it a command prompt because it was the easiest way to do things. Anyway, I have read and found two things about this.

1)I found out how to run two projects at the same time in the same solution.

2) I also found out how to add references to get classes from each project to the other.

So, how would I get variables from each project? Just by using project references, or something? P2 can recognize speech and save it to variables, if that counts for anything.


Solution

  • I made it a command prompt because it was the easiest way to do things.

    That sounds like the problem. It sounds like really you should be looking at making your Kinect project a class library. Then you can just call into that class library from the Windows Forms application.

    If you want a "test bed" console app, you can always write one which also references the class library.

    Note that generally you shouldn't be sharing variables between projects - they're implementation details in most well-encapsulated systems - but you would create types which expose properties, appropriate methods etc.