public void showGhostNotification(BookQuote bq) { quote = bq; var toastDescriptor = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02); var txtNodes = toastDescriptor.GetElementsByTagName("text"); txtNodes[0].AppendChild(toastDescriptor.CreateTextNode(bq.Header)); txtNodes[1].AppendChild(toastDescriptor.CreateTextNode(bq.Content)); var toast = new ToastNotification(toastDescriptor); // add tag/group is needed Random r = new Random(); toast.Group = r.Next().ToString(); toast.Tag = r.Next().ToString() ; // Ghost toast //toast.SuppressPopup = true; toast.Activated += toast_Activated; var toastNotifier = ToastNotificationManager.CreateToastNotifier(); toastNotifier.Show(toast); }
void NewBookQuote(BookQuote quote) { if (this.InvokeRequired) { this.BeginInvoke(new NewBookQuoteHandler(NewBookQuote), new object[] { quote }); } else { rtbBookQuote.Text = BookQuoteToString(quote); } }
private string BookQuoteToString(BookQuote q) { string res = ""; try { int askCount = Math.Min(q.AskPrices.Length, q.AskPrices.Length); string askItems = ""; for (int i = 0; i < askCount; i++) { if (askItems.Length > 0) { askItems += ","; } askItems += string.Format("{0}x{1}", q.FormatValue(q.AskPrices[i], NumericFormat.Default), q.AskSizes[i]); } int bidCount = Math.Min(q.BidPrices.Length, q.BidPrices.Length); string bidItems = ""; for (int i = 0; i < bidCount; i++) { if (bidItems.Length > 0) { bidItems += ","; } bidItems += string.Format("{0}x{1}", q.FormatValue(q.BidPrices[i], NumericFormat.Default), q.BidSizes[i]); } res = string.Format("Symbol={0}\nTimestamp={1}\nAsks={2}\nBids={3}\nSource={4}\n", q.Symbol, q.Timestamp.ToString("yyyy-MM-dd HH:mm:ss"), askItems, bidItems, Encoding.ASCII.GetString(q.Source)); } catch (Exception ex) { res = "Error converting data from book quote to string: " + ex.Message; } return(res); }
public static string BookQuoteToString(BookQuote q) { var res = ""; try { var askCount = Math.Min(q.AskPrices.Length, q.AskPrices.Length); var askItems = ""; for (var i = 0; i < askCount; i++) { if (askItems.Length > 0) { askItems += ","; } askItems += $"{q.FormatValue(q.AskPrices[i], NumericFormat.Default)}x{q.AskSizes[i]}"; } var bidCount = Math.Min(q.BidPrices.Length, q.BidPrices.Length); var bidItems = ""; for (var i = 0; i < bidCount; i++) { if (bidItems.Length > 0) { bidItems += ","; } bidItems += $"{q.FormatValue(q.BidPrices[i], NumericFormat.Default)}x{q.BidSizes[i]}"; } res = $"Symbol={q.Symbol}\nTimestamp={q.Timestamp:yyyy-MM-dd HH:mm:ss}\nAsks={askItems}\nBids={bidItems}\nSource={Encoding.ASCII.GetString(q.Source)}\n"; } catch (Exception ex) { res = "Error converting data from book quote to string: " + ex.Message; } return(res); }
private void NewBookQuote(BookQuote quote) { Data.BookList.Add(quote); }
private void Button_Click(object sender, RoutedEventArgs e) { BookQuote temp = new BookQuote() { Header=NewBookName.Text ,Content=QContent.Text }; this.Frame.Navigate(typeof(MainPage),temp); }