Designing, creating and reworking the calendar page maker for OneNote

  • When I was creating the calendar page maker, I focused on the date picker control and the functionality surrounding it first. My first tests did not do anything other than verify the long date format was used as the title of the newly created page.

  • On my system, the long date format looks like this:

  • Saturday, October 04, 2008

  • It was easy enough to verify the control was working exactly as expected. No big surprises here - all I was really doing was duplicated the testing that went into the control before it shipped. It shows the text in a certain format, and that format is what I use. This didn't bother me at all. I also wanted to ensure my understanding of how the control works was correct.

  • Next, I started varying the Regional Settings in the control panel to use a different format. I changed the format and instead of using a comma, I decided to use a character that Windows does not allow for filenames, the asterisk. It looked like this:

  • 04 October* 2008

  • Again, no surprises. OneNote does not use the page name as part of the file and I had expected this to work. The table which the addin creates used an asterisk instead of the comma.

  • Next, I changed my Regional Settings to use a different language. First, I chose Hebrew, and the date looked like this (assuming you can display Hebrew on your computer):

  • ‏שבת ‏04 ‏אוקטובר ‏2008

  • Both the datepicker and the page created in OneNote looked as expected. I also tried Chinese and Hindi to round out my testing.

  • I moved on to making sure the number of days you chose to make calendar pages worked as expected. Entering numbers worked fine, but I had no error detection to detect non-numeric entries. I went back to the code, added a simple routine to alert the user with a dialog box letting you know what was wrong and called it fixed. When I later added the number of blank lines to create for each time slot, I chose a drop down box with the numbers 1-10 in it, and block anyone from changing those values. This helps prevent the possible error condition, but it does not "scale well" for the number of days to make.

  • At this point I contemplated adding a second date picker to let you choose the end date. This could have exposed the most classic bug possible with start and end dates: the end date occurs before the start date! This situation leads to the next design consideration of the point at which the application notifies the user the end date is before the start date. Do I want to alert you when you change the value of the control? The advantage is the feedback is immediate, but the disadvantage is you get blocked until you fix the error. I hate that particular disadvantage - there are times when I know the data I'm entering is not finalized, but I need to move on to other tasks before finalizing my choices. I could also alert you when you press the "Make Pages" button. The advantage there is you do not get blocked until you try to commit your choices. The disadvantage is that you can be left with invalid data before you try to finalize your changes. In this simple application, that disadvantage is not all that important.

  • There is a third choice, though, and that is to avoid the situation altogether. I decided to go with a box that lets you tell the application how many days of pages you want to make. The errors you can still create are entering non-numeric data (I could create a filtered box that only lets you input numbers, or create a drop down pre-populated with 1 to 365 days), but this solution had the final advantage of being easiest to implement.

  • Since I knew the code, I performed a simple check to ensure text as input caused the alert to open, and numerals were accepted.

  • My performance testing was very limited. I only had my HP tablet to use as a test platform, and decided to use a maximum page creation size of 365 days. 18 seconds seemed reasonable, and the progress bar updated to let me know the application was working.

  • Satisfied that the application was functioning properly, I went back to the user request to see if I met his needs. I wanted to make sure he was able to choose a more flexible date format since I wasn't sure if he was suggesting the date format in his post as a suggestion, or requiring that single date format. I added the checkbox to let you choose between the long style date format and the short date format. I really liked this change since the OneNote "Insert Date" shortcut (SHIFT+ALT+D) uses the short format. I normally use that shortcut to create page titles, and now my powertoy will create pages that mesh nicely with my existing pages.

  • On my computer, the short date format looks like this:

  • 10/4/2008

  • The last thing I noticed was I was using the default Visual Studio "form" icon:

  • Boring, and I (think I) can do better. I pulled out my "red OneNote" icon and added it to the project. When I added it in, I noticed I had used the version 3.5 .NET Framework, which is still fairly new. Since I was not doing anything in code that required this newer version, I recompiled with the 2.0 version and called it done. I did not create a setup program - this application can be copied and run from any location.

  • Questions, comments, concerns and criticisms always welcome,

  • John