Пример #1
0
        private void ToolsButton_Click(object sender, EventArgs e)
        {
            if (sender == btnNew)
            {
                AddNewChild();
            }
            else
            {
                if (ActiveChild.Canvas.BackgroundImage == null)
                {
                    new NoImageFoundException().ThrowAndForget();
                    return;
                }

                if (sender == btnMouse)
                {
                    ActiveChild.SetEmptyTool();
                }
                else if (sender == btnSelect)
                {
                    ActiveChild.Lasso();
                }
                else if (sender == btnPen)
                {
                    ActiveChild.Pen();
                }
                else if (sender == btnPolioPen)
                {
                    ActiveChild.PolioPen();
                }
                else if (sender == btnCut)
                {
                    var allowCrop = SettingsTable.Get <bool>(Strings.VScan_AllowCropTool, false);
                    if (allowCrop)
                    {
                        ActiveChild.Cut();
                    }
                    else
                    {
                        new NotAllowedToolException().ThrowAndForget();
                    }
                }
                else if (sender == btnRubber)
                {
                    ActiveChild.Rubber();
                }
                else if (sender == btnRect)
                {
                    //TODO:
                }
                else if (sender == btnEllipse)
                {
                    //TODO:
                }
                else if (sender == btnText)
                {
                    ActiveChild.DoText();
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
        }