Example #1
0
        /// <summary>
        /// Execute the command.
        /// </summary>
        public override void execute()
        {
            try
            {
                CadKit.Helios.OptionsForm form = new CadKit.Helios.OptionsForm("CadKit.Plugins.LayerManager.AddLayer");
                form.Owner = CadKit.Helios.Application.Instance.MainForm;
                form.Icon  = CadKit.Helios.Application.Instance.MainForm.Icon;
                form.Text  = CadKit.Helios.Application.Instance.Name + " - Options";
                this._addPages(form);
                if (form.NumPages > 0)
                {
                    CadKit.Interfaces.IRenderLoop renderLoop = CadKit.Documents.Manager.Instance.ActiveView as CadKit.Interfaces.IRenderLoop;

                    bool useRenderLoop = false;

                    // Turn off render loop before we show the dialog.
                    if (null != renderLoop)
                    {
                        useRenderLoop            = renderLoop.UseRenderLoop;
                        renderLoop.UseRenderLoop = false;
                    }

                    try
                    {
                        if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            _form.addLayers();
                        }
                    }
                    finally
                    {
                        // Restore the render loop state.
                        if (null != renderLoop)
                        {
                            renderLoop.UseRenderLoop = useRenderLoop;
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine("Error 1648821079: Failed to show options dialog: {0}", e.Message);
            }
        }