A new version of the Microsoft tools for generating documentation using .Net Assemblies and code is now available for download. The new CTP offers a large number of fixes (over 200 as you can see in this post), but also some new features:
- New version of the CCI reflection engine.
- New presentation style and document model code named “VSORCAS”. Please see this post for details.
- Added 2 new executables under production tools folder. They are SegregateByAssembly.exe and AggregateByNamespace.exe. These are used for building componentized assembly level HxS or CHM.
- Configure MrefBuilder to get dependencies from GAC.
- Added build.proj under Examples/Sandcastle folder. This Msbuild project file will generate chm/Hxs build from test.cs.
An update such as this usually triggers a new version of the Sandcastle Help File Builder (SHFB) tool. As I am writing this it has not emerged yet, but that is not strange as the CTP is only available since early this morning. If you're using Sandcastle together with SHFB, then wait for that to become available with the new CTP. It usually happens within 24 hours after releasing a new CTP, so just be patient.
At my current project we use aspNetEmail for sending emails. One of our applications allow the users to register for a training course. We use the component to send invitations for Outlook and Exchange clients which automatically add the training course to the calendar.
The begin and end date for a calendar entry need to be defined in UniversalTime which is not a problem when you send invitations to users in the same time zone as the server that the application is running on. But we have users in various time zones in the US, in Russia, India and soon Malaysia, Singapore and Nigeria. In tests we noticed that the invitations we were sending to our users in those time zones were getting the wrong date and time once they were entered in their Outlook or Exchange calendar. So we needed to figure out a way to calculate the difference between the server time zone and the time zone the user was running. Here's how we solved it.
We first wrote a small piece of Java script which we included in the HEAD section of our ASPX page. The Java function returns the offset of the client time zone compared to the UTC.
function GetClientUTC()
{ var now = new Date();
var offset = now.getTimezoneOffset();
document.Form1.hdClientUTC.value = offset;
}
We then added an onload tag to the body section of the ASPX page:
<body MS_POSITIONING="GridLayout" onload="GetClientUTC()">
And because we are a little paranoid that users may change their time zone before they submit their registration for our training course we did the same for the onsubmit tag in the form section of the ASPX page:
<form id="formRegistration" method="post" runat="server" onsubmit="GetClientUTC()">
So we now have piece of Java code of which we are certain that it will assign the clients TimeZoneOffset value to a variable in our ASPX page. Which we need to define of course. For this we added the following line of code to our ASPX code behind file.
protected System.Web.UI.HtmlControls.HtmlInputHidden hdClientUTC;
We now know what the offset to the UTC is for our client. But in order to calculate the correct date and time for this time zone when we send invitations we need to know what the UTC offset for the webserver is:
private static int GetUtcOffset()
{ TimeSpan local = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
return (local.Hours * 60) + (local.Minutes);
}
We add this value to the UTC value we retrieved from the client. This now gives us a value in minutes which we can use to correctly calculate the invitation date and time for the time zone our user is located in:
int UTCOffset = int.Parse(hdClientUTC.Value.ToString());
UTCOffset += GetUtcOffset();
// Initialise email message using aspNetEmail
// Create invitation
appointment.Event.DateStart.Date = start.ToUniversalTime().AddMinutes((double)UTCOffset);
appointment.Event.DateStart.IsUTCDateTime = true;
appointment.Event.DateEnd.Date = end.ToUniversalTime().AddMinutes((double)UTCOffset);
appointment.Event.DateEnd.IsUTCDateTime = true;
And that's it. We can now send correct invitations to all time zones.
A lot of co-bloggers here at BloggingAbout.Net use Windows Live Writer Beta to post their new blog items. I just bumped into the new beta 2, which you can download here. A list of new features include:
Inline spell checking Table editing Ability to add categories Page authoring for WordPress and TypePad Support for excerpts and extended entries Improved hyperlinking and image insertion Paste Special SharePoint 2007 support Automatic synchronization of local and online edits Easy insert of tables. New Look & Feel. A full list of new features can be found here. And a troubleshooting guide should you have problems with the new version can be found here .
This post is written using the new version and sofar no problems!