/// <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); }
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; } }
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); } }
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(); } }
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; } }