Пример #1
0
        public static Task <bool> FuzzySearchClick(int mobileIndex, string id, int targetIndex = 0)
        {
            int taskNum = Guid.NewGuid().GetHashCode();

            var task = new SimulationTask <bool>(taskNum, TimeoutMilliseconds);

            if (SimulationTaskManager.RegisterSingle(task))
            {
                var obj = new JObject()
                {
                    { "tasktype", (int)TaskType.FuzzySearchAndClick },
                    { "txtmsg", "" },
                };

                var list = new JArray();
                list.Add($"{id}");
                list.Add($"{targetIndex}");

                obj.Add("list", list);

                SocketServer.SendTaskInstruct(mobileIndex, (int)TaskType.FuzzySearchAndClick, taskNum, obj.ToString(Newtonsoft.Json.Formatting.None));

                return(task.Task as Task <bool>);
            }

            return(Task.FromResult(false));
        }
Пример #2
0
        public static Task <bool> UpdatePictures(int mobileIndex, string[] pictures)
        {
            if (pictures == null || pictures.Length == 0)
            {
                return(Task.FromResult(false));
            }

            int taskNum = Guid.NewGuid().GetHashCode();

            var task = new SimulationTask <bool>(taskNum, TimeoutMilliseconds * 2);

            if (SimulationTaskManager.RegisterSingle(task))
            {
                var obj = new JObject()
                {
                    { "tasktype", (int)TaskType.UpdatePictures },
                    { "txtmsg", "" },
                };

                var list = new JArray();

                foreach (var picture in pictures)
                {
                    list.Add(picture);
                }

                obj.Add("list", list);

                SocketServer.SendTaskInstruct(mobileIndex, (int)TaskType.UpdatePictures, taskNum, obj.ToString(Newtonsoft.Json.Formatting.None));

                return(task.Task as Task <bool>);
            }

            return(Task.FromResult(false));
        }