Пример #1
0
        public void SelectTool(ITool tool)
        {
            ITool oldTool = null;
            ITool newTool = null;

            if (tool.IsActivatable)
            {
                if (ActivatedTools.Contains(tool))
                {
                    ActivatedTools.Remove(tool);
                }
                else
                {
                    ActivatedTools.Add(tool);
                }

                tool.IsActivated = ActivatedTools.Contains(tool);
            }
            else
            {
                oldTool = SelectedTool;

                SelectedTool?.Unselect();
                SelectedTool = tool;
                SelectedTool.Select();

                newTool = SelectedTool;
            }

            ToolSelected?.Invoke(this, new ToolSelectedEventArgs(oldTool, newTool));
        }