Wednesday, November 20, 2013

From concept to reality in 6 weeks - part 4

This morning I need to check on a couple of things. First thing I need to check on progress being made and the time left. It may seem that 6 weeks is a lot of time but that is essentially 30 working days. I have finished 3 days so I have 27 days left. Not enough time but I have to make due with what I have.

  • Day 1 - setup laptop
  • Day 2 - get development environment working
  • Day 3 - get Bing Maps working
Speaking of Bing Maps, I need to check on my usage after one day of testing maps. I ran a report on the Bing Maps Portal and turns out I must be getting free usage as it said "No Data to Report", so I guess that is a good thing. Maybe it was a bargain and I get the first day free!

I have a choice to make this morning as I could explore Bing Maps further to figure out why I could only get one of the GPX files to work as all of the others failed miserably by crashing the test app. That would be good to know and if I could get multiple files to work then I could load them all at the same time and see if Bing Maps is still responsive with thousands of poly-lines and points on the map at the same time. This would simulate the actual case I will encounter soon. For now I need to leave that for another day as today I must get the real geographic location data from the server as that is still a big unknown. A lot of things are unknown at this time but at least I have a sense for what needs to be done now. Last week I explored the Windows 8 Metro UI components and after using several apps, I see how the app should work.

Before going further I need to set up SkyDrive on my Mac so in the future I can find files on my Mac, then save them to my SkyDrive and see them on my Windows 8 laptop as that will save me time. I noticed when I went to the SkyDrive site yesterday that a message at the bottom of the window offered a free app to help me do just this. This should be interesting as I already have DropBox, Google Drive and now I get a Microsoft way of doing the same thing. The good news is that I am predicting a quick install and no reboot required as opposed to what I have been seeing the last 3 days. Just as I expected. What is so strange about this for me is that Microsoft can create an easy install and setup on a Mac and yet make some things so painful on their own computers. After just a couple of minutes I see the blue clouds in my Dock and open the drive and I see my GPX files I was working on yesterday. Now I can search for example code on my Mac using my nice 27" thunderbolt display and store it in the SkyDrive.

I immediately go to the Windows 8.1 app samples and start looking for my perfect example of accessing a server to retrieve JSONP. I see so many hopeful examples so I go back to my laptop into the folder where I downloaded all of the Windows 8.1 samples. It is so tempting to open the DirectX and Direct3D apps as the names look so interesting and I am so curious, but I resist the temptation and skip over them (there are tons of them so as I scroll thru them I have to constantly ignore so many fun things), but then I see tons of HTML and JavaScript examples which I also must resist and keep going until I find the Json Sample. After double clicking on the project file and clicking on F7 to build the project, then F5 to run the project in the debugger I see a window to enter JSON at the top and the bottom has the parsed results and I can do the other way as well. That is pretty nice. Now I have to look at the code to see how it all works... Actually it is easier to read on the Thunderbolt display as I can browse the source code on line for the JSON example.

I accidentally hit the Windows key on my laptop and I just cannot figure out how to get back to the JSON app. This is not the first time this has happened to me. I right click on the menu bar and see the app running in the Task Manager and I can select the app in the list and it comes back up on the screen. There must be a way to cycle thru apps. Right, now I remember it is Alt-Tab on Windows. That is one annoying problem solved. I should have recalled that one, but Windows 8 is so different from Windows/XP that I used for many years that I just don't assume things I used to know still work.

Time to take a quick C# refresher as the first thing I encountered that I don't remember what it means is "jsonObject^ jsonObject" which I assume means a pointer, but I have to check on the Wikipedia summary article for C#. At least C# supports a goto statement so that is an advancement back to when I first saw a computer 35 years ago! Similar to Objective-C, you can use "C" in C# so I get structs and enums. Good news, I don't have to worry about adding a "@" as in Objective-C to create a Objective-C string so it is different from a "C" string, so C# is less confusing in that regard for strings. I also don't have to force boxing as in Objective-C by adding "@" to convert a int to an Integer, so C# has already helped me twice as it auto boxes. Unfortunately the Wikipedia article did not mention the syntax I was looking for, so now I have to find the explanation on the official C# page. It turns out that it is harder to find that I expected. After looking up pointers in C# I finally realized I was looking at C++ code. But it did not hit me until I looked at the actual code I was using in VSE and saw it was different from what I was looking on on the web site. I missed the tabs on the left hand side, which defaults to C++, so I switched it to C# and now I feel better about what I am seeing. It is amazing how much easier it is to read C# and C++, but then again maybe it is because I have never done C++.

Then I move onto to understanding the XAML file. Unfortunately for the example code I am looking at, the Metro UI elements are dynamically filled in at run-time so the visual C# editor does not help me understand what is going on. I don't miss the days of XML so that it going backwards for me. I am going to grin and bear it as XAML is THE way to do visual layout in C#. It reminds of the in-house XML based tool I used a couple of years ago to generate iOS iPad/iPhone screens which was built using XAML principles for grid layout and relative sizes. It was a precursor to the XML that Apple created which is behind the iOS storyboards. The big difference is that I never need to know or see the XML for iOS storyboards.

Now this is something I guess I never knew about Windows. To bring up the global find dialog in VSE, you have to type the shortcut of Ctrl-Shift-F or so the EDIT menu says. But I have to actually type Shift-Ctrl-F. I guess I just never realized or cared to know that the sequence of keys clicked matters. I really still believe it so I have to try it several times by clicking on different places in VSE to select the different views. Sure enough only Shift-Ctrl-F ever works. I still think this has to be a bug in VSE or a mode problem that I need something selected or not selected for the find to work. Anyway, I finally found how the "S1_ParseAndStringify" XAML file is loaded as that is in the partial class "Constants.cs" - that was odd and hard to follow how the XAML file was loaded in the "MainPage.xaml" but now the mystery was solve by using the global find dialog. I think that is enough learning about C# to get me going.

I need to get back to figuring out to transfer data from a remote server. Good news, I found an example where I can enter my remote server URL and get the data. That sounds like a perfect place to start so I load the Background Transfer example in VSE. Now I am losing the little of confidence in VSE that I had. In the example, there was a URL that I wanted to change to the secure remote server URL. I kept trying to find ways of editing the Visual C# view and then I tried editing the XAML file but nothing happened. VSE would not let me edit either one. I then searched the web to find an explanation of how to do this simple task and found an explanation of how to edit XAML. That just does not seem right that I have to read how to edit a file. Turns out you have to launch another tool called Expression Blend. This is the kind of product fragmentation that I thought was way too over kill when I first used Visual Studio over 8 years ago. Apparently that was not fixed and has gotten worse over time. Maybe my Visual Studio Professional will fix everything for me. One more slip like that and I am going for broke and start using Pro! I save the changes in Expression Blend and then close it and go back to VSE. I see a message telling me the file I am looking at was changed and it asked me if I want to reload the file with the changes. Of course I say yes. Then I see the visual part of the XAML file did not change. I did not think about it and hit the F7 key to build the project. Then magically the view changed to match the XAML file I saw had my changes. I looked at the file in VSE and see a lock in the tab and hovering over the icon I see the full path to the file and "(Read Only)", so that explains everything. Then guess what? It worked like a charm when I ran it, wait I cannot use that word as it means something else in Windows 8. Now all I have to do is find the file on the file system somewhere. I quickly go to Windows File Explorer hoping that it can help me and search for "DownloadedFile.txt" on "This PC" and finally near the end of the search it found the file for me! It was located in "C:\Users\Rick\Pictures". When I looked at the code behind I thought that is where it would be as I saw this line:

destinationFile = await KnownFolders.PicturesLibrary.CreateFileAsync( 
                    destination, CreationCollisionOption.GenerateUniqueName);
I doubled clicked on the file in Windows File Explorer and the file was loaded into Notepad and I saw the correct contents. Now we are in business as I know how to connect to a remote RESTful service and get my data.

I want to check on one last tricky part that is required for the final prototype, since I want to explore all of the most difficult parts of the app at the very beginning. After geographic maps and getting data from a secure remote server, I need a range slider which I don't think is part of the standard Metro UI elements. I either need to make sure it does not exist already or be able to find one publicly available that I can easily use. When search for "Windows 8 Metro UI" in Google, the first match is quite amusing as it explains how to get rid of Metro on Windows 8. The second link I clicked on was CSS to convert Twitter Bootstrap to look like Windows 8 Metro. Once I added "MSDN" to the start of that search then I started finding interesting things, like the Font-Awesome equivalent for Windows 8 Metro called Seqoe UI Symbol font. I will need that later one for sure. That reminds me I need a way to render SVG files on the map so I need to check on that today also. I found an example that draws a path at a GPS point, so that will work just fine - this example uses Silverlight but should be easy to replicate in C# as I just wanted to make sure it was possible.

I have searched and researched and found no such slider component. I then recalled using Infragistics many years ago and low and behold they are still in business; however, they did not have the dual range slider component I was looking for. I then reverted to using StackOverflow and found a page that listed useful 3rd party components for .NET development. Component Factory was WindowsForms so not what I need to use at all. Telerik has some nice looking components but not what I needed. ComponentOne has tons of great looking components, but still not the one I needed.
Peter Blum's site had many components but nothing that looked worthwhile comparing to the others already mentioned. I am definitely seeing a trend as viblend has several of the components I had seen previously with the Calendar being the most common shared one among them all. The last one was DevExpress and it sure was proud of all of their awards and they listed them as huge images at the top of their page. Unfortunately they also brag about their $499.99 price tag and that is pretty scary to me. I like their list of components and they have a Spark Range Selector that matches what I need. What I really need that I am missing is a Date Picker and Range Slider. Maybe I am not searching for the right text. If I search in Google for "Spark Range Selector" then I find tons of Adobe Flex 4 Spark components that match what I want. That brings back memories from 5 years ago when I wrote Flex components for an app and now I remember that "spark" was the name for the version 4 UI components Adobe delivered. Not going to help me now. I go back to Ms. Google and search for "windows 8 range selector" and find that Telerik has the exact one I need as well. My sticker shock is increasing as their Windows 8 .NET UI Control Suite is $999. Hey, if I want all of their components it would normally cost $7,739 and I can get them all for the bargain price of $1,999. I think I need to find another solution quickly. I found a free one I am going to try that I found using Google called Perpetuum Software as they have the dual range slider I need. I keep searching and found what $399 would buy me from Syncfusion. I am going to give up and try the Perpetuum components since they are free without support. Now I am loosing confidence since I could not down their components on Windows as the sign up form never appeared! I go to my Mac and access the same page in Safari and it works. I downloaded the license and the standard version of their components and put them on my SkyDrive. How odd is that? If I can get the Range Slider then I will put up with such foolishness. My folder never showed up on Windows 8, so I just moved the files out into the main Documents folder and they still up. I guess I was not patient enough as they finally showed up after I had already moved the files out of the Downloads folder. I extracted their files and when I tried to load the package in VSE I got an error so time to give up for the day. I tried to chat with Perpetuum but it said the chat service was not available so I sent them an email. Maybe tomorrow I will come to work and everything will be fully explained in the reply email - at least I can hope but I seriously doubt that will happen.

No comments: