using System.Collections;
using System.Windows.Forms;
using System.Collections.Generic;
using Microsoft.VisualStudio.DebuggerVisualizers;
using VisualizerLib;
[assembly: System.Diagnostics.DebuggerVisualizer(
typeof(DictionaryVisualizer.DebuggerSide),
typeof(VisualizerObjectSource),
Target = typeof(Dictionary<,>),
Description = "Dictionary Visualizer")]
namespace DictionaryVisualizer
{
public class DebuggerSide : DialogDebuggerVisualizer
{
#region Visualizer Logic
private DictionaryProcessor dictionaryProcessor;
override protected void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
{
// Initialize datagrid and form
InitializeComponent();
try
{
// Get the dictionary
IDictionary dict = (IDictionary)objectProvider.GetObject();
// Get the keys in the grid view
dictionaryProcessor = new DictionaryProcessor(dict);
dictionaryProcessor.CreateKeyList();
dictionaryProcessor.GetDictionary(true, null, dgvKeys);
// Get the first element value
dgvKeys_CellClick(null, new DataGridViewCellEventArgs(0, 0));
}
catch { }
// Show the grid with the list
windowService.ShowDialog(form);
}
private void dgvKeys_CellClick(object sender, DataGridViewCellEventArgs e)
{
// Get the value in the grid view
if (dictionaryProcessor.KeyList.Count > 0 && e.RowIndex >= 0 &&
e.RowIndex < dictionaryProcessor.KeyList.Count)
{
dgvValues.Columns.Clear();
object key = dictionaryProcessor.KeyList[e.RowIndex];
dictionaryProcessor.GetDictionary(false, key, dgvValues);
}
}
#endregion
#region Windows Form Designer generated code
private System.Windows.Forms.Form form;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dgvKeys = new System.Windows.Forms.DataGridView();
this.dgvValues = new System.Windows.Forms.DataGridView();
this.lblValues = new System.Windows.Forms.Label();
this.lblKeys = new System.Windows.Forms.Label();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
((System.ComponentModel.ISupportInitialize)(this.dgvKeys)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvValues)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
form = new Form();
form.SuspendLayout();
//
// dgvKeys
//
this.dgvKeys.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dgvKeys.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvKeys.Location = new System.Drawing.Point(4, 24);
this.dgvKeys.Margin = new System.Windows.Forms.Padding(4);
this.dgvKeys.Name = "dgvKeys";
this.dgvKeys.ReadOnly = true;
this.dgvKeys.RowTemplate.Height = 24;
this.dgvKeys.Size = new System.Drawing.Size(672, 231);
this.dgvKeys.TabIndex = 0;
this.dgvKeys.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvKeys_CellClick);
//
// dgvValues
//
this.dgvValues.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvValues.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvValues.Location = new System.Drawing.Point(4, 283);
this.dgvValues.Margin = new System.Windows.Forms.Padding(4);
this.dgvValues.Name = "dgvValues";
this.dgvValues.ReadOnly = true;
this.dgvValues.RowTemplate.Height = 24;
this.dgvValues.Size = new System.Drawing.Size(672, 232);
this.dgvValues.TabIndex = 1;
//
// lblValues
//
this.lblValues.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblValues.AutoSize = true;
this.lblValues.Location = new System.Drawing.Point(4, 262);
this.lblValues.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblValues.Name = "lblValues";
this.lblValues.Size = new System.Drawing.Size(672, 17);
this.lblValues.TabIndex = 2;
this.lblValues.Text = "Values:";
//
// lblKeys
//
this.lblKeys.AutoSize = true;
this.lblKeys.Location = new System.Drawing.Point(4, 0);
this.lblKeys.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblKeys.Name = "lblKeys";
this.lblKeys.Size = new System.Drawing.Size(43, 17);
this.lblKeys.TabIndex = 3;
this.lblKeys.Text = "Keys:";
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.lblKeys, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.dgvValues, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.lblValues, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.dgvKeys, 0, 1);
this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 6);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(680, 519);
this.tableLayoutPanel1.TabIndex = 4;
//
// DictionaryVisualizer
//
form.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
form.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
form.ClientSize = new System.Drawing.Size(708, 537);
form.Controls.Add(this.tableLayoutPanel1);
form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
form.Margin = new System.Windows.Forms.Padding(4);
form.Name = "DictionaryVisualizer";
form.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
form.Text = "Dictionary Visualizer";
((System.ComponentModel.ISupportInitialize)(this.dgvKeys)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvValues)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
form.ResumeLayout(false);
}
private System.Windows.Forms.DataGridView dgvKeys;
private System.Windows.Forms.DataGridView dgvValues;
private System.Windows.Forms.Label lblValues;
private System.Windows.Forms.Label lblKeys;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
#endregion
}
}