Example #1
0
        /// <summary>
        /// Runs the login test.
        /// </summary>
        public bool Login()
        {
            try
            {
                // Looks for and invoke the login button.
                AutomationElement node = GetAnchor2(true);
                ViewTree.RetrieveChildNodePatternByCondition(ref node, new Condition[] { new PropertyCondition(AutomationElement.AutomationIdProperty, "LoginButton") }, true, Pattern.Invoke);

                // Enters the email address.
                node = GetAnchor2();
                ViewTree.RetrieveChildNodePatternByCondition(ref node, new Condition[] { new PropertyCondition(AutomationElement.AutomationIdProperty, "EmailTextBox") }, true, Pattern.Value, user);

                // Enters the password.
                node = GetAnchor2();
                ViewTree.RetrieveChildNodePatternByCondition(ref node, new Condition[] { new PropertyCondition(AutomationElement.AutomationIdProperty, "PasswordBox") }, true, Pattern.Value, password);

                // Before sending login credentials to the server, we must first subscribe to the structucture changed event at the level of anchor #1.
                // When login is completed, the children of this node change and this way we detect our test is successful.
                node = GetAnchor1();
                Automation.AddStructureChangedEventHandler(node, TreeScope.Children, structureChangedEventHandler);

                // Looks for and invoke the sign in button.
                node = GetAnchor2();
                ViewTree.RetrieveChildNodePatternByCondition(ref node, new Condition[] { new PropertyCondition(AutomationElement.AutomationIdProperty, "SignInButton") }, true, Pattern.Invoke);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// In the login window, gets the parent node of main form, from which we can search controls.
        /// </summary>
        /// <param name="setFocus">Whether we must bring the login window to the foreground or not.</param>
        private AutomationElement GetAnchor2(bool setFocus = false)
        {
            AutomationElement node = GetAnchor1(setFocus);

            ViewTree.RetrieveChildNodePatternByCondition(ref node, new Condition[] { new PropertyCondition(AutomationElement.ClassNameProperty, "Windows.UI.Core.CoreWindow") });
            ViewTree.RetrieveChildNodePatternByCondition(ref node, new Condition[] { new PropertyCondition(AutomationElement.ClassNameProperty, "ScrollViewer") });
            return(node);
        }
Example #3
0
 public void    Present(VonSensorikMesung Presented)
 {
     try
     {
         ViewTree.Präsentiire(new Bib3.WertZuZaitpunktStruct <object>[] { new Bib3.WertZuZaitpunktStruct <object>(Presented, 0) });
     }
     finally
     {
         this.Presented = Presented;
     }
 }
Example #4
0
        public ActionResult GetPermissionTree(string roleId, string BeLong)
        {
            var moduledata = moduleService.GetList();

            if (!string.IsNullOrEmpty(BeLong))
            {
                moduledata = moduleService.GetList().Where(t => t.BelongSys.Equals(BeLong)).ToList();
            }
            var buttondata    = buttonService.GetButtonList();
            var authorizedata = new List <RoleAuthorize>();

            if (!string.IsNullOrEmpty(roleId))
            {
                authorizedata = roleAuthorizeService.GetList(roleId);
            }
            var treeList = new List <ViewTree>();

            foreach (var item in moduledata)
            {
                var tree        = new ViewTree();
                var hasChildren = moduledata.Count(t => t.ParentId == item.Id) == 0 ? false : true;
                tree.Id          = item.Id;
                tree.Text        = item.Name;
                tree.Value       = item.Code;
                tree.ParentId    = item.ParentId;
                tree.Isexpand    = true;
                tree.Complete    = true;
                tree.Showcheck   = true;
                tree.Checkstate  = authorizedata.Count(t => t.ItemId == item.Id);
                tree.HasChildren = true;
                tree.Img         = item.Icon == string.Empty ? string.Empty : item.Icon;
                treeList.Add(tree);
            }
            foreach (var item in buttondata)
            {
                var tree        = new ViewTree();
                var hasChildren = buttondata.Count(t => t.ParentId == item.Id) == 0 ? false : true;
                tree.Id          = item.Id;
                tree.Text        = item.Name;
                tree.Value       = item.Code;
                tree.ParentId    = item.ParentId == "0" ? item.ModuleId : item.ParentId;
                tree.Isexpand    = true;
                tree.Complete    = true;
                tree.Showcheck   = true;
                tree.Checkstate  = authorizedata.Count(t => t.ItemId == item.Id);
                tree.HasChildren = hasChildren;
                tree.Img         = item.Icon == string.Empty ? string.Empty : item.Icon;
                treeList.Add(tree);
            }
            return(Content(treeList.TreeViewJson()));
        }
Example #5
0
        /// <summary>
        /// In the login window, gets the parent's parent node of main form, from which we can search controls.
        /// </summary>
        /// <param name="setFocus">Whether we must bring the login window to the foreground or not.</param>
        private AutomationElement GetAnchor1(bool setFocus = false)
        {
            // Retrieves login window.
            AutomationElement node = AutomationElement.RootElement;

            ViewTree.RetrieveChildNodePatternByCondition(ref node, new Condition[] { new PropertyCondition(AutomationElement.NameProperty, "Wunderlist") });

            // Brings login window to the foreground when "setFocus" is true.
            if (setFocus)
            {
                ViewTree.Focus(node);
            }

            return(node);
        }
Example #6
0
        public ActionResult GetCloneButtonTreeJson()
        {
            var moduledata = ModuleApp.GetList();
            var buttondata = App.GetButtonList();
            var treeList   = new List <ViewTree>();

            foreach (var item in moduledata)
            {
                var tree        = new ViewTree();
                var hasChildren = moduledata.Count(t => t.ParentId == item.Id) == 0 ? false : true;
                tree.Id          = item.Id;
                tree.Text        = item.Name;
                tree.Value       = item.Code;
                tree.ParentId    = item.ParentId;
                tree.Isexpand    = true;
                tree.Complete    = true;
                tree.HasChildren = true;
                treeList.Add(tree);
            }
            foreach (var item in buttondata)
            {
                var tree        = new ViewTree();
                var hasChildren = buttondata.Count(t => t.ParentId == item.Id) == 0 ? false : true;
                tree.Id    = item.Id;
                tree.Text  = item.Name;
                tree.Value = item.Code;
                if (item.ParentId == "0")
                {
                    tree.ParentId = item.ModuleId;
                }
                else
                {
                    tree.ParentId = item.ParentId;
                }
                tree.Isexpand    = true;
                tree.Complete    = true;
                tree.Showcheck   = true;
                tree.HasChildren = hasChildren;
                if (item.Icon != string.Empty)
                {
                    tree.Img = item.Icon;
                }
                treeList.Add(tree);
            }
            return(Content(treeList.TreeViewJson()));
        }
Example #7
0
        public ActionResult GetTree()
        {
            var data     = App.GetAll();
            var treeList = new List <ViewTree>();

            foreach (var item in data)
            {
                var tree        = new ViewTree();
                var hasChildren = data.Count(t => t.ParentId == item.Id) != 0;
                tree.Id          = item.Id;
                tree.Text        = item.Name;
                tree.Value       = item.Code;
                tree.ParentId    = item.ParentId;
                tree.Isexpand    = true;
                tree.Complete    = true;
                tree.HasChildren = hasChildren;
                treeList.Add(tree);
            }
            return(Content(treeList.TreeViewJson()));
        }
Example #8
0
        public ActionResult GetTreeJson(string keyword)
        {
            var data       = App.GetList();
            var data_deeps = "";
            var role       = RoleApp.Get(keyword);

            if (!role.IsEmpty())
            {
                data_deeps = role.DataDeps;
            }
            else
            {
                var user = UserApp.GetById(keyword);
            }

            var treeList = new List <ViewTree>();

            foreach (var item in data)
            {
                var tree        = new ViewTree();
                var hasChildren = data.Count(t => t.ParentId == item.Id) != 0;
                tree.Id          = item.Id;
                tree.Text        = item.Name;
                tree.Value       = item.Code;
                tree.ParentId    = item.ParentId;
                tree.Isexpand    = true;
                tree.Complete    = false;
                tree.HasChildren = hasChildren;
                tree.Showcheck   = true;
                if (!data_deeps.IsEmpty() && (data_deeps.IndexOf(item.Id, StringComparison.Ordinal) != -1))
                {
                    tree.Checkstate = 1;
                }
                else
                {
                    tree.Checkstate = 0;
                }
                treeList.Add(tree);
            }
            return(Content(treeList.TreeViewJson()));
        }
Example #9
0
        /**主应用初始化**/

        public void App_Start()
        {
            //设置帧数为45帧

            Application.targetFrameRate = targetFrame;
            //Application.runInBackground = false;
            AppNet.main = this;
            netDataList = new List <INetData>();
            handlerList = new Dictionary <String, NetMsgCallback>();
            //加载配置文件(一定要去掉后缀名)
            SetLogLevel();
            if (Application.platform != RuntimePlatform.WindowsEditor &&
                Application.platform != RuntimePlatform.OSXEditor)
            {
                Log.ClearLog(); //非Editor环境不执行Log
            }
            //Log.ClearLog();
            Log.info(this, "-Start() 1、bitLen:" + AppNet.bitLen);
            Log.info(this,
                     "-Start() 2、language:" + ResMgr.instance.versionMgr.language + ", basePath:" +
                     ResMgr.instance.versionMgr.basePath);
            Log.info(this, "-Start() 3、初始化配置【OK】");

            if (!ClientUpdate.updateInit)
            {
                //加载登录UI(必须先加载MainUI空预设)
                DontDestroyOnLoad(gameObject);
                var uiRoot = (GameObject)ResMgr.instance.load(UrlConst.UI_ROOT);
                Tools.addChild(gameObject, uiRoot, -30f);
                var logo = Tools.find(gameObject, "uiroot(Clone)/viewtree/Logo");
                DestroyImmediate(logo);
            }

            ViewTree.go = Tools.find(gameObject, "uiroot(Clone)/viewtree");
            Viewport.go = Tools.find(gameObject, "uiroot(Clone)/viewport");

            GameObject battle = new GameObject();

            battle.name = "battle";
            NGUITools.AddChild(ViewTree.go, battle);

            GameObject city = new GameObject();

            city.name = "city";
            NGUITools.AddChild(ViewTree.go, city);
            ViewTree.SetSubObj();

            //添加hudview
            var hv = Tools.find(gameObject, "uiroot(Clone)/viewtree/hudview").AddComponent <HudView>();

            hv.MountPoint  = Tools.find(gameObject, "uiroot(Clone)/viewtree/hudview/mountpoint");
            HUDText.Parent = hv.MountPoint;


            if (NeedUpdated && !ClientUpdate.updateFinish)
            {
                StartCoroutine(ClientUpdate.ClientStart(gameObject, AfterUpdate, true));
            }
            else
            {
                AfterUpdate();
            }

            if (AppStart.MainAssembly == null)
            {
                AppStart.MainAssembly = Assembly.GetExecutingAssembly();
            }
            PhoneUtil.DonotSleep();
            gameObject.AddComponent <InitManager>();
        }