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