Ejemplo n.º 1
0
 public CadForm(string[] args)
 {
     InitializeComponent(); // makes the cadCanvas and the propertiesExplorer
     KeyPreview = true;     // used to filter the escape key (and maybe some more?)
     cadFrame   = new CadFrame(propertiesExplorer, cadCanvas, this);
     cadFrame.ProgressAction  = (show, percent, title) => { this.ProgressForm.ShowProgressBar(show, percent, title); };
     cadCanvas.Frame          = cadFrame;
     propertiesExplorer.Frame = cadFrame;
     // show this menu in the MainForm
     MenuWithHandler[] mainMenu = MenuResource.LoadMenuDefinition("SDI Menu", true, cadFrame);
     #region DebuggerPlayground, you can remove this region
     // in the following lines a "DebuggerPlayground" object is created via reflection. This class is a playground to write testcode
     // which is not included in the sources. This is why it is constructed via reflection, there is no need to have this class in the project.
     Type dbgplygnd = Type.GetType("CADability.Forms.DebuggerPlayground", false);
     if (dbgplygnd != null)
     {
         MethodInfo connect = dbgplygnd.GetMethod("Connect");
         if (connect != null)
         {
             mainMenu = connect.Invoke(null, new object[] { cadFrame, mainMenu }) as MenuWithHandler[];
         }
     }
     #endregion DebuggerPlayground
     Menu = MenuManager.MakeMainMenu(mainMenu);
     cadFrame.FormMenu = Menu;
     // open an existing Project or create a new one
     ToolBars.CreateOrRestoreToolbars(topToolStripContainer, cadFrame);
     Application.Idle += new EventHandler(OnIdle); // update the toolbars (menus are updated when they popup)
 }
Ejemplo n.º 2
0
 public DebugForm() : base(new string[] { })
 {
     // Trace.WriteLine("DebugForm constructor");
     Text = "CADability.Forms.DebugForm";
     CadFrame.GenerateNewProject();
     // Trace.WriteLine("Project created");
 }
Ejemplo n.º 3
0
        private CadFrame cadFrame; // the frame, which knows about the views, the ControlCenter (PropertiesExplorer), the menu

        #endregion PRIVATE FIELDS

        /// <summary>
        /// Default constructor
        /// </summary>
        public CadControl()
        {
            InitializeComponent(); // makes the cadCanvas and the propertiesExplorer

            cadFrame                 = new CadFrame(propertiesExplorer, cadCanvas, this);
            cadCanvas.Frame          = cadFrame;
            propertiesExplorer.Frame = cadFrame;

            // We cannot complete the control setup at this moment because the ParentForm is null
            // We must use the OnHandleCreated method
        }
Ejemplo n.º 4
0
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            cadFrame.Dispose();
            Menu.Dispose();
            this.Dispose();
            cadCanvas.Dispose();
            propertiesExplorer.Dispose();
            topToolStripContainer.Dispose();
            splitContainer.Dispose();
            if (progressForm != null)
            {
                progressForm.Dispose();
            }

            Menu                  = null;
            cadFrame              = null;
            cadCanvas             = null;
            propertiesExplorer    = null;
            topToolStripContainer = null;
            splitContainer        = null;
            progressForm          = null;

            base.OnFormClosed(e);
        }