/// <summary> /// This method drives/orchestrates the desired /// functionality based on the action specified /// from the command line. /// </summary> /// <param name="parameters"></param> private static void runAsConsoleApplication(TeslaMergeConfig config) { try { Console.WriteLine("Press any key to terminate..."); MergeThread thread = new MergeThread(config); thread.RunOnce(); // This will prevent the program // from terminating, while still // allowing this primary thread to // be responsive and display console // i/o generated from the trace bool done = false; do { done = Console.KeyAvailable; Thread.Sleep(200); } while (done == false); Console.WriteLine("Stopping background worker threads..."); // Stop Threads thread.Stop(); Console.WriteLine("Finished."); } catch (Exception exception) { Console.WriteLine(exception.Message); } }
protected override void OnStart(string[] args) { _config = TeslaMergeConfig.GetConfig(); _mainThread = new MergeThread(_config); _mainThread.Start(); }
private static void execute(object obj) { MergeThread merge = (MergeThread)obj; merge.loopForTriggerFile(); }