private void GetRandomUsers(object obj)
        {
            Task.Run(async() => {
                this.LoadingMessageHUD = "Performing download...";
                this.IsLoadingHUD      = true;

                var result = await WebBll.GetRandomUsers();

                this.IsLoadingHUD = false;
                if (result.Error == null)
                {
                    RandomUsers = result.Response.ToObservable();
                }
                else
                {
                    Device.BeginInvokeOnMainThread(() => {
                        DialogPrompt.ShowMessage(new Prompt()
                        {
                            Title   = "Error",
                            Message = result.Error.Message
                        });
                    });
                }
            });
        }
        public void GetPaginatedRandomUsers(object obj)
        {
            Task.Run(async() =>
            {
                this.LoadingMessageHUD = "Performing download...";
                this.IsLoadingHUD      = true;

                var result = await WebBll.GetPaginatedRandomUsers(pageIndex);
                pageIndex++;

                this.IsLoadingHUD = false;
                if (result.Error == null)
                {
                    using (var updated = PaginatedRandomUsers.BeginMassUpdate())
                    {
                        PaginatedRandomUsers.AddRange(result.Response);
                    }
                }
                else
                {
                    Device.BeginInvokeOnMainThread(() => {
                        DialogPrompt.ShowMessage(new Prompt()
                        {
                            Title   = "Error",
                            Message = result.Error.Message
                        });
                    });
                }
            });
        }
 private void HttpPostMethod(object obj)
 {
     Task.Run(async() => {
         var result = await WebBll.PostDataExample();
         if (result.Error == null)
         {
             var pp = result.Response;
             DialogPrompt.ShowMessage(new Prompt()
             {
                 Title   = "Success",
                 Message = $"The person's new id for {pp.FirstName} {pp.LastName}  is {pp.Id}"
             });
         }
         else
         {
             Device.BeginInvokeOnMainThread(() => {
                 DialogPrompt.ShowMessage(new Prompt()
                 {
                     Title   = "Error",
                     Message = result.Error.Message
                 });
             });
         }
     });
 }
 private void LongDownloadMethod(object obj)
 {
     WebBll.GetLongDownload((percent) =>
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             ProgressIndicator.ShowProgress("Downloading...", percent);
         });
     }, (error) =>
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             ProgressIndicator.Dismiss();
             this.DialogPrompt.ShowMessage(new Prompt()
             {
                 Title   = "Error",
                 Message = error.Message
             });
         });
     }).ContinueWith((data) => {
         Device.BeginInvokeOnMainThread(() =>
         {
             ProgressIndicator.Dismiss();
             var file = data;
         });
     });
 }
Esempio n. 5
0
        /// <summary>
        /// 监视jira任务
        /// </summary>
        private void WartchTask()
        {
            string taskUrl = sys.Default.JiraUrl + this.taskPrefix + sys.Default.PrefixSep + this.taskNo;
            //访问页面得到系统中的任务统一编号

            WebBll web  = new WebBll(taskUrl);
            string html = web.Browser();

            //jira系统中得到任务的统一编号
            string xpath        = @"//input[@name='id']";
            string taskUid      = web.HtmlInputValue(html, xpath);
            string watchAjaxUrl = Template.JiraWatchUrl(taskUid);
            bool   success      = web.Watch(watchAjaxUrl);
        }
Esempio n. 6
0
        private static void TestWeb()
        {
            //string taskUrl = @"http://jira.abic.com/browse/ABLREQUEST-2150";
            //WebBll web = new WebBll(taskUrl);
            //string html = web.Browser();
            ////string xpath = @"/html[1]/body[1]/div[4]/div[1]/div[1]/div[1]/div[6]/div[1]/form[1]";
            ////string xpath = @"//form[@id='add_comment']";
            //string xpath = @"//input[@name='id']";
            //string taskUid = web.HtmlInputValue(html, xpath);
            string watchAjaxUrl = "http://jira.abic.com/rest/api/1.0/issues/210970/watchers";//@"http://jira.abic.com/rest/api/1.0/issues/" + taskUid + @"/watchers";

            WebBll web = new WebBll(watchAjaxUrl);
            //bool sucess = web.Watch(watchAjaxUrl);
            bool sucess = web.UnWatch(watchAjaxUrl);
        }