private bool restartIRApp = false; // Restart Haupp. IR-app. after MP quit /// <summary> /// Initialization /// </summary> public HcwHelper() { InitializeComponent(); using (Settings xmlreader = new MPSettings()) { logVerbose = xmlreader.GetValueAsBool("remote", "HCWVerboseLog", false); port = xmlreader.GetValueAsInt("remote", "HCWHelperPort", 2110); hcwEnabled = xmlreader.GetValueAsBool("remote", "HCW", false); } connection = new Connection(logVerbose); if (hcwEnabled && (GetDllPath() != string.Empty) && connection.Start(port) && irremote.IRSetDllDirectory(GetDllPath())) { Thread checkThread = new Thread(new ThreadStart(CheckThread)); checkThread.IsBackground = true; checkThread.Priority = ThreadPriority.Highest; checkThread.Name = "HcwHelperChecker"; checkThread.Start(); connection.ReceiveEvent += new Connection.ReceiveEventHandler(OnReceive); StartIR(); } else { connection.Send(port + 1, "APP", "STOP", DateTime.Now); Application.Exit(); } }
public void SendMessage() { Connection connection = new Connection(true); Assert.IsTrue(connection.Send(udpPort, "CMD", "0", DateTime.Now)); }