Beispiel #1
0
 private void dialogButton_DialogButtonClick(object sender, DialogButton.DialogButtonClickEventArgs e)
 {
     DialogResult = e.Result;
     Close();
 }
Beispiel #2
0
 private void DialogButton_DialogButtonClick(object sender, DialogButton.DialogButtonClickEventArgs e)
 {
     Close();
 }
Beispiel #3
0
        private void DialogButton_DialogButtonClick(object sender, DialogButton.DialogButtonClickEventArgs e)
        {
            RichTextBox _richTextBox = new RichTextBox();

            _themeHelper.RichTextBoxTheme(_richTextBox);

            CodeType _newType = (CodeType)_typeComboBoxHelper.GetValue();
            CodeType _oldType = Snippet.CodeType;

            DialogResult = e.Result;
            if (e.Result == DialogResult.OK)
            {
                Snippet.DefaultChildCodeType = (CodeType)_defaultTypeComboBoxHelper.GetValue();
                Snippet.CodeType             = _newType;

                bool _changed = false;

                if (_newType == CodeType.RTF && _oldType != CodeType.RTF)
                {
                    _richTextBox.Text = Snippet.GetCode();
                    Snippet.SetRtf(_richTextBox.Rtf, out _changed);
                }
                else if (_oldType == CodeType.RTF && _newType != CodeType.RTF)
                {
                    _richTextBox.Rtf = Snippet.GetRTF();
                    Snippet.SetCode(_richTextBox.Text, out _changed);
                }


                Snippet.DefaultChildName = tbName.Text ?? string.Empty;
                Snippet.SetDefaultChildCode(tbCode.Text ?? string.Empty, out _changed);

                if (Snippet.DefaultChildCodeType == CodeType.RTF)
                {
                    if (!string.IsNullOrEmpty(rtf.Text))
                    {
                        Snippet.SetDefaultChildRtf(rtf.Rtf, out _changed);
                    }
                }
                else
                {
                    Snippet.SetDefaultChildRtf(string.Empty, out _changed);
                }
                Snippet.DefaultChildCodeTypeEnabled = checkBoxCodeType.Checked;

                Snippet.Expanded    = cbExpand.Checked;
                Snippet.Important   = cbImportant.Checked;
                Snippet.AlarmActive = cbAlarm.Checked;
                Snippet.Wordwrap    = cbWordWrap.Checked;
                Snippet.HtmlPreview = cbHtmlPreview.Checked;
                if (Snippet.AlarmActive)
                {
                    Snippet.AlarmDate = datePicker.Value.Date.Add(timeControl.Value.TimeOfDay);
                }
                else
                {
                    Snippet.AlarmDate = null;
                }
                Keys _keys = (Keys)_shortCutKeysComboHelper.GetValue();
                _keys = _keys & ~Keys.Control;
                _keys = _keys & ~Keys.Alt;
                _keys = _keys & ~Keys.Shift;

                if (cbControl.Checked)
                {
                    _keys = _keys | Keys.Control;
                }
                if (cbShift.Checked)
                {
                    _keys = _keys | Keys.Shift;
                }
                if (cbAlt.Checked)
                {
                    _keys = _keys | Keys.Alt;
                }

                Snippet.ShortCutKeys = _keys;
            }
            Close();
        }