public void SetPriceInfoResult(PriceInfoResult info) { if (!Dispatcher.CheckAccess()) { Dispatcher.Invoke(new SetPriceInfoResultCallback(SetPriceInfoResult), new object[] { info }); } else { if (!IsDisplayed) { return; } this.priceInfo = info; var itemParagraph = new Paragraph(); //var lines = info.ItemText.Split(NEWLINE_SEPERATOR, StringSplitOptions.RemoveEmptyEntries); //foreach(var line in lines) //{ // itemParagraph.Inlines.Add(new Run(line + "\n")); //} //textBoxItemStats.Document = new FlowDocument(itemParagraph); var priceText = Math.Round(info.Min.Value, 2) + " ~ " + Math.Round(info.Max.Value, 2) + " " + info.Currency; labelPriceRange.Content = priceText; var predictionText = Math.Round(info.ConfidenceScore, 2) + " %"; labelConfidence.Content = predictionText; var warningParagraph = new Paragraph(); warningParagraph.Inlines.Add(info.WarningMessage); textBoxWarningMessage.Document = new FlowDocument(warningParagraph); } }
public void HideWindowAndClearData() { if (!Dispatcher.CheckAccess()) { Dispatcher.Invoke(new HideWindowAndClearDataCallback(HideWindowAndClearData)); } else { priceInfo = null; textBoxItemStats.Document.Blocks.Clear(); textBoxWarningMessage.Document.Blocks.Clear(); labelConfidence.Content = ""; labelPriceRange.Content = ""; Visibility = Visibility.Hidden; } }
public static void SetPriceInfoResult(PriceInfoResult info) => _predictionView.SetPriceInfoResult(info);