Exception Message Box in C#

 

Its time to forget the old traditional message box with limited functionalities. buttons, icons, text area and what not! Microsoft has unleashed a new message box – new, yet not so new.

For those who have used SQL Sever 2005 GUI, might have probably noticed a message box that shows additional information, copying the text to clipboard, a checkbox on message box, different set of buttons and many more features.  This message box is now open for reuse in your applications. 

This is not a ‘big-bang’ release made by Microsoft.  It has come out very quietly. Yes the name ‘ExceptionMessageBox’ is confusing – but you can still use it in your applications. This standalone exception dialog box can be used in applications just like any other managed APIs.

Probably, you never know the next version of myTracker may use this message box too :)

Let’s hear it from Microsoft:

The exception message box is a programmatic interface that you can use in your applications for any tasks for which MessageBox may be used. The exception message box is a supported managed assembly designed to elegantly handle managed code exceptions. It provides significantly more control over the messaging experience and gives your users the options to save error message content for later reference and to get help on messages.

Download Link: 

http://download.microsoft.com/download/f/7/4/f74cbdb1-87e2-4794-9186-e3ad6bd54b41/SQLServer2005_EMB.msi 

Continue reading » · Rating: · Written on: 02-24-09 · 1 Comment »

Using Smart Client with Enterprise Library 4

Wow!  Compatibility between SCSF and EL 4 has troubled me many a times in some of my critical projects. Visual Studio 2008 does not allow installation of EL 3.1 and SCSF is based on EL 3.1.

To install EL 4.0 and to make it compatible with SCSF on VS2008 – here are the steps:

1. Rebuild Block Assemblies
2. Update Guidance Package
3. Update SCSF Application
 

Rebuild Block Assemblies

1. Extract the Smart Client Software Factory Source Code.

2. Open the SmartClient.Offline solution located at the source code installation folder.

3. Remove from the SmartClient.EnterpriseLibrary and SmartClient.EnterpriseLibrary.Tests projects the references to the following assemblies:

     –  Microsoft.Practices.EnterpriseLibrary.Common
     -  Microsoft.Practices.EnterpriseLibrary.Data
     –  SmartClient.EnterpriseLibrary.Data.SqlCe

4. Add, In the SmartClient.EnterpriseLibrary and SmartClient.EnterpriseLibrary.Tests projects, references to the following Enterprise Library assemblies (located at Enterprise Library assemblies located at %Enterprise Library 4 installation folder%\Bin):

     –  Microsoft.Practices.EnterpriseLibrary.Common.dll
     –  Microsoft.Practices.EnterpriseLibrary.Data.dll
     –  Microsoft.Practices.EnterpriseLibrary.Data.SqlCe.dll

5. In the SmartClient.EnterpriseLibrary project, open SmartClientDatabase.cs file and replace the following using statement:

using Microsoft.Practices.SmartClient.EnterpriseLibrary.Data.SqlCe;

with:

using Microsoft.Practices.EnterpriseLibrary.Data.SqlCe;

 

Updating the Guidance Package
 

 

 

1. Open the GuidancePackage solution located at the SC-SF source folder.

2. Open the App.config.template located under the folders located at Templates\Solutions\Projects\Shell.*.* (Shell.Basic.CS, Shell.Basic.VB, Shell.Extended.CS and Shell.Extended.VB) in the SmartClientFactoryPackage project.

3. Find and replace on each App.config.template file the string “Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” with “Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”.

4. Create a folder to store the new assemblies (e.g. at %SC-SF installation folder%\Lib with EntLib 4.0). In this folder, copy the Enterprise Library 4.0 assemblies and the Smart Client assemblies generated in Step 1. You should have the same assemblies you have at %SC-SF installation folder%\Lib but updated to use Enterprise Library 4.0.

5. Open the file CreateSmartClientFactorySolutionCommon.xml file located at Recipes\Common folder of the SmartClientFactoryPackage project. You will change the path where the Create Solution recipe looks for the required assemblies by default.


6.
 Find the SupportLibrariesPath argument and replace it with the following:

<Argument Name=”SupportLibrariesPath” Required=”true” Type=”System.String”>
  <ValueProvider Type=”Evaluator” Expression=”Paste here the path to the folder created at Step 4″>
  </ValueProvider>
</Argument>

7. Save all.

8. Register the custom Guidance Package. To do this, right click the SmartClientFactoryPackage project and select Register Guidance Package.

 

Update existing SCSF Application

 

1. If your solution uses the Microsoft.Practices.SmartClient.EnterpriseLibrary.dll assembly, follow the steps described in the Rebuilding the Block Assemblies section to update this assembly and perform the following sub-steps:

  1.  
    1. Find the Microsoft.Practices.SmartClient.EnterpriseLibrary.dll generated assembly located at %Source code installation folder%\Blocks\Offline\Source\DataAccess.EnterpriseLibrary\bin\Debug.
    2. Copy the previous assembly and replace them in the Lib folder of your solution.
    3. Update the references of your projects to use the updated Microsoft.Practices.SmartClient.EnterpriseLibrary.dll assembly
    4. Remove the reference to Microsoft.Practices.SmartClient.EnterpriseLibrary.Data.SqlCe.dll (it was replaced with the one provided by Enterprise Library 4) and add a reference to Microsoft.Practices.EnterpriseLibrary.Data.SqlCe.dll assembly located at %Enterprise Library 4 installation folder%\Bin.

2. Copy the Enterprise Library 4.0 assemblies (located at %Enterprise Library 4 installation folder%\Bin) and replace them in the Lib folder of your solution.

3. Update the references to the Enterprise Library assemblies in all the projects in your solution using the new assemblies copied into the Lib folder.

4. Open the App.config file and find and replace the string “Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” with “Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”.

5. Save all

Continue reading » · Rating: · Written on: 11-29-08 · No Comments »