Пример #1
0
        private static Form SetConnectionForm(Form ConForm, string connectionPanel)
        {
            Form connectionForm = default(Form);

            if (ConForm == null)
            {
                connectionForm = WindowList.FromString(connectionPanel);
            }
            else
            {
                connectionForm = ConForm;
            }

            if (connectionForm == null)
            {
                connectionForm = AddPanel(connectionPanel);
            }
            else
            {
                ((ConnectionWindow)connectionForm).Show(frmMain.Default.pnlDock);
            }

            connectionForm.Focus();
            return(connectionForm);
        }
        public void GetWindowFromStringReturnsCorrectObject()
        {
            BaseWindow window1 = new BaseWindow();

            window1.SetFormText("TheWindowWeWant");
            BaseWindow window2 = new BaseWindow();

            window2.SetFormText("WeDontWantThisWindow");
            _windowList.Add(window1);
            _windowList.Add(window2);
            Assert.That(_windowList.FromString("TheWindowWeWant"), Is.EqualTo(window1));
        }