示例#1
0
        //载入列表
        private void LoadList()
        {
            RegistryKey key;
            int         TotalCount;

            key = Registry.CurrentUser.OpenSubKey("Software\\SiemensSimulator\\", true);
            if (key == null)
            {
                return;
            }
            TotalCount = Convert.ToInt32(key.GetValue("Count", 0));
            //清理之前所有行
            foreach (DataGridViewRow i in Dgv_Sum.Rows)
            {
                DeleteRow(i.Index);
            }
            for (int i = 0; i < TotalCount; i++)
            {
                NewIndex = Dgv_Sum.Rows.Add();
                //GlobalValue.connectvalue[NewIndex].LoadSettingFromReg(NewIndex);
                Dgv_Sum.Rows[NewIndex].Cells["Instrument"].Value = GlobalValue.connectvalue[NewIndex].FormName;
                GlobalValue.connectvalue[NewIndex].IsHiden       = true;
                //自动开始
                if (GlobalValue.connectvalue[NewIndex].FormEnable == true)
                {
                    TranslateUnit instr = new TranslateUnit(NewIndex);
                    instr.Show();
                    GlobalValue.connectvalue[NewIndex].IsHiden = false;
                    instr.LoadSetting(NewIndex);
                    StartStop(NewIndex);
                }
            }
            key.Close();
        }
示例#2
0
        private void B_Add_Click(object sender, EventArgs e)
        {
            NewIndex = Dgv_Sum.Rows.Add();
            FormName MainForm = new FormName(NewIndex, Dgv_Sum);

            MainForm.ShowDialog();
            if (GlobalValue.connectvalue[NewIndex].FormName != "" && GlobalValue.connectvalue[NewIndex].FormName != null)
            {
                Dgv_Sum.Rows[NewIndex].Cells["Instrument"].Value = GlobalValue.connectvalue[NewIndex].FormName;
                TranslateUnit instr = new TranslateUnit(NewIndex);
                GlobalValue.connectvalue[NewIndex].IsHiden = false;
                GlobalValue.connectvalue[NewIndex].ConParm.InitValue();
                instr.Show();
            }
            else
            {
                Dgv_Sum.Rows.Remove(Dgv_Sum.Rows[NewIndex]);
            }
            Add();

            if (EnableReg == true)
            {
                UpdateReg(Dgv_Sum.RowCount);
            }
        }
示例#3
0
        public void Add()
        {
            NewIndex = Dgv_Sum.Rows.Add();
            FormName MainForm = new FormName(NewIndex, Dgv_Sum);

            MainForm.ShowDialog();
            if (GlobalValue.connectvalue[NewIndex].FormName != "" && GlobalValue.connectvalue[NewIndex].FormName != null)
            {
                Dgv_Sum.Rows[NewIndex].Cells["Instrument"].Value = GlobalValue.connectvalue[NewIndex].FormName;
                TranslateUnit instr = new TranslateUnit(NewIndex);
                GlobalValue.connectvalue[NewIndex].IsHiden = false;
                GlobalValue.connectvalue[NewIndex].ConParm.InitValue();
                instr.Show();
            }
            else
            {
                Dgv_Sum.Rows.Remove(Dgv_Sum.Rows[NewIndex]);
            }
        }
示例#4
0
 private void ShowHiden(int index)
 {
     if (GlobalValue.connectvalue[index].InstrForm == null)
     {
         TranslateUnit instr = new TranslateUnit(index);
         instr.Show();
         instr.LoadSetting(index);
         return;
     }
     if (GlobalValue.connectvalue[index].IsHiden == true)
     {
         GlobalValue.connectvalue[index].InstrForm.Show();
         GlobalValue.connectvalue[index].IsHiden    = false;
         GlobalValue.connectvalue[index].FormEnable = true;
     }
     else
     {
         GlobalValue.connectvalue[index].InstrForm.Hide();
         GlobalValue.connectvalue[index].IsHiden = true;
     }
 }