Before I got started I had to review some changes that came in last night and send feedback on them to make sure I understand the code and that the UI works correctly. It sure is nice to have someone else helping me with an isolated part of the app as creating a custom component is definitely extremely time consuming.
The toughest part of this feature is figuring out how to use a Timer in a Windows Store app in C#. Thankfully again MSDN comes to the rescue with an example. Again the hardest problem is finding where Microsoft moved the class for Windows Store app. I see numerous code examples that refer to System.Windows.Threading but that is not available in a Windows Store app, so that has been moved to Windows.UI.Xaml since this class is used in the foreground UI threads. The example had the correct code by I had to figure out the using statement that matched the timer class. I should have just copied them all into my example, but I read documentation on my Mac and then edit the code on my Windows laptop obviously. I still have not learned how to use the help within VSE to allow me to look this kind of stuff on while in the IDE. Maybe some other day for that one.
Just when I was cruising alone I got one of those crazy compiler errors that just make you wonder what in the world is going on. I have gotten so used to not seeing these kinds of errors that I forgot about them. My problem is I want to handle when a tick fires in the DispatcherTimer which is easy to define a handler but then the method signature is so different from all of the other even handlers I have used. After struggling with the code not compiling by passing in EventArgs as the second argument I looked at the documentation and found this handler requires and "object" type as the second argument. Then I had to set up another Stopwatch class so I can monitor the elapsed time to simulate movement on the map so that meant I also had to look up how to figure out the number of elapsed seconds using the returned TimeSpan class.
I just ran into a road block as I need some methods in the mapping engine that I have not used before. Since I have no documentation, I need to figure out what was available in the DLL's that I added to my project. After searching around using Ms. Google and not finding anything I gave up and opened the "References" section within VSE and double clicked on the DLL and what should appear but the Object Browser window that I could open each DLL and inspect symbols for classes and methods in my DLL's - now that is nice. Even I am allowed to search for anything in any DDLL included in my project references. But the real problem is that the functions I need do not exist, so that means I have to talk to the mapping engine lead developer or find a way around this by looking up the math myself as an estimate. So on looking around I found this absolutely wonderful site that describes mathematical formulas for everything GPS related. Once again I had to remind myself how to do a modulus in C# since Math.Mod does not exist and I am supposed to use the "%" operator instead. Maybe one day I will remember that when I no longer need to!
It is so interesting how you learn new things all the time when using a new VSE. I added a comment in the code to link to that article on the web and I saw the underline in the source code. When I hovered over the link, VSE said CTRL+click to follow the link and when I did that it opened that article in a tab within VSE. That is nice if I ever need to see that article again and so I don't need to copy-n-paste that into IE.
Another big lesson of the day is getting a range within an existing List
No comments:
Post a Comment