Exemple #1
0
        public event UserDataReceived OnUserDataReceived;//数据到达事件


        public CSeriesMsg(CModel model)
        {
            this.model           = model;
            port                 = new SerialPort();
            rlist                = new ArrayList();
            port                 = new SerialPort();
            port.BaudRate        = 9600;
            port.PortName        = model.settings.Comport;
            port.DataBits        = 8;
            port.StopBits        = StopBits.One;
            port.Parity          = Parity.None;
            port.ReadBufferSize  = 512;
            port.WriteBufferSize = 512;//原来设置为30
            port.DataReceived   += new SerialDataReceivedEventHandler(DataReceived);
            if (port.IsOpen == false)
            {
                port.Open();
            }
            else
            {
                port.Close();
                System.Threading.Thread.Sleep(200);
                port.Open();
            }
        }
Exemple #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Login_Form loginfrm = new Login_Form();

            loginfrm.ShowDialog();

            switch (loginfrm.DialogResult)
            {
            case DialogResult.OK:
                Application.Run(new Menu_Form(0, loginfrm.dq_sfzhm));
                break;

            case DialogResult.Yes:
                ModuleSettings settings;
                settings = new ModuleSettings();
                settings = ModuleConfig.GetSettings();
                CModel model = new CModel(settings);
                // CController ctrl = new CController(model);
                //mainview = new main_view(this, model);
                Application.Run(new main_view(model));
                break;

            case DialogResult.No:
                Application.Run(new Menu_Form(1, loginfrm.dq_sfzhm));
                break;
            }
        }
Exemple #3
0
        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();
        }
Exemple #4
0
        public int[] fxcj;//分项成绩

        public CStudent(CModel model)
        {
            isprint = false;
            kscj    = 100;

            fxcj = new int[model.ksdevmanager.KsDevCount];
            for (int i = 0; i < fxcj.Length; i++)
            {
                fxcj[i] = -1;
            }
        }
Exemple #5
0
 public CKsDevManager(CModel model)
 {
     this.model = model;
     string[] str = model.settings.DevInfo.Split(',');
     //Array.Sort(str);
     ksdevmodels = new CKsDevModel[str.Length];
     ksdevcount  = str.Length;
     for (int i = 0; i < str.Length; i++)
     {
         string[] str1 = str[i].Split(':');
         ksdevmodels[i]            = new CKsDevModel();
         ksdevmodels[i].Ksdevorder = str1[0];
         ksdevmodels[i].Ksdevname  = str1[1];
     }
 }
Exemple #6
0
        public CPrintContent(CModel model)
        {
            this.model = model;

            ksddtxt           = new CTextPrintObjSet();
            ksddtxt.Printtext = "";
            ksddtxt.mmX       = model.settings.Ksdd_x;
            ksddtxt.mmY       = model.settings.Ksdd_y;


            ksxmtxt           = new CTextPrintObjSet();
            ksxmtxt.Printtext = "";
            ksxmtxt.mmX       = model.settings.Ksxm_x;
            ksxmtxt.mmY       = model.settings.Ksxm_y;


            kscjtxt           = new CTextPrintObjSet();
            kscjtxt.Printtext = "";
            kscjtxt.mmX       = model.settings.Kscj_x;
            kscjtxt.mmY       = model.settings.Kscj_y;


            ksrqtxt           = new CTextPrintObjSet();
            ksrqtxt.Printtext = "";
            ksrqtxt.mmX       = model.settings.Ksrq_x;
            ksrqtxt.mmY       = model.settings.Ksrq_y;


            ksyxmtxt           = new CTextPrintObjSet();
            ksyxmtxt.Printtext = "";
            ksyxmtxt.mmX       = model.settings.Ksyxm_x;
            ksyxmtxt.mmY       = model.settings.Ksyxm_y;


            printDocument1 = new System.Drawing.Printing.PrintDocument();
            this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
        }
Exemple #7
0
 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();
 }
Exemple #8
0
 public CFindAndSaveStudent(CModel model)
 {
     this.model = model;
 }