It took longer to completely test the change that it took to add the new class and move the code into it. So as I was reading about the ToggleSwitch yesterday there were a couple of things I wanted to try as I took the defaults for the first pass. The first thing I want to try is to customize the on/off labels and then I can use the header label and get rid of my labels. That really cleaned up my code and now I can move onto my favorite task of date/time localization.
The quick start guide is the place to start yet again as there is one called Global-Ready Formats. The place I have to start is the Remarks within the DateTimeFormatter class as it lists all of the allowed string values. The best thing about the Remarks documentation is that it also shows examples of how to use the strings. That is the best class documentation I have seen so far as it is just what I need to get my job done. The only tricky part is that the JSON data coming from the server has Date/Time information and so I need to have that format fixed to match the data and it is in a standard form of "MM/dd/yyyy HH:mm:ss", so I kept that in place but all of the other date/time output needs to be localized. For that case I had to hard code the CultureInfo to be "en-US" as documented in the IFormatProvider class, which I found by looking at the ParseExtract method which I was already using.
Then it was just a matter of switching my code from using "DateTime.ToString(format)" to call "Windows.Globalization.DateTimeFormatting.DateTimeFormatter("shortdate longtime").Format(DateTime)" - piece of cake as that was right out of the DateTimeFormatter documentation under the Examples section. Now that is all done, it is time to completely switch gears and look into a new UI component.
That means it is time to look at the List of Windows Store controls again. I think I like the Menu Flyout so I am going to use that one and see how I like the look and interaction. My other alternative is to use a ComboBox. I need a menu to be associated with a button for a couple of choices so one of those is going to work. I am pretty happy with the Button Menu Flyout so that is what I am going with. The UI is complete so now I just need to hook that up, which should be very easy because I have my friend LINQ to help me.
Just when I thought this was going to be easy, I find out that C# is not going to help me with a deep copy of the data so I have to do it myself. At least I found a StackOverflow article that helped me do this. I also get to learn about the alternate LINQ method or lambda syntax as presented in that article as this one makes more sense to me that the syntax I have been using - but just in this case as I like the SQL like syntax in all of the other cases so far. I then went back to review all of the other LINQ statements I created to make sure they were valid and I noticed that my distinct count statements were wrong and needed to be rewritten using the lambda syntax which made a lot more sense for those cases. I used this StackOverflow article to help me.
So far yesterday was a big feature completed and today was another so I am definitely going to complete this list of new features in the allotted time and budget as if that was ever in doubt. It turns out that it is in doubt with every estimate as there are always unforeseen things that come up. I also need extra time to verify everything is absolutely correct and the data presented matches what is shown in the original Java app for the same time period.
One more small task before the day ends to create a play and stop button. I want to use the standard Segoe UI Symbol font so all I needed to know what how to set the font on the button and then the actual symbol, which resulted in the following:
No comments:
Post a Comment