Exemple #1
0
        void AdjustStationList() //
        {
            JFStationManager mgr = JFHubCenter.Instance.StationMgr;

            string[] allStationNames = mgr.AllStationNames();
            if (null == allStationNames || 0 == allStationNames.Length)
            {
                _currStationNames = null;
                tabControlCF1.TabPages.Clear();
                toolStripMenuItemStations.DropDownItems.Clear();
                return;
            }

            if (null != _currStationNames && _currStationNames.Length == allStationNames.Length)
            {
                bool isSame = true;
                for (int i = 0; i < _currStationNames.Length; i++)
                {
                    if (_currStationNames[i] != allStationNames[i])
                    {
                        isSame = false;
                        break;
                    }
                }
                if (isSame)
                {
                    _CheckStationNamesInMenu();
                    return;
                }
            }
            _currStationNames = allStationNames;

            tabControlCF1.TabPages.Clear();
            _dctStationForms.Clear();
            foreach (string stationName in allStationNames)
            {
                TabPage tp = new TabPage(stationName);
                FormSingleStationTest fmStationTest = new FormSingleStationTest();
                fmStationTest.SetStation(mgr.GetStation(stationName));
                fmStationTest.FormBorderStyle = FormBorderStyle.None;
                fmStationTest.TopLevel        = false;
                fmStationTest.ShowInTaskbar   = false;
                fmStationTest.Dock            = DockStyle.Fill;
                fmStationTest.Parent          = tp;
                fmStationTest.Show();
                tp.Controls.Add(fmStationTest);
                tabControlCF1.TabPages.Add(tp);
                ToolStripMenuItem tsi = new ToolStripMenuItem(stationName, null, onToolStipItemStationClicked);
                toolStripMenuItemStations.DropDownItems.Add(tsi);
                _dctStationForms.Add(mgr.GetStation(stationName), fmStationTest);
            }
            _CheckStationNamesInMenu();
        }
Exemple #2
0
        private void tabControlCF1_SelectedIndexChanged(object sender, EventArgs e)
        {
            TabPage tpSel = tabControlCF1.SelectedTab;

            if (tpSel == null)
            {
                return;
            }

            foreach (TabPage tp in tabControlCF1.TabPages)
            {
                FormSingleStationTest fmStation = tp.Controls[0] as FormSingleStationTest;
                if (tp == tpSel)
                {
                    fmStation.EnableFlushStationUi = true; //;//fmStation.Visible = true;
                }
                else
                {
                    fmStation.EnableFlushStationUi = false;
                }
            }
        }