Esempio n. 1
0
        public void SubstitutePlaceholder(TextBlock textBlock, string substitutedText, GenDataId id)
        {
            GenMultiUndoRedo multi = null;
            var body = textBlock.Body();
            var n    = body.FragmentList.Count;

            for (var i = n - 1; i >= 0; i--)
            {
                var text = body.FragmentList[i] as Text;
                if (text == null)
                {
                    continue;
                }

                var t = text.TextValue;
                var k = t.IndexOf(substitutedText, StringComparison.Ordinal);
                while (k != -1 && text != null)
                {
                    var command = new ReplaceSelectionWithPlaceholderCommand(text, k, k + substitutedText.Length, id, this);
                    command.Execute();
                    var undoCommand = new ReplacePlaceholderWithTextCommand(command.Placeholder, substitutedText, this);
                    (multi = multi ?? new GenMultiUndoRedo()).Add(new GenUndoRedo(undoCommand, command));
                    text = command.Text;
                    t    = command.Suffix;
                    k    = t.IndexOf(substitutedText, StringComparison.Ordinal);
                }
            }
            if (multi != null)
            {
                GeData.AddRedoUndo(multi);
            }
            GetNodeProfileText();
        }
Esempio n. 2
0
        public static GeData GetDefaultGeData(bool isInDesignMode = false)
        {
            var geData = new GeData();

            geData.Settings    = isInDesignMode ? geData.GetDesignTimeSettings() : geData.GetDefaultSettings();
            geData.ComboServer = isInDesignMode ? GetDesignTimeComboServer() : geData.GetDefaultComboServer();
            geData.Profile     = isInDesignMode ? geData.GetDesignTimeProfile(geData) : geData.GetDefaultProfile(geData);

            return(geData);
        }
Esempio n. 3
0
        private void AddRedoUndo(IGenCommand undoCommand, IGenCommand redoCommand)
        {
            var undoRedo = new GenUndoRedo(undoCommand, redoCommand);

            GeData.AddRedoUndo(undoRedo);
        }
Esempio n. 4
0
 public GeProfile(GeData geData)
 {
     GeData = geData;
 }
Esempio n. 5
0
 private IGenDataProfile GetDesignTimeProfile(GeData geData)
 {
     return(new GeProfile(geData));
 }
Esempio n. 6
0
 private IGenDataProfile GetDefaultProfile(GeData geData)
 {
     return(new GeProfile(geData));
 }