/// <summary> /// Entry point of this console viewer program. /// </summary> public static void Main() { IQuoteDataProvider provider = GetProvider(); ConsoleViewer viewer = new ConsoleViewer(provider); provider.Subscribe(viewer); provider.StatusChanged += viewer.OnStatusChanged; provider.Start(); while (true) { Thread.Sleep(100); if (Console.KeyAvailable) { if (Console.ReadKey(true).Key == ConsoleKey.Escape) { Console.WriteLine("Manual abort.\nExiting..."); break; } } } provider.Stop(); provider.Unsubscribe(viewer); Console.Write("\nPress Enter to exit..."); Console.ReadLine(); }
private void DataViewerForm_FormClosing(object sender, FormClosingEventArgs e) { if (m_provider == null) { return; } m_provider.Stop(); m_provider.Unsubscribe(this); }