TestSnapinBase.cs :  » Development » MMC » MMCTest2 » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Development » MMC 
MMC » MMCTest2 » TestSnapinBase.cs
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;

using Ironring.MMC.Core;
using Ironring.MMC.Nodes;
using Ironring.MMC.Wizards;

namespace MMCTest2{
  /// <summary>
  /// 
  /// </summary>
  [
  SnapinIn("MMClib2 TestSnapin", "Ironring Software", "0.9.0.000"),
  ProgId("MMCLibrary.MMCTest"),
  Guid("CC80F65A-54D8-4899-B1AE-892248EEE50D")
  ]
  public class TestSnapinBase : SnapinBase, IMessageFilter
  {
    public TestSnapinBase() : base()
    {
      try 
      {
        // the first node in the tree
        BaseNode rootNode = new BaseNode(this, "TestSnapin2", "MMCTest2.images.Closed.ico", "MMCTest2.images.Open.ico");
      
        rootNode.ResultViewSmallImage = "MMCTest2.images.snapin.Ico";
  
        // we want the root node to be pastable to paste the dragable notes on top of it.
        rootNode.Pasteable = true;
        System.Diagnostics.Debug.WriteLine("::RootNode initialized");

        // First FormNode test
        rootNode.AddChild(new MyFormNode(typeof(UserControl2), this, "My First Form Node", "MMCTest2.images.Closed.ico", "MMCTest2.images.Open.ico"));
        System.Diagnostics.Debug.WriteLine("::First FormNode initialized");
        
        // OCXNode test
        rootNode.AddChild(new MyOCXNode(this, "My OCX Node", new Guid("8E27C92B-1264-101C-8A2F-040224009C02"), "MMCTest2.images.Closed.ico", "MMCTest2.images.Open.ico"));
        System.Diagnostics.Debug.WriteLine("::OCXNode initialized");
        
        // ReportNode test
        rootNode.AddChild(new MyReportNode(this, "Pets Palace", "MMCTest2.images.Closed.ico", "MMCTest2.images.Open.ico"));
        System.Diagnostics.Debug.WriteLine("::First ReportNode initialized");
        
        // Second FormNode test (same as first, different UserControl)
        rootNode.AddChild(new MyFormNode(typeof(UserControl1), this, "My Second Form Node", "MMCTest2.images.Closed.ico", "MMCTest2.images.Open.ico"));
        System.Diagnostics.Debug.WriteLine("::Second FormNode initialized");

        // special FolderNode test
        rootNode.AddChild(new MyFolderNode(this, Directory.GetCurrentDirectory(), "Folder Node", "MMCTest2.images.Closed.ico", "MMCTest2.images.Open.ico"));
        System.Diagnostics.Debug.WriteLine("::FolderNode initialized");

        // drag and drop nodes test
        rootNode.AddChild(new MyDragDropNode(this, "Drag and Drop Me", "MMCTest2.images.Closed.ico", "MMCTest2.images.Open.ico"));
        rootNode.AddChild(new MyDragDropNode(this, "Drag and Drop Me", "MMCTest2.images.Closed.ico", "MMCTest2.images.Open.ico"));
        rootNode.AddChild(new MyDragDropNode(this, "Drag and Drop Me", "MMCTest2.images.Closed.ico", "MMCTest2.images.Open.ico"));
        System.Diagnostics.Debug.WriteLine("::DragAndDropNodes initialized");

        // html node test
        rootNode.AddChild(new MyHTMLNode(this, "HTML Node", "www.google.com", "MMCTest2.images.Closed.ico" ));
        System.Diagnostics.Debug.WriteLine("::HTMLNode initialized");

        // polyNode test
        rootNode.AddChild(new PolyNode(this, "PolyNode", "MMCTest2.images.Closed.ico", "MMCTest2.images.Closed.ico"));

        // testnode
        rootNode.AddChild(new TestNode(this, "TestNode", "MMCTest2.images.Closed.ico", "MMCTest2.images.Closed.ico"));

      }
      catch(Exception e)
      {
        System.Diagnostics.Debug.WriteLine("Oops in SnapinBase<init>: " +e);
      }
    }

    // The Wizard see comment on WizardMethod()
    protected override void ShowInitialisationWizard()
    {
      WizardBase.ShowWizard("Startup Snapin Manager Wizard", new WizardPage[] {new WzdSnapinManager()}, new WizardBase.WizardAction(ManagerHandler));
    }

    private void InitializeComponent()
    {
      // 
      // TestSnapinBase
      // 
      this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TestSnapinBase_KeyPress);

    }

    private void TestSnapinBase_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
    {
      if(e.KeyChar == (char)13) System.Windows.Forms.MessageBox.Show("hoi");
    }

    const int WM_KEYDOWN = 0x100;
    const int WM_KEYUP = 0x101;

    public bool PreFilterMessage(ref Message m)
    {
      Keys keyCode = (Keys)(int)m.WParam & Keys.KeyCode;
      if(m.Msg == WM_KEYDOWN && keyCode == Keys.Enter)
      {
        System.Windows.Forms.MessageBox.Show("hoi dit is een enter");
        return false;
      }
      return true;
    } 
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.