public static void Main(string[] args) { engine = new MinerHost(); engine.Start(); global::System.Console.WriteLine(); global::System.Console.WriteLine(); global::System.Console.WriteLine(); global::System.Console.WriteLine(); // render hash statistics var timer = new Timer(TimerCallback, null, 0, 250); // wait for input from user to terminate global::System.Console.ReadLine(); timer.Dispose(); engine.Stop(); global::System.Console.WriteLine("Total Hashes: {0}", engine.HashCount); global::System.Console.ReadLine(); }
/// <summary> /// Invoked when the application starts. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void Application_Startup(object sender, StartupEventArgs args) { // read command arguments showWindow = !args.Args.Any(i => i == "/hidden"); idle = !args.Args.Any(i => i == "/run"); // miner engine Engine = new MinerHost(); // if not hidden, show monitor window if (showWindow) { var window = new MinerWindow(); window.DataContext = view = new MinerWindowViewModel() { Engine = Engine }; window.Show(); } // ticks periodically timer = new DispatcherTimer(DispatcherPriority.Normal); timer.Interval = TimeSpan.FromSeconds(1); timer.Tick += timer_Tick; timer.Start(); }