示例#1
0
        public FrmMain()
        {
            InitializeComponent();
            
            XmlConfigurator.Configure();
            // Define the border style of the form to a dialog box.
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            // Set the MaximizeBox to false to remove the maximize box.
            this.MaximizeBox = false;
            // Set the MinimizeBox to false to remove the minimize box.
            this.MinimizeBox = false;
            // Set the start position of the form to the center of the screen.
            this.StartPosition = FormStartPosition.CenterScreen;
            // Display the form as a modal dialog box.
           // this.ShowDialog();


            clientMsgProcess = new ClientMsgProcess();
            serverMsgProcess = new ServerMsgProcess();

            int status = myGlobals.dbManager.CreateAllTable(ServerHost2.Text, "psx", "psx", "psx");

            if (status == -1)
            {
                MessageBox.Show("网络连接失败");
                System.Environment.Exit(0);
                //return;
            }

            myGlobals.pocTypes.Add("MOBILE");
            myGlobals.pocTypes.Add("UNICOM");
            myGlobals.pocTypes.Add("TELECOM");
            
            myGlobals.pocReceiveDeal.publishMessage += new PocReceiveDeal.onPublishMessage(pubAliyunMessage);
            myGlobals.pocReceiveDeal.sendMsgToClient += new PocReceiveDeal.onSendMsgToClient(sendMsgToClient);
            myGlobals.pocReceiveDeal.sendMsgToServer += new PocReceiveDeal.onSendMsgToServer(sendMsgToServer);

            clientMsgProcess.sendMsgToClient += new ClientMsgProcess.onSendMsgToClient(sendMsgToClient2);
            clientMsgProcess.sendMsgToServer += new ClientMsgProcess.onSendMsgToServer(sendMsgToServer);
            clientMsgProcess.clientPublishMessage += new ClientMsgProcess.onClientPublishMessage(clientPubMessage);
            serverMsgProcess.sendMsgToClient += new ServerMsgProcess.onSendMsgToClient(sendMsgToClient);
            serverMsgProcess.serverPublishMessage += new ServerMsgProcess.onServerPublishMessage(serverPubMessage);
            serverMsgProcess.sendMsgToServer += new ServerMsgProcess.onSendMsgToServer(sendMsgToServer);


            myGlobals.gatewayData.Add("MOBILE", "121");
            myGlobals.gatewayData.Add("UNICOM", "");
            myGlobals.gatewayData.Add("TELECOM", "");

            myGlobals.messageBus.init();


        }