private Windows.UI.Xaml.Documents.Paragraph LoadText(string value) { var result = new Windows.UI.Xaml.Documents.Paragraph(); if (value.Contains("$")) { var strs = value.Split('$'); foreach (var item in strs) { var image = Class.Model.FaceIcon.GetFaceImage(item); if (image != null) { var uiconter = new Windows.UI.Xaml.Documents.InlineUIContainer(); uiconter.Child = image; } else { result.Inlines.Add(new Windows.UI.Xaml.Documents.Run() { Text = item }); } } } else { result.Inlines.Add(new Windows.UI.Xaml.Documents.Run() { Text = value }); } return(result); }
public NormalCommentView() { this.InitializeComponent(); this.commentStackPanel = CommentStackPanel; this.usrTextBox = UsrNameBox; this.commentbox = CommentContentBox; this.usrImg = UsrImgBox; this.commentParagraph = CommentParagraph; this.rootStackPanel = RootStackPanel; }
public RefCommentView() { this.InitializeComponent(); this.commentContentBox = this.ContentBox; this.rootBorder = RootBorder; this.usrNameBox = UsrNameBox; this.underLine = UnderLine; this.commentParagraph = CommentParagraph; this.rootStackPanel = RootStackPanel; this.refbutton = RefButton; }
async private void HodClient_requestCompletedWithContent(string response) { await messageDispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { jobID = ""; outputText.Blocks.Clear(); var resp = parser.ParseSpeechRegconitionResponse(ref response); String text = ""; if (resp != null) { foreach (SpeechRecognitionResponse.Document doc in resp.document) { text += doc.content + "\n"; text += "Offset: " + doc.offset.ToString() + "\n"; } } else { var errors = parser.GetLastError(); foreach (HODErrorObject err in errors) { if (err.error == HODErrorCode.QUEUED) { jobID = err.jobID; text = "In queue. Try again in 2 secs"; timer.Interval = TimeSpan.FromSeconds(2); timer.Start(); break; } else if (err.error == HODErrorCode.IN_PROGRESS) { jobID = err.jobID; count += 20; text = "In progress. Try again in 20 secs. Total waiting time: " + count.ToString(); timer.Interval = TimeSpan.FromSeconds(20); timer.Start(); break; } else if (err.error == HODErrorCode.NONSTANDARD_RESPONSE) { // The response is a non-standard response. Define a custom class and use the ParseCustomResponse<T>() function break; } else { text += "Error code: " + err.error.ToString() + "\n"; text += "Error reason: " + err.reason + "\n"; text += "Error detail: " + err.detail + "\n"; text += "job ID: " + err.jobID + "\n"; } } } var p = new Windows.UI.Xaml.Documents.Paragraph(); p.Inlines.Add(new Windows.UI.Xaml.Documents.Run { Foreground = new SolidColorBrush(Colors.Green), Text = text }); outputText.Blocks.Add(p); }); }
async private void HodClient_onErrorOccurred(string errorMessage) { await messageDispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { outputText.Blocks.Clear(); var p = new Windows.UI.Xaml.Documents.Paragraph(); p.Inlines.Add(new Windows.UI.Xaml.Documents.Run { Foreground = new SolidColorBrush(Colors.Green), Text = errorMessage }); outputText.Blocks.Add(p); }); }