Ejemplo n.º 1
0
        /// <summary>
        /// Imports the hierarchy of tools to use in the screen.
        /// </summary>
        public void Import(string file, DrawingToolbarPresenter drawingToolbarPresenter, EventHandler handler)
        {
            string path = Path.Combine(Software.ToolbarsDirectory, file);

            if (!File.Exists(path))
            {
                return;
            }

            List <List <AbstractDrawingTool> > hierarchy = ImportDrawingTools(path);

            Commit(hierarchy, drawingToolbarPresenter, handler);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Commit the tools to the toolbar.
        /// </summary>
        public void Commit(List <List <AbstractDrawingTool> > hierarchy, DrawingToolbarPresenter drawingToolbarPresenter, EventHandler handler)
        {
            foreach (List <AbstractDrawingTool> tools in hierarchy)
            {
                if (tools.Count == 0)
                {
                    continue;
                }

                if (tools.Count == 1)
                {
                    drawingToolbarPresenter.AddToolButton(tools[0], handler);
                }
                else
                {
                    drawingToolbarPresenter.AddToolButtonGroup(tools.ToArray(), 0, handler);
                }
            }
        }