public string GetXPath(bool bExcludeSessionRootPath)
        {
            if (string.IsNullOrEmpty(this._strPath))
            {
                this._strPath = GenerateXPath.GenerateXPathToUiElement(this, _pathNodes, ref _uiTreeNode).Trim();
            }

            if (string.IsNullOrEmpty(this._strPath))
            {
                return(string.Empty);
            }

            string xPathRet = this._strPath;

            if (bExcludeSessionRootPath == true && string.IsNullOrEmpty(MainWindow.s_mainWin.RootSessionPath) == false)
            {
                int nPos = xPathRet.IndexOf(MainWindow.s_mainWin.RootSessionPath);
                if (nPos >= 0)
                {
                    xPathRet = "\"" + xPathRet.Substring(nPos + MainWindow.s_mainWin.RootSessionPath.Length);
                }
            }

            return(xPathRet);
        }
        public static void AddKeyboardInputTask(ref string strBase64, bool bCapsLock, bool bNumLock, bool bScrollLock)
        {
            if (string.IsNullOrEmpty(strBase64))
            {
                AppInsights.LogException("AddKeyboardInputTask", "strBase64 is null");
                return;
            }

            var keyboardTaskDescription = GenerateCSCode.GetDecodedKeyboardInput(strBase64, bCapsLock, bNumLock, bScrollLock);

            StringBuilder sb = new StringBuilder();

            foreach (var strLine in keyboardTaskDescription)
            {
                sb.Append(GenerateXPath.XmlEncode(strLine));
            }

            RecordedUiTask lastRecordedUi = null;

            lock (RecordedUiTask.s_lockRecordedUi)
            {
                if (RecordedUiTask.s_listRecordedUi.Count > 0)
                {
                    lastRecordedUi = RecordedUiTask.s_listRecordedUi.Last();
                }
            }

            if (lastRecordedUi != null && lastRecordedUi.UiTaskName == EnumUiTaskName.KeyboardInput)
            {
                lastRecordedUi.AppendKeyboardInput(strBase64);
            }
            else
            {
                var keyboarTask = new RecordedUiTask(EnumUiTaskName.KeyboardInput, strBase64, bCapsLock, bScrollLock, bNumLock);
                MainWindow.AddRecordedUi(keyboarTask);
            }

            strBase64 = null;
        }