/// <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_Load(object sender, EventArgs e) { m_provider = FormsManager.UniqueInstance.GetProvider(); if (m_provider == null) { Close(); return; } m_provider.Subscribe(this); m_provider.StatusChanged += OnStatusChanged; m_provider.Start(); }