private static void FlashWhite(WebSocket ws, RgbData rgb, int time) { for (int i = 0; i < 255; i++) { rgb.r = i; rgb.g = i; rgb.b = i; rgb.SendValues(ws); System.Threading.Thread.Sleep(time); if (i == 254) { for (int j = 255; j > 0; j--) { rgb.r = j; rgb.g = j; rgb.b = j; rgb.SendValues(ws); System.Threading.Thread.Sleep(time); } } } }
private void StartThreadAndWsConnection() { if (GeneralVm.WebSocketConnector.OpenConnection(WebSocketConnection.WebSocket)) { SetConnected(true); //Gibt in LED Controller gespeicherters Licht aus. RgbData SavedRGB = new RgbData(Settings.Default.SelectedColor.R, Settings.Default.SelectedColor.G, Settings.Default.SelectedColor.B); SavedRGB.SendValues(WebSocketConnection.WebSocket); } else { MessageBox.Show("Couldn't reach Websocket-Server. Timeout or wrong port"); SetConnected(false); } }