when I'm adding some Layers to my CadEditorControl see all my layers and the layer "0".
When I click on the layer "0" a "{"Object reference not set to an instance of an object."} exception is thrown (stack trace below).
When I remove the "0" layer from the LayerForm.LayerList the first layer throws the same exception. As I figured out I can't access the event when the layers are seletced inside the LayerForm.
When I'm createing a new Image, I'm adding 2 additional Layers: Picture(2)/ Drawing(3). After adding some content the slection of the layers 2/3 works, if empty the exception is also thrown.
My Code for adding the layers is:
Code: Select all
private CADLayer CreateLayers()
{
CADLayer picLayer = CreateLayer("Picture");
CADLayer layer = CreateLayer("Drawing");
layer.IsPlotting = true;
_currentLayer = layer;
return picLayer;
}
private CADLayer CreateLayer(string name)
{
CADConverter converter = ImageConverter();
CADLayer layer = new CADLayer();
layer.Name = name;
layer.Color = Color.RoyalBlue;
layer.Visibility = true;
converter.Layers.Add(layer);
converter.OnCreate(layer);
converter.Loads(layer);
AddRecordToLayerList(layer.Name, layer.Color, true, false);
return layer;
}
Thank you,
Roman
Stack Trace:
at System.Collections.Generic.List`1.get_Item(Int32 index)
at CADImport.CADEntityCollection.get_Item(Int32 index)
at CADImport.FaceModule.CADImportFace.SelectLayer(Int32 ind, CADImage img)
at CADImport.CADImportControls.CADEditorControl.(ArrayList , ListEventSelectArgs )
at CADImport.FaceModule.CADListView.OnSelectItem(ArrayList items, ListEventSelectArgs e)
at CADImport.FaceModule.CADListView.(Int32 )
at CADImport.FaceModule.CADListView.SelectCells(Int32 x, Int32 y, Boolean fullItem)
at CADImport.FaceModule.CADListView.OnMouseDown(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at CADImport.FaceModule.CADListView.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.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr 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.Form.ShowDialog(IWin32Window owner)
at CADImport.CADImportControls.CADEditorControl.(Object , ToolBarButtonClickEventArgs )
at System.Windows.Forms.ToolBarButtonClickEventHandler.Invoke(Object sender, ToolBarButtonClickEventArgs e)
at System.Windows.Forms.ToolBar.WmReflectCommand(Message& m)
at System.Windows.Forms.ToolBar.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at CADImport.CADImportControls.CADEditorControl.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolBar.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.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr 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 Microsoft.Practices.CompositeUI.WinForms.FormShellApplication`2.Start()
at Microsoft.Practices.CompositeUI.CabApplication`1.Run()
at Elitec.Infrastructure.Shell.ShellApplication.RunInDebugMode() in D:\Projects\Elitec Software\Source\Infrastructure\Shell\ShellApplication.cs:line 56
at Elitec.Infrastructure.Shell.ShellApplication.Main() in D:\Projects\Elitec Software\Source\Infrastructure\Shell\ShellApplication.cs:line 47
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()