﻿Needs["NETLink`"]
(*loads a WPF control*)
Test[] :=
	NETBlock[
		Module[{form, pictureBox, vertices, draggingVertex, onMouseMove, onMouseDown, lastX, lastY},
			InstallNET[];

			(* First load some classes from which we need to call static members. No assemblies need to be loaded
			   because the System.Windows.Forms and System.Drawing assemblies are preloaded by .NET/Link.*)
			
			LoadNETAssembly["d:\\MyFolders\\Desktop\\SymbolicMath\\Symbolic Math UI\\Bin\\Debug\\Symbolic_Math.dll"];
			LoadNETAssembly["d:\\MyFolders\\Desktop\\SymbolicMath\\Symbolic Math UI\\Bin\\Debug\\ControlLibrary.dll"];
			LoadNETAssembly["d:\\MyFolders\\Desktop\\SymbolicMath\\Symbolic Math UI\\Bin\\Debug\\WolframDisplay.dll"];			
			LoadNETAssembly["System.Core"];
			LoadNETAssembly["System"];
			LoadNETAssembly["PresentationCore"];
			LoadNETAssembly["PresentationFramework"];			
			LoadNETType["System.Windows.Window"];			

			(* Now create the main form and WPF user control, and set the desired properties.*)
			
			form = NETNew["System.Windows.Window"];
			form@Width = 600;
			form@Height = 500;			
			form@Title = "Test";
			pictureBox = NETNew["Math.Presentation.WolframEngine.BlankCanvas"]; 		
			
			form@Content = pictureBox;				
			
			(* Define the event callback functions. *)
			
			(* Wire up the event callbacks. *)			
			
			(* Initialize and show window. *)
			vertices = {};			
			form@Show[];			
		]
	]