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;
}
}
}
|