public void OpenDocument(IDocumentItem item)
 {
     if (item is TypeBase)
     {
         using (TypeBaseDialog dialog = new TypeBaseDialog())
         {
             dialog.ShowDialog((TypeBase)item);
         }
     }
     else
     {
         IDocument doc = Documents.FirstOrDefault(p => p.DocumentItem == item);
         if (doc != null)
             Show(doc);
         else
             Open(CreateDocument(item));
     }
 }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     try
     {
         if (((provider != null) && (context != null)) && (context.Instance != null))
         {
             if (dialog == null)
                 dialog = new TypeBaseDialog();
             var m = value as MemberInfo;
             if (m != null)
                 dialog.ShowDialog(m.Type, true);
         }
         return value;
     }
     catch (Exception exc)
     {
         Client.ShowError(exc.ToString());
         throw;
     }
 }
		private void mnuEdit_Click(object sender, EventArgs e)
		{
			if (Diagram != null)
			{
				TypeShape typeShape = Diagram.TopSelectedElement as TypeShape;
                if (typeShape != null)
                {
                    typeShape.IsActive = false;
                    using (TypeBaseDialog dialog = new TypeBaseDialog())
                    {
                        dialog.ShowDialog(typeShape.TypeBase);
                    }
                }
			}
		}