I have been wrestling with some aspects of programming for Surface lately, and it’s concerning to me that a lot of the fundamental features for the astronomy surface project are turning out to be very difficult to implement.

There’s the added inconvenience of not being able to code and test from home. I have a 64 bit Windows 7 PC, and while it is possible to make the Surface SDK work on Windows 7, 64 bit is a problem. I tried patching the MSI file through the instructions at this site, and was actually able to make the SDK install on my machine, but there are still issues with the Surface Simulator. It runs, and can run the Attract application perfectly because I made sure to patch all of the .exe files in simulator directory, but when I try to run a program I’ve coded, the Surface Simulator will crash inexplicably (for another reason unrelated to the fact that it’s on 64 bit mode). I think there is a deeper incompatibility problem that I probably don’t have time to further investigate, so I am going to just code on my own machine and try to debug it painstakingly whenever I’m in the lab.

Anyway, thedifficult features I am trying to make work include finding out the coordinates of a tag on the surface and adding ContactDown methods programmatically. When I try to get the coordinates of a tag (using tag visualizations), I get 0,0 no matter where the tag is on the surface. This really makes no sense at all and I couldn’t think of why this would happen outside of the possibility that the tag visualization itself actually takes up the entire screen and would always been 0,0 because of this.

So I tried the alternative method of handling tags, ContactDown. I couldn’t get this to work either– I tried both adding a Contacts.ContactDown=”someMethod” into the canvas definition in the XAML file, as well as adding it in the CS file by saying thing.ContactDown += someMethod(). When tested, the methods weren’t getting called, even after making obvious contacts on the surface. Our first lab demonstrated the functionality of ContactDown and worked perfectly, so I don’t know what the problem is. All of the samples provided by the Surface API also seem to show that I’m writing the correct code, and because this is such a basic thing, there aren’t many forum posts or FAQs online that describe and resolve this kind of problem.

I also encountered another problem when trying to add Resources to a project. I wanted to add a custom background picture, because that will be important for our project. However, when following the Surface API’S steps closely to add the Resource, I still got build errors where the program claimed that the picture wasn’t labeled as a resource (it clearly was). It turns out there is a bug in Visual Studio 2008 where if you do not specify the full path of the resource file, this issue will arise. I finally was able to get it to work, so hopefully preparing the project prototype for the next project benchmark will be easy from now on.

Advertisements