Example #1
0
        public void AddModule(IGenericMenuCallback callback)
        {
            String name = callback.RequestString("Add Module", "Name for new module:");

            if (name != null)
            {
                bool           success;
                Transaction    xn   = new Transaction();
                IProjectAccess proj = xn.RequestWriteAccess(window.Project);
                using (xn.Start()) {
                    ProjectModule cur = proj.GetModule(name);
                    if (cur == null)
                    {
                        success = true;
                        proj.AddModule(name, new LayoutModel());
                    }
                    else
                    {
                        success = false;
                    }
                }
                if (!success)
                {
                    callback.Notify("Cannot Add", "Cannot add second module of same name.");
                }
            }
        }
Example #2
0
        public WindowModel()
        {
            this.Project = new Project();
            Transaction    xn   = new Transaction();
            IProjectAccess proj = xn.RequestWriteAccess(this.Project);
            ProjectModule  currentModule;

            using (xn.Start()) {
                currentModule = proj.AddModule("main", new LayoutModel());
            }

            this.LayoutCanvas = new LayoutCanvasModel(this);
            this.ToolboxModel = new ToolboxModel(this);
            this.ToolbarModel = new ToolbarModel(this);
            this.simThread    = null;

            menus.Add(new ProjectMenu(this));
            SetView(currentModule);
        }