private static System.Timers.Timer PortDemonTimer;//狗日的辣鸡pi有的时候会把ttyUSB0突然变成ttyUSB1 static void Main(string[] args) { Utils.ConfigManager configManager = Utils.ConfigManager.GetInstance(); config = configManager.Config; Console.WriteLine("PortName: " + config.PortName); if (args != null && args.Length >= 2 && args[0].Equals("-ip")) { XingKongScreen.IsRemote = true; XingKongScreen.RemoteIp = args[1]; } else if (!string.IsNullOrWhiteSpace(config.BackupPortName) && XingKongScreen.IsRunningOnMono()) { Console.WriteLine("BackupPortName: " + config.BackupPortName); PortDemonTimer = new System.Timers.Timer(); PortDemonTimer.Elapsed += PortDemonTimer_Elapsed; PortDemonTimer.Interval = 1000 * 30;//30秒检查一次 PortDemonTimer.Enabled = true; } XingKongScreen.OpenScreen(config.PortName); XingKongScreen.SetColor(); XingKongScreen.ClearScreen(); SystemUI = LoadAppAsync("SystemUI"); if (args != null && args.Length >= 1 && args[0].Equals("-bg")) { //让程序在linux下在后台执行不退出 //需要输入下列命令来启动本程序 //nohup mono AppLoader.exe -bg & Thread.CurrentThread.Suspend(); } else { Console.Write("> "); string input = Console.ReadLine(); while (!input.Equals("exit")) { Console.Write("> "); input = Console.ReadLine(); } } XingKongScreen.CloseScreen(); }
protected void LocalShow() { if (Program.Args != null && Program.Args.Length >= 2 && Program.Args[0].Equals("-ip")) { XingKongScreen.IsRemote = true; XingKongScreen.RemoteIp = Program.Args[1]; } XingKongScreen.OpenScreen(PortName); XingKongScreen.ClearScreen(); XingKongWindow window = GetXingKongWindow(); window.Draw(); XingKongScreen.FreshScreen(); XingKongScreen.CloseScreen(); }