home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / InfoPath.en-us / InfLR.cab / FL_Visualizer_zip_147037_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 / Visualizer.cs next >
Text File  |  2005-09-23  |  2KB  |  53 lines

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Windows.Forms;
  5. using Microsoft.VisualStudio.DebuggerVisualizers;
  6.  
  7. namespace $rootnamespace$
  8. {
  9.     // TODO: Add the following to SomeType's definition to see this visualizer when debugging instances of SomeType:
  10.     // 
  11.     //  [DebuggerVisualizer(typeof($safeitemrootname$))]
  12.     //  [Serializable]
  13.     //  public class SomeType
  14.     //  {
  15.     //   ...
  16.     //  }
  17.     // 
  18.     /// <summary>
  19.     /// A Visualizer for SomeType.  
  20.     /// </summary>
  21.     public class $safeitemrootname$ : DialogDebuggerVisualizer
  22.     {
  23.         protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
  24.         {
  25.             // TODO: Get the object to display a visualizer for.
  26.             //       Cast the result of objectProvider.GetObject() 
  27.             //       to the type of the object being visualized.
  28.             object data = (object)objectProvider.GetObject();
  29.  
  30.             // TODO: Display your view of the object.
  31.             //       Replace displayForm with your own custom Form or Control.
  32.             using(Form displayForm = new Form())
  33.             {
  34.                 displayForm.Text = data.ToString();
  35.                 windowService.ShowDialog(displayForm);
  36.             }
  37.         }
  38.  
  39.         // TODO: Add the following to your testing code to test the visualizer:
  40.         // 
  41.         //    $safeitemrootname$.TestShowVisualizer(new SomeType());
  42.         // 
  43.         /// <summary>
  44.         /// Tests the visualizer by hosting it outside of the debugger.
  45.         /// </summary>
  46.         /// <param name="objectToVisualize">The object to display in the visualizer.</param>
  47.         public static void TestShowVisualizer(object objectToVisualize)
  48.         {
  49.             VisualizerDevelopmentHost visualizerHost = new VisualizerDevelopmentHost(objectToVisualize, typeof($safeitemrootname$));
  50.             visualizerHost.ShowVisualizer();
  51.         }
  52.     }
  53. }