public main_view(CModel model) { InitializeComponent(); message = new CMyMessageFuns(); data = new byte[30]; this.model = model; ctrl = new CController(model, this); pictureBox1.ImageLocation = ".\\photonull.bmp"; string connstr = "Data Source=" + model.settings.Ipaddress + ";Initial Catalog=zhuangkao;Persist Security Info=True;User ID=sa;Password=cgcsxb";//;Pooling=true;Max Pool Size=20;"; conn = new SqlConnection(connstr); conn.Open(); view_init(); model.OnIDCardReceived += new CModel.IDCardRequest(model_OnIDCardReceived); TextInvoke = new InvokeDelegate(TextInvoke_fun); datagridinvoke = new DataGridInvokeDelegate(datagridinvokefun); string[] tmpstr = model.settings.Ksy.Split(','); for (int i = 0; i < tmpstr.Length; i++) { comboBox1.Items.Add(tmpstr[i]); } // comboBox1.Text = comboBox1.Items[0].ToString(); dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically; textBox1.Focus(); }
public CController(CModel model, main_view mainview) { this.mainview = mainview; this.model = model; senddata = new byte[30]; sendmessagefuns = new CMyMessageFuns(); sendmessagefuns.InputData(senddata); recvmessagefuns = new CMyMessageFuns(); t1 = new System.Timers.Timer(); t1.Elapsed += new ElapsedEventHandler(Timerfun); if (this.model.settings.Fspltimer == 0) { t1.Interval = 2000; } else { t1.Interval = this.model.settings.Fspltimer; } t1.AutoReset = true; //model.OnUserDataReceived += new CModel.UserDataReceived(model_OnUserDataReceived); msg = new CSeriesMsg(model); msg.OnUserDataReceived += new CSeriesMsg.UserDataReceived(msg_OnUserDataReceived); t1.Start(); }