public ClientSessionStateProgress(IContexts contexts)
        {
            _contexts = contexts as Contexts;

            UiCommon.InitUI(UiRootName);

            _assetManager = _contexts.session.commonSession.AssetManager;

            _assetManager.LoadAssetAsync(GetType().ToString(), new AssetInfo(LoadingUiBundleName, LoadingUiAssetName), OnLoadSucc);
        }
Example #2
0
        private void UiElement_OnSelected(UiElement uiElement)
        {
            // Get the window title to identify the element from Name/AutomationId
            string title = UIAutomationCommon.GetRootWindowTitle(UiCommon.GetForegroundWindow());

            setPropertyValue("WindowTitle", new InArgument <string>(title));

            var screenshotsPath = uiElement.CaptureInformativeScreenshotToFile();

            setPropertyValue("SourceImgPath", screenshotsPath);
            setPropertyValue("AutomationId", new InArgument <string>(uiElement.AutomationId));
            setPropertyValue("Name", new InArgument <string>(uiElement.Name));
            setPropertyValue("Selector", new InArgument <string>(uiElement.Selector));
            grid1.Visibility = System.Windows.Visibility.Hidden;
            setPropertyValue("visibility", System.Windows.Visibility.Visible);
            InArgument <Int32> _offsetX = uiElement.GetClickablePoint().X;
            InArgument <Int32> _offsetY = uiElement.GetClickablePoint().Y;

            setPropertyValue("offsetX", _offsetX);
            setPropertyValue("offsetY", _offsetY);
            string displayName = getPropertyValue("_DisplayName") + " \"" + uiElement.ProcessName + " " + uiElement.Name + "\"";

            setPropertyValue("DisplayName", displayName);
            InArgument <Int32> _Left = uiElement.BoundingRectangle.Left;

            setPropertyValue("Left", _Left);
            InArgument <Int32> _Right = uiElement.BoundingRectangle.Right;

            setPropertyValue("Right", _Right);
            InArgument <Int32> _Top = uiElement.BoundingRectangle.Top;

            setPropertyValue("Top", _Top);
            InArgument <Int32> _Bottom = uiElement.BoundingRectangle.Bottom;

            setPropertyValue("Bottom", _Bottom);
        }
Example #3
0
        private void UiElement_OnSelected(UiElement uiElement)
        {
            // Get the window title to identify the element from Name/AutomationId
            string title = UIAutomationCommon.GetRootWindowTitle(UiCommon.GetForegroundWindow());

            setPropertyValue("WindowTitle", new InArgument <string>(title));

            var screenshotsPath = uiElement.CaptureInformativeScreenshotToFile();

            navigateTextBlock.Visibility = System.Windows.Visibility.Hidden;
            setPropertyValue("SourceImgPath", screenshotsPath);
            setPropertyValue("AutomationId", new InArgument <string>(uiElement.AutomationId));
            setPropertyValue("Name", new InArgument <string>(uiElement.Name));
            setPropertyValue("Selector", new InArgument <string>(uiElement.Selector));
            setPropertyValue("visibility", System.Windows.Visibility.Visible);
            InArgument <Int32> _offsetX = uiElement.GetClickablePoint().X;
            InArgument <Int32> _offsetY = uiElement.GetClickablePoint().Y;

            setPropertyValue("offsetX", _offsetX);
            setPropertyValue("offsetY", _offsetY);
            string displayName = getPropertyValue("DisplayName") + " \"" + uiElement.ProcessName + " " + uiElement.Name + "\"";

            setPropertyValue("DisplayName", displayName);
        }
        public bool ValidateNoiDung()
        {
            SaveNewCauHoiTemp(IdCauHoiCurent);
            #region Kiem tra rong

            var isEmpty = txtCtrlNoiDungCauHoi.IsEmpty;

            // Nếu nội dung rỗng và không có câu hỏi cha thì thông báo
            // Ngược lại khác rỗng hoặc rỗng nhưng có câu hỏi cha thì cho phép
            if (isEmpty)
            {
                UICommon.ShowMsgWarningString("Bạn hãy nhập nội dung câu hỏi");
                return(false);
            }

            //reset IsEmpty
            isEmpty = false;

            if (ListCauHoi == null || ListCauHoi.Count == 0)
            {
                UICommon.ShowMsgWarningString("Bạn chưa tạo vị trí điền khuyết");
                return(false);
            }

            //kiem tra đáp án gay nhiễu
            foreach (var item in ListCauHoi)
            {
                //Noi dung cau hoi khong nhap cho cau hoi dang nay
                //Do kho
                if (!item.DoKho.HasValue)
                {
                    UICommon.ShowMsgWarningString("Bạn chưa chọn độ khó cho câu hỏi.");
                    return(false);
                }
                //noi dung cau tra loi
                if (item.ListCauTraLoi.Count < 2)
                {
                    UICommon.ShowMsgWarningString("Tồn tại câu hỏi chưa có câu trả lời gây nhiễu");
                    return(false);
                }
                foreach (var cauTl in item.ListCauTraLoi)
                {
                    if (string.IsNullOrEmpty(UiCommon.ConvertRftToText(cauTl.NoiDung)))
                    {
                        UICommon.ShowMsgWarningString("Tồn tại câu trả lời gây nhiễu bạn chưa nhập nội dung.");
                        return(false);
                    }
                }
            }

            //Kiem tra hop le
            _mathCollection = _parsing.ParseDienKhuyet2(txtCtrlNoiDungCauHoi.Text);
            string        noiDungCauHoi = txtCtrlNoiDungCauHoi.Text;
            List <string> lstString     = new List <string>();
            if (_mathCollection != null)
            {
                if (ListCauHoi.Count != _mathCollection.Count)
                {
                    UICommon.ShowMsgWarningString("Vị trí điền khuyết không khớp với số câu hỏi");
                    return(false);
                }
            }
            else
            {
                UICommon.ShowMsgWarningString("Không có vị trí điền khuyết");
                return(false);
            }

            #endregion

            return(true);
        }