Exemple #1
0
        protected override async void OnAppearing()
        {
            Url = "http://192.168.1.111:8081/etm_log/api/project/log/" + posts.LogId + "/remark";
            String content = await _client.GetStringAsync(Url);                              //Sends a GET request to the specified Uri and returns the response body as a string in an asynchronous operation

            CommentPost commentPosts = JsonConvert.DeserializeObject <CommentPost>(content); //Deserializes or converts JSON String into a collection of Post

            Comment.Clear();
            Attachment.Clear();
            CommentDetail.Clear();
            AttachmentDetail.Clear();
            for (int i = 0; i < commentPosts.returnValue.Count; i++)
            {
                Comment.Add(new TextCell
                {
                    Text   = commentPosts.returnValue[i].title,
                    Detail = commentPosts.returnValue[i].remark
                });
                CommentDetail.Add(new TextCell
                {
                    Text   = commentPosts.returnValue[i].title,
                    Detail = commentPosts.returnValue[i].remark
                });
            }
            ;
            CommentSwitch            = new SwitchCell();
            CommentSwitch.OnChanged += addComment_Clicked;
            CommentSwitch.Text       = "Add Comment";
            Comment.Add(CommentSwitch);
            CommentSwitchDetail            = new SwitchCell();
            CommentSwitchDetail.OnChanged += addComment_Clicked;
            CommentSwitchDetail.Text       = "Add Comment";
            CommentDetail.Add(CommentSwitchDetail);

            AttachmentSwitch            = new SwitchCell();
            AttachmentSwitch.OnChanged += attachmentManagement_Clicked;
            AttachmentSwitch.Text       = "Attachment Download";
            Attachment.Add(AttachmentSwitch);
            AttachmentSwitchDetail            = new SwitchCell();
            AttachmentSwitchDetail.OnChanged += attachmentManagement_Clicked;
            AttachmentSwitchDetail.Text       = "Attachment Download";
            AttachmentDetail.Add(AttachmentSwitchDetail);

            _LogNo.Text = posts.LogId;
            LogNo.Text  = posts.LogId;

            _LogTitle.Text = posts.Title;
            LogTitle.Text  = posts.Title;

            _Priority.Text = posts.codePriority;
            Priority.Text  = posts.codePriority;

            _AssignTo.Text = posts.codeUserAction;
            AssignTo.Text  = posts.codeUserAction;

            _Status.Text = posts.Status;
            Status.Text  = posts.Status;

            ParentLog.Text      = posts.parentIdLog;
            Organization.Text   = posts.codeOrg;
            Project.Text        = posts.codeProject;
            Ver.Text            = posts.versionNo;
            FunctionCode.Text   = posts.codeFunc;
            IssuedBy.Text       = posts.codeUserIssued;
            IssuedDate.Text     = posts.issueDate;
            LogType.Text        = posts.codeLogType;
            LogEnvironment.Text = posts.codeEnvironment;
            IncidentType.Text   = posts.codeIncidentType;
            UserRef.Text        = posts.userLogRef;

            base.OnAppearing();
        }