/// <summary> /// save redis server /// </summary> private void saveRedisServer() { if (CompontentUtils.vaildInputBox(name) && CompontentUtils.vaildInputBox(host) && CompontentUtils.vaildInputBox(port) && CompontentUtils.vaildInputBox(keyPattern) && CompontentUtils.vaildInputBox(keySeparator) && CompontentUtils.vaildInputBox(connectionTimeout) && CompontentUtils.vaildInputBox(executeTimeout)) { if (isNew) { App.config.RedisConnections.Add(redisConnection); RedisUtils.addConnection(redisConnection); } else { RedisUtils.updateConnection(Server, redisConnection); } ConfigUtils.updateConfig(); this.Close(); } else { Console.WriteLine("false"); } }
/// <summary> /// test connection event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnTest_Click(object sender, RoutedEventArgs e) { if (CompontentUtils.vaildInputBox(host) && CompontentUtils.vaildInputBox(port) && CompontentUtils.vaildInputBox(connectionTimeout)) { string host = redisConnection.Host; int port = Convert.ToInt32(redisConnection.Port); int timeout = Convert.ToInt32(redisConnection.ConnectionTimeOut); testClient = new RedisClient(host, port); testClient.Connected += TestClient_Connected; ThreadStart threadStart = new ThreadStart(() => { testConnection(timeout); }); new Thread(threadStart).Start(); } }