Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainOutputWindow"/> class.
        /// </summary>
        public MainOutputWindow(MainWindow mainWindow, RootModel rootModel)
        {
            InitializeComponent();

            _mainWindow = mainWindow;
            RootModel   = rootModel;
            txtCommandInput.RootModel         = rootModel;
            txtCommandInput.GotFocus         += HandleGotFocus;
            txtCommandInput.GotKeyboardFocus += HandleGotFocus;
            txtCommandInput.LoadHistory(rootModel.Profile);
            secondaryScrollViewer.ScrollChanged += HandleScrollChanged;

            for (byte i = 1; i < 6; i++)
            {
                string msg = RootModel.GetVariableValue("statusBar" + i);
                string col = RootModel.GetVariableValue("statusBar" + i + "Col");
                SetStatusBar(i.ToString(), msg, col, false);
            }

            string displayStatusBar = rootModel.GetVariableValue("DisplayStatusBar");
            bool   shouldDisplay    = false;

            if (displayStatusBar != "")
            {
                bool.TryParse(displayStatusBar, out shouldDisplay);
            }

            DisplayStatusBar(shouldDisplay, false);
        }
Пример #2
0
        /// <summary>
        /// Matches the specified string.
        /// </summary>
        /// <param name="target">The string to match.</param>
        /// <param name="position">The position at the <paramref name="target"/> to start with.</param>
        /// <param name="matchingResults">The mathing results.</param>
        /// <returns>
        ///   <c>true</c> if matching was sucessfull; otherwise - <c>false</c>.
        /// </returns>
        public override MatchingResult Match(string target, int position, IList <string> matchingResults)
        {
            Assert.ArgumentNotNull(target, "target");
            Assert.ArgumentNotNull(matchingResults, "matchingResults");

            SearchValue = _rootModel.GetVariableValue(_variableName);
            return(base.Match(target, position, matchingResults));
        }
Пример #3
0
        /// <summary>
        /// Gets the parameter value.
        /// </summary>
        /// <param name="rootModel">The root model.</param>
        /// <param name="context">The context.</param>
        /// <returns>
        /// Parameter value.
        /// </returns>
        public override string GetParameterValue(RootModel rootModel, ActionExecutionContext context)
        {
            Assert.ArgumentNotNull(rootModel, "rootModel");
            Assert.ArgumentNotNull(context, "context");

            if (GroupMateNumber == 0)
            {
                return(rootModel.GetVariableValue("GroupMate"));
            }

            return(rootModel.GetVariableValue("GroupMate" + GroupMateNumber));
        }
        /// <summary>
        /// Gets the parameter value.
        /// </summary>
        /// <param name="rootModel">The root model.</param>
        /// <param name="context">The context.</param>
        /// <returns>
        /// Parameter value.
        /// </returns>
        public override string GetParameterValue(RootModel rootModel, ActionExecutionContext context)
        {
            Assert.ArgumentNotNull(rootModel, "rootModel");
            Assert.ArgumentNotNull(context, "context");

            return(rootModel.GetVariableValue(VariableName));
        }
Пример #5
0
        protected override string ReplaceVariables([NotNull] string input, [NotNull] RootModel rootModel)
        {
            StringBuilder sb = new StringBuilder();

            int lastPos = 0;
            int i       = 0;

            while (i < input.Length)
            {
                if (input[i] == '$')
                {
                    if (i - lastPos > 0)
                    {
                        sb.Append(input, lastPos, i - lastPos);
                    }

                    i++;
                    int startPos = i;

                    while (i < input.Length && char.IsLetterOrDigit(input[i]))
                    {
                        i++;
                    }

                    sb.Append(rootModel.GetVariableValue(input.Substring(startPos, i - startPos)));
                    lastPos = i;
                }

                i++;
            }

            if (lastPos < input.Length)
            {
                sb.Append(input, lastPos, input.Length - lastPos);
            }

            return(sb.ToString());
        }