Esempio n. 1
0
        public CCtrl(CModel model)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            this.model = model;
            model.Event_RemoteSQLLink += new CModel.D_RemoteSQLLink(model_Event_ORACLELink);

            Server = new CNetServer();
            Server.Event_Devlogin   += new CNetServer.D_DEVLOGIN(Server_Event_Devlogin);
            Server.Event_Devlogout  += new CNetServer.D_DEVLOGOUT(Server_Event_Devlogout);
            Server.Event_Devnetdata += new CNetServer.D_DEVNETDATA(Server_Event_Devnetdata);
            settings = ModuleConfig.GetSettings();
            //displaycomm = new CDisplaycomm(settings);
            //displaycomm.ShowText("欢迎来到大成驾校考试!");
            mainform = new Main_Form(this, this.model);
            Application.Run(mainform);
            // model.RemoteDBlink();
        }
Esempio n. 2
0
        public static ModuleSettings GetSettings()
        {
            ModuleSettings data       = null;
            XmlSerializer  serializer = new XmlSerializer(typeof(ModuleSettings));

            try
            {
                string     fileName = "zk.config";
                FileStream fs       = new FileStream(fileName, FileMode.Open);
                data = (ModuleSettings)serializer.Deserialize(fs);
                fs.Close();
            }
            catch (Exception ex)
            {
                data = new ModuleSettings();
            }


            return(data);
        }
Esempio n. 3
0
 public CDisplaycomm(ModuleSettings settings)
 {
     this.settings      = settings;
     port               = new SerialPort();
     port.BaudRate      = 4800;
     port.PortName      = settings.Comport;
     port.DataBits      = 8;
     port.StopBits      = StopBits.One;
     port.Parity        = Parity.None;
     port.DataReceived += new SerialDataReceivedEventHandler(DataReceived);
     _setdisplaytype    = settings.DisplayType;
     try
     {
         if (settings.HasDisplay)
         {
             port.Open();
         }
     }
     catch
     {
         System.Windows.Forms.MessageBox.Show("无法打开串口" + settings.Comport + "!");
     }
 }