public ProjectMenu(WindowModel window) : base("Project") { this.window = window; AddItem(new GenericMenuItem("Add Module...", AddModule)); AddItem(new GenericMenuItem("Rename Module...", RenameModule)); AddItem(new GenericMenuItem("Remove Module", RemoveModule)); }
public ToolboxModel(WindowModel window) { this.window = window; Transaction xn = new Transaction(); IProjectAccess proj = xn.RequestReadAccess(window.Project); using (xn.Start()) { foreach (ProjectModule mod in proj.GetModules()) { string modName = proj.GetModuleName(mod); ToolboxModule toAdd = new ToolboxModule(mod, modName); if (mod == window.CurrentModule) { toAdd.SetName(toAdd.Name + "*"); currentModule = toAdd; } modules.Add(toAdd); } } window.Project.ProjectModifiedEvent += RefreshModules; List <ToolboxItem> builtins = new List <ToolboxItem>(); Component[] masters = { new AndGate(), new OrGate(), new NotGate(), new ToggleSwitch(), new Led(), new Pin(), new PinOut() }; foreach (Component master in masters) { builtins.Add(new ToolboxComponent(master)); } List <ToolboxDrawer> drawers = new List <ToolboxDrawer>(); drawers.Add(new ToolboxDrawer("Project", modules.AsReadOnly())); drawers.Add(new ToolboxDrawer("Built-Ins", builtins.AsReadOnly())); this.drawers = drawers.AsReadOnly(); }
public ToolbarModel(WindowModel window) { this.window = window; }