Hi,
I have been using the WPF diagram library succesfully so far within a full WPF environment. However, when I want to use it within an 'old' WinForms application I have to embed the WPF control inside an ElementHost. When I do this, I get an TypeInitializationException. I traced it back to the GraphicsUnit constructor, which makes use of the utilities class. When you execute this line in a windows forms (non-wpf) app, it will faill:
MindFusion.Diagramming.Wpf.GraphicsUnit pUnit = MindFusion.Diagramming.Wpf.GraphicsUnit.Pixel;
I guess there are some assumptions that are not valid outside a WPF environment.
Kind regards,
Bas
-- System.TypeInitializationException was unhandled Message="The type initializer for 'MindFusion.Diagramming.Wpf.GraphicsUnit' threw an exception." Source="MindFusion.Diagramming.Wpf" TypeName="MindFusion.Diagramming.Wpf.GraphicsUnit" StackTrace: at MindFusion.Diagramming.Wpf.GraphicsUnit..ctor(Double unitsPerInch, String name) at WindowsFormsApplication1.Form1.OnDoubleClick(EventArgs e) in C:\Developing\AgileDoc\trunk\software\AgileDoc\WindowsFormsApplication1\Form1.cs :line 25 at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNat iveMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at WindowsFormsApplication1.Program.Main() in C:\Developing\AgileDoc\trunk\software\AgileDoc\WindowsFormsApplication1\Program. cs:line 18 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.NullReferenceException Message="Object reference not set to an instance of an object." Source="MindFusion.Diagramming.Wpf" StackTrace: at MindFusion.Utilities.xe641d5636ba2c0e2() at MindFusion.Diagramming.Wpf.GraphicsUnit..cctor() InnerException:
|