private void buttonOK_Click(object sender, EventArgs e)
 {
     try
     {
         SaveSettings();
         DialogResult = DialogResult.OK;
         SheetProfile.ClearEvent();
     }
     catch
     {
         DialogResult = DialogResult.OK;
         SaveSettings();
     }
 }
        private void RedrawProfile()
        {
            if (_formIsInitialized && !_formHasError)
            {
                PrepareRedraw();

                #region Setup Sheet Config
                SpConfig.PolylineId = _polylineId;

                SpConfig.SheetThickness = (double)numericUpDownThickness.Value;
                SpConfig.InternalRadius = (double)numericUpDownInternalRadius.Value;

                SpConfig.OffsetSide = _offsetSide;
                SpConfig.SheetLayer = comboBoxMaterialLayer.Text;

                // SHEET
                try
                {
                    if (comboBoxMaterialColor.SelectedItem.ToString() == "ByLayer")
                    {
                        SpConfig.SheetColor = _drawingHelper.LayerManipulator.GetLayerColor(comboBoxMaterialLayer.Text);
                    }
                    else
                    {
                        SpConfig.SheetColor = (Color)comboBoxMaterialColor.SelectedItem;
                    }
                }
                catch
                {
                }

                // COATING
                SpConfig.DrawCoating  = checkBoxDrawCoating.Checked;
                SpConfig.CoatingSide  = _coatingSide;
                SpConfig.CoatingLayer = comboBoxCoatingLayer.Text;
                try
                {
                    if (comboBoxCoatingColor.SelectedItem.ToString() == "ByLayer")
                    {
                        SpConfig.CoatingColor = _drawingHelper.LayerManipulator.GetLayerColor(comboBoxCoatingLayer.Text);
                    }
                    else
                    {
                        SpConfig.CoatingColor = (Color)comboBoxCoatingColor.SelectedItem;
                    }
                }
                catch
                {
                    throw new Exception("Wrong color input.");
                }


                // DIMENSION
                SpConfig.DrawDimensions  = checkBoxDrawDimensions.Checked;
                SpConfig.DimensionStyle  = comboBoxDimensionStyle.Text;
                SpConfig.DimensionsLayer = comboBoxDimensionLayer.Text;
                try
                {
                    if (comboBoxDimensionColor.SelectedItem.ToString() == "ByLayer")
                    {
                        SpConfig.DimensionsColor = _drawingHelper.LayerManipulator.GetLayerColor(comboBoxDimensionLayer.Text);
                    }
                    else
                    {
                        SpConfig.DimensionsColor = (Color)comboBoxDimensionColor.SelectedItem;
                    }
                }
                catch
                {
                    throw new Exception("Wrong color input.");
                }

                SpConfig.DimensionStandart = _dimensionsStandart;

                #endregion

                SheetProfile.DrawProfile(SpConfig);
            }
        }
 private void buttonCancel_Click(object sender, EventArgs e)
 {
     SheetProfile.ClearEventA();
     Close();
 }