Beispiel #1
0
        public MainForm()
        {
            InitializeComponent();
            var options = new ConfigurationOptions
            {
                ConnectTimeout = 5000,
                SyncTimeout = 2000,
                KeepAlive = 60,
                EndPoints =
                {
                    {Settings.Default.RedisHost, Settings.Default.RedisPort}
                }
            };

            _redis = ConnectionMultiplexer.Connect(options);
            var retries = 0;
            while (!_redis.IsConnected)
            {
                var config = _redis.Configuration;
                _redis.Dispose();
                if (retries > 10)
                {
                    MessageBox.Show(string.Format("Could not connect to the Redis server with configuration: {0}",
                        config));
                    Application.Exit();
                }

                _redis = ConnectionMultiplexer.Connect(options, Console.Out);
                retries++;

            }
            _red = new LightControlSet(button_RedOn, button_RedOff, button_RedFlash, textBox_RedOnDuty, textBox_RedOffDuty, textBox_RedOffset, textBox_RedPower, button_RedApply);
            _green = new LightControlSet(button_GreenOn, button_GreenOff, button_GreenFlash, textBox_GreenOnDuty, textBox_GreenOffDuty, textBox_GreenOffset, textBox_GreenPower, button_GreenApply);
            _blueYellow = new LightControlSet(button_BlueOn, button_BlueOff, button_BlueFlash, textBox_BlueOnDuty, textBox_BlueOffDuty, textBox_BlueOffset, textBox_BluePower, button_BlueApply);
        }
Beispiel #2
0
 public void ClearData()
 {
     //var ep = _connection.GetEndPoints();
     //await _connection.GetServer( "localhost:6379, allowAdmin=true").FlushDatabaseAsync().ConfigureAwait(false);
     _connection.Dispose();
 }