コード例 #1
0
        protected override void ReplaceText(object textEditors)
        {
            NewVariantDialogResult res;

            if (_edited)
            {
                res = _dialogService.ShowNewVariantDialog(NameRu, NameEng);
            }
            else
            {
                var textEditorData = TextEditorsParameterConverter.GetEditorsFromParameter(textEditors);
                var word           = Config.GetLineWord(textEditorData.SourceTextEditor);
                res = _dialogService.ShowNewVariantDialog(word, String.Empty);
            }
            if (res != null)
            {
                NameRu  = res.NameRu;
                NameEng = res.NameEng;
                _valueStoreGroup.Items.Add(new ValueStoreItem(res.NameEng, res.NameRu));
                _featureLocalizer.ValueStore.Save();
                base.ReplaceText(textEditors);
                _edited = true;
                Config.RefreshVariants();
            }
            else
            {
                IsSelected = false;
            }
        }
コード例 #2
0
        /// <summary>
        /// Method to invoke when the ReplaceText command is executed.
        /// </summary>
        protected virtual void ReplaceText(object textEditors)
        {
            var textEditorData = TextEditorsParameterConverter.GetEditorsFromParameter(textEditors);
            var match          = GetMatchConfig(textEditorData.SourceTextEditor);

            if (match.Success)
            {
                Config.SetSelectedItem(this);
                var destLine = textEditorData.DestinationTextEditor.Document.GetLineByNumber(Config.LineNumber);
                textEditorData.DestinationTextEditor.Document.Replace(destLine.Offset, destLine.Length, match.ResultLine);
            }
        }