示例#1
0
 /// <summary>
 /// If a form with connection to the same address already exisis,
 /// that form will be focused and the method will return true;
 /// otherwise returns false
 /// </summary>
 /// <param name="rbf"></param>
 /// <returns></returns>
 public Boolean TryActivateDuplicate(RedisBrowserForm rbf)
 {
     if (mdiChildren.ContainsKey(rbf.ServerAddress))
     {
         mdiChildren[rbf.ServerAddress].Activate();
         return(true);
     }
     return(false);
 }
示例#2
0
 public void OnChildClosed(Object o, EventArgs e)
 {
     if (o is RedisBrowserForm)
     {
         RedisBrowserForm rbf = (RedisBrowserForm)o;
         mdiChildren.Remove(rbf.ServerAddress);
         // Hide server options
         mms_ssrv_bgsave.Visible   = mms_ssrv_dropall.Visible = mms_ssrv_dropdb.Visible =
             mms_ssrv_save.Visible = mms_ssrv_shutdown.Visible = mms_srv_sep1.Visible = false;
     }
 }
示例#3
0
        public void OnChildConnected(Object o, EventArgs e)
        {
            if (o is RedisBrowserForm)
            {
                RedisBrowserForm rbf = (RedisBrowserForm)o;

                mdiChildren.Remove(NOT_CONNECTED_SRV);
                mdiChildren.Add(rbf.ServerAddress, rbf);

                OnChildActivated(rbf, null);
            }
        }
示例#4
0
        public void AddMdiChild()
        {
            if (mdiChildren.ContainsKey(NOT_CONNECTED_SRV))
            {
                mdiChildren[NOT_CONNECTED_SRV].Activate();
            }
            else
            {
                RedisBrowserForm rbf = new RedisBrowserForm(this);
                mdiChildren.Add(NOT_CONNECTED_SRV, rbf);

                rbf.Connected  += OnChildConnected;
                rbf.FormClosed += OnChildClosed;

                rbf.Show();
            }
        }
示例#5
0
        public void OnChildActivated(Object o, EventArgs e)
        {
            Form mdic = this.ActiveMdiChild;

            if (mdic is RedisBrowserForm)
            {   // Redis browser form
                RedisBrowserForm rbf = (RedisBrowserForm)mdic;

                // Show server options
                mms_ssrv_bgsave.Visible   = mms_ssrv_dropall.Visible = mms_ssrv_dropdb.Visible =
                    mms_ssrv_save.Visible = mms_ssrv_shutdown.Visible = mms_srv_sep1.Visible = rbf.IsConnected;
            }
            else
            {
                // Hide server options
                mms_ssrv_bgsave.Visible   = mms_ssrv_dropall.Visible = mms_ssrv_dropdb.Visible =
                    mms_ssrv_save.Visible = mms_ssrv_shutdown.Visible = mms_srv_sep1.Visible = false;
            }
        }