示例#1
0
 /// <summary>
 /// <ja>オプション値をオブジェクトに反映(パネルを開く度に実行される)</ja>
 /// </summary>
 public void InitUI(IExtendPasteOptions options)
 {
     this._useActionBox.SelectedItem            = options.UseAction;
     this._highlightKeywordBox.Text             = options.HighlightKeyword;
     this._showConfirmCheck.Checked             = options.ShowConfirmCheck;
     this._afterSpecifiedTimePasteCheck.Checked = options.AfterSpecifiedTimePaste;
     this._pasteTimeBox.Value       = options.PasteTime;
     this._changeDialogSize.Checked = options.ChangeDialogSize;
 }
示例#2
0
        /// <summary>
        /// <ja>コミット(パネルを切り替える度に実行される)</ja>
        /// </summary>
        public bool Commit(IExtendPasteOptions options)
        {
            StringResource sr         = ExtendPastePlugin.Instance.Strings;
            bool           successful = false;
            string         itemName   = null;

            try {
                options.UseAction               = ((EnumListItem <UseAction>)_useActionBox.SelectedItem).Value;
                options.HighlightKeyword        = _highlightKeywordBox.Text;
                options.ShowConfirmCheck        = _showConfirmCheck.Checked;
                options.AfterSpecifiedTimePaste = _afterSpecifiedTimePasteCheck.Checked;
                options.ChangeDialogSize        = _changeDialogSize.Checked;

                // 強調キーワード正規表現パターンチェック
                itemName = sr.GetString("Message.ExtendPasteOptionPanel.RegExpPettern");
                Regex RegExp = new Regex(options.HighlightKeyword, RegexOptions.Multiline);

                // ペースト秒数チェック
                itemName = sr.GetString("Message.ExtendPasteOptionPanel.AfterSpecifiedTimePaste");
                if ((_afterSpecifiedTimePasteCheck.Checked) && (_pasteTimeBox.Value > 0))
                {
                    options.PasteTime = (int)_pasteTimeBox.Value;
                }
                else
                {
                    options.PasteTime = 0;
                    options.AfterSpecifiedTimePaste = false;
                }

                successful = true;
            } catch (InvalidOptionException ex) {
                GUtil.Warning(this, ex.Message);
            } catch (Exception) {
                GUtil.Warning(this, String.Format(sr.GetString("Message.ExtendPasteOptionPanel.InvalidItem"), itemName));
            }

            return(successful);
        }