/// <summary>
        /// Constructor
        /// </summary>
        public RedisBrowserForm(MainForm parent)
        {
            InitializeComponent();

            // Initialize Variables
            clientList = new List <RedisClientInfo>();

            // Mdi
            this.MdiParent = parent;
            this.parent    = parent;

            // Add global settings handler
            GlobalSettings.Instance.SettingsChanged +=
                (Object o, GlobalSettings.SettingsChangedEventArgs e) => HandleSettingsChanges(e);

            // Initialize Form Updating
            serverPing     = new Ping();
            timer          = new Timer();
            timer.Interval = GlobalSettings.Instance.PingInterval;
            timer.Tick    += (Object o, EventArgs e) => UpdatePingDelay();

            // Initialize States
            stateManager = new WizardStateManager();
            stateManager.AddState(wsConnect);
            stateManager.AddState(wsConnected);
            stateManager.AddState(wsLoading);
            stateManager.SetCurrentState("wsConnect");

            // Keys List
            if (Environment.OSVersion.Platform == PlatformID.Win32NT &&
                (Environment.OSVersion.Version >= new Version(6, 1)))
            {
                olvKeys.SetNativeBackgroundWatermark(Properties.Resources.KeyListBG);
                olvKeys.GridLines = true;
            }
            olvcKey.ImageGetter = (Object row) =>
            {
                RedisTopLevelEntity en = (RedisTopLevelEntity)row;
                return((int)en.Type);
            };
            olvcTTL.AspectToStringConverter = delegate(Object o)
            {
                DateTime en = (DateTime)o;
                if (en == null || en < DateTime.Now)
                {
                    return("N/A");
                }
                else
                {
                    return(en.ToString());
                }
            };

            // CLient List
            AspectToStringConverterDelegate clientValConv = new AspectToStringConverterDelegate((Object o) =>
            {
                Int32 i = (Int32)o;
                if (i >= 0)
                {
                    return(i.ToString());
                }
                else
                {
                    return("N/A");
                }
            });

            olvcAge.AspectToStringConverter        = clientValConv;
            olvcDb.AspectToStringConverter         = clientValConv;
            olvcFileHandle.AspectToStringConverter = clientValConv;
            olvcIdle.AspectToStringConverter       = clientValConv;
            olvcMulti.AspectToStringConverter      = clientValConv;
            olvcObl.AspectToStringConverter        = clientValConv;
            olvcOll.AspectToStringConverter        = clientValConv;
            olvcOmem.AspectToStringConverter       = clientValConv;
            olvcPSub.AspectToStringConverter       = clientValConv;
            olvcQbuf.AspectToStringConverter       = clientValConv;
            olvcQbufF.AspectToStringConverter      = clientValConv;
            olvcSub.AspectToStringConverter        = clientValConv;

            // event handlers
            this.FormClosing += (Object o, FormClosingEventArgs e) => { if (timer.Enabled)
                                                                        {
                                                                            timer.Stop();
                                                                        }
                                                                        if (redisClient != null)
                                                                        {
                                                                            redisClient.Dispose();
                                                                        }
            };

            wsLoading.OnActivated   += (Object s, EventArgs e) => { loadingIndicator1.Enabled = true; };
            wsLoading.OnDeactivated += (Object s, EventArgs e) => { loadingIndicator1.Enabled = false; };
        }