Example #1
0
        public CJKYBaseMonitor(CSettings settings)
        {
            commonSettings = settings;
            SignalConfigures sigConf = settings.SignConfig;

            iorport     = sigConf.IOReaderPort;
            iowport     = sigConf.IOWritterPort;
            printerport = sigConf.PrinterPort;
            g_jifennum  = sigConf.GanJiFen;
            x_jifennum  = sigConf.XianJiFen;
            lx_jifennum = sigConf.LXianJiFen;
            if (g_jifennum < 2 || g_jifennum > 100)
            {
                g_jifennum = 2;
            }
            if (x_jifennum < 2 || x_jifennum > 100)
            {
                x_jifennum = 2;
            }
            if (lx_jifennum < 2 || lx_jifennum > 100)
            {
                lx_jifennum = 2;
            }

            max_x_jifennum = Math.Max(x_jifennum, lx_jifennum);

            signLen = new SignLength();

            signLen.GAN_LENGTH  = ganlen = sigConf.GanLength;
            signLen.XIAN_LENGTH = xianlen = sigConf.XianLength;
            signLen.CHE_LENGTH  = chelen = sigConf.CheLength;

            readIOLoopTime = sigConf.ReadIOLoopTime;

            mondata      = CreateMonDate(signLen);
            mondata_cur  = CreateMonDate(signLen);
            mondata_old  = CreateMonDate(signLen);
            g_jifenQueue = new List <CSignals>(g_jifennum);
            x_jifenQueue = new List <CSignals>(max_x_jifennum);

            adminPBGan  = sigConf.AdminPBGan;
            adminPBXian = sigConf.AdminPBXian;
            adminQFGan  = sigConf.AdminQFGan;
            adminQFXian = sigConf.AdminQFXian;
            PBChe       = sigConf.PBChe;
            PBGan       = sigConf.PBGan;
            PBXian      = sigConf.PBXian;

            ganpos  = sigConf.GanPosition;
            xianpos = sigConf.XianPosition;
            chepos  = sigConf.ChePosition;

            ApplyCommonSettings();

            mythread = new Thread(Monitor);
            regobj   = new ArrayList();
        }
Example #2
0
        private void comBoxType_SelectedIndexChanged(object sender, EventArgs e)
        {
            SettingPair setPair = _configTable[comBoxType.Text];

            _currentSetup = new CSetup(setPair);
            SignalConfigures sigConf = ((CSettings)_currentSetup.Settings).SignConfig;

            sigLen.GAN_LENGTH  = sigConf.GanLength;
            sigLen.XIAN_LENGTH = sigConf.XianLength;
            sigLen.CHE_LENGTH  = sigConf.CheLength;

            picBoxChe = new PictureBox[sigLen.CHE_LENGTH];
            this.carPane.Controls.Clear();
            for (int i = 0; i < sigLen.CHE_LENGTH; i++)
            {
                picBoxChe[i]           = new PictureBox();
                picBoxChe[i].Width     = 20;
                picBoxChe[i].Height    = 20;
                picBoxChe[i].Top       = 0;
                picBoxChe[i].BackColor = Color.DarkSeaGreen;
                picBoxChe[i].Left      = i * 50;
                this.carPane.Controls.Add(picBoxChe[i]);
            }



            picBoxGan = new PictureBox[sigLen.GAN_LENGTH];
            this.ganPane.Controls.Clear();
            for (int i = 0; i < sigLen.GAN_LENGTH; i++)
            {
                picBoxGan[i]           = new PictureBox();
                picBoxGan[i].Width     = 20;
                picBoxGan[i].Height    = 20;
                picBoxGan[i].Top       = 0;
                picBoxGan[i].BackColor = Color.DarkSeaGreen;
                picBoxGan[i].Left      = i * 50;
                picBoxGan[i].Show();

                this.ganPane.Controls.Add(picBoxGan[i]);
            }

            picBoxXian = new PictureBox[sigLen.XIAN_LENGTH];
            this.xianPane.Controls.Clear();
            for (int i = 0; i < sigLen.XIAN_LENGTH; i++)
            {
                picBoxXian[i]           = new PictureBox();
                picBoxXian[i].Width     = 20;
                picBoxXian[i].Height    = 20;
                picBoxXian[i].Top       = 0;
                picBoxXian[i].BackColor = Color.DarkSeaGreen;
                picBoxXian[i].Left      = i * 50;
                picBoxXian[i].Show();

                this.xianPane.Controls.Add(picBoxXian[i]);
            }
        }
Example #3
0
        public CSimIO(IntPtr HotKeyHandle, SignalConfigures sets)
        {
            settings = sets;
            gan_loc  = settings.GanPosition;
            xian_loc = settings.XianPosition;
            che_loc  = settings.ChePosition;

            _hkapp = new CHotkeyApp(HotKeyHandle, this);
            _hkapp.StartHotkey();
        }
Example #4
0
        private void GXQufan_Load(object sender, EventArgs e)
        {
            if (_configTable != null)
            {
                _tabTable = new Dictionary <TabItem, CSetup>();
                IDictionaryEnumerator dicEnum = _configTable.GetEnumerator();
                while (dicEnum.MoveNext())
                {
                    DictionaryEntry ent = dicEnum.Entry;

                    TabItem tab = new TabItem();
                    tab.Text   = (string)ent.Key;
                    tab.Click += new EventHandler(tab_Click);

                    SettingPair set  = (SettingPair)ent.Value;
                    CSetup      temp = new CSetup(set);

                    TabControlPanel tabControlPanel = new TabControlPanel();

                    tab.AttachedControl = tabControlPanel;

                    tabControlPanel.Dock     = System.Windows.Forms.DockStyle.Fill;
                    tabControlPanel.Location = new System.Drawing.Point(0, 26);
                    tabControlPanel.Name     = (string)ent.Key;
                    tabControlPanel.Size     = new System.Drawing.Size(464, 300);
                    tabControlPanel.TabItem  = tab;

                    GroupBox groupBoxGan = new GroupBox();
                    groupBoxGan.Location = new Point(12, 20);
                    groupBoxGan.Size     = new Size(400, 90);
                    groupBoxGan.Text     = "杆信号";
                    GroupBox groupBoxXian = new GroupBox();
                    groupBoxXian.Location = new Point(12, 125);
                    groupBoxXian.Size     = new Size(400, 90);
                    groupBoxXian.Text     = "线信号";

                    CheckBox[] gan;
                    CheckBox[] xian;

                    SignalConfigures tempSigConf = ((CSettings)temp.Settings).SignConfig;

                    gan  = new CheckBox[tempSigConf.GanLength];
                    xian = new CheckBox[tempSigConf.XianLength];

                    int tempGanVal  = 0;
                    int tempXianVal = 0;

                    switch (_type)
                    {
                    case SetupDialogType.QF:
                        this.Text   = "取反";
                        tempGanVal  = tempSigConf.AdminQFGan;
                        tempXianVal = tempSigConf.AdminQFXian;
                        break;

                    case SetupDialogType.PB:
                        this.Text   = "屏蔽";
                        tempGanVal  = tempSigConf.PBGan;
                        tempXianVal = tempSigConf.PBXian;
                        break;

                    case SetupDialogType.ADMIN_PB:
                        this.Text   = "管理员屏蔽";
                        tempGanVal  = tempSigConf.AdminPBGan;
                        tempXianVal = tempSigConf.AdminPBXian;
                        break;
                    }

                    for (int i = 0; i < gan.Length; i++)
                    {
                        gan[i] = new CheckBox();
                        groupBoxGan.Controls.Add(gan[i]);
                        gan[i].AutoSize = true;
                        gan[i].Location = new System.Drawing.Point(43 + i * 32, 38);
                        gan[i].Text     = Convert.ToString(i + 1);
                        gan[i].Size     = new System.Drawing.Size(36, 16);
                        gan[i].UseVisualStyleBackColor = true;
                        gan[i].Click += new System.EventHandler(Gan_Click);
                        if (((tempGanVal >> i) & 1) == 1)
                        {
                            gan[i].Checked = true;
                        }
                        else
                        {
                            gan[i].Checked = false;
                        }
                    }

                    for (int i = 0; i < xian.Length; i++)
                    {
                        xian[i] = new CheckBox();
                        groupBoxXian.Controls.Add(xian[i]);
                        xian[i].AutoSize = true;
                        xian[i].Location = new System.Drawing.Point(43 + i * 32, 38);
                        xian[i].Text     = Convert.ToString(i + 1);
                        xian[i].Size     = new System.Drawing.Size(36, 16);
                        xian[i].UseVisualStyleBackColor = true;
                        xian[i].Click += new System.EventHandler(Xian_Click);
                        if (((tempXianVal >> i) & 1) == 1)
                        {
                            xian[i].Checked = true;
                        }
                        else
                        {
                            xian[i].Checked = false;
                        }
                    }

                    tabControlPanel.Controls.Add(groupBoxGan);
                    tabControlPanel.Controls.Add(groupBoxXian);

                    tabCtrl.Controls.Add(tabControlPanel);

                    this.tabCtrl.Tabs.Add(tab);

                    _tabTable.Add(tab, temp);
                }

                if (this.tabCtrl.Tabs.Count > 0)
                {
                    _currentSetup   = _tabTable[this.tabCtrl.SelectedTab];
                    _currentSigConf = ((CSettings)_currentSetup.Settings).SignConfig;
                }
            }
        }
Example #5
0
 void tab_Click(object sender, EventArgs e)
 {
     _currentSetup   = _tabTable[(TabItem)sender];
     _currentSigConf = ((CSettings)_currentSetup.Settings).SignConfig;
 }