Exemplo n.º 1
0
        private void RoadForm_Load(object sender, EventArgs e)
        {
            if (SingleApp.AppExist("2571EFFE-7388-4990-AAC3-B645329DDBCE"))
            {
                Application.Exit();
            }

            strParkID = ConfigurationManager.AppSettings.Get("ParkID");

            mainSC     = SynchronizationContext.Current;
            scCallback = new SendOrPostCallback(MainScCallback);

            tcpClient               = new WcfCommonLib.TcpClient();
            tcpClient.QueryEvent   += new WcfCommonLib.TcpClient.QueryEventHandler(tcpClient_QueryEvent);
            tcpClient.MessageEvent += new WcfCommonLib.TcpClient.MessageEventHandler(tcpClient_MessageEvent);

            dataCallback = new WaitCallback(GetUploadData);

            wcfClient = new CenterServiceClient();
            webServer = new SimpleWebSerer();
            webServer.StartServer();
            ConnectServer();

            SetTimer(timerReconnect, "ReconnectTimer");
            SetTimer(timerUploadData, "UploadTimer");

            GetInitializeData();
        }
Exemplo n.º 2
0
        private void CenterForm_Load(object sender, EventArgs e)
        {
            if (SingleApp.AppExist("C024F8AB-3F9A-495D-B6B4-044FF802BD5C"))
            {
                Application.Exit();
            }

            mainSC     = SynchronizationContext.Current;
            scCallback = new SendOrPostCallback(MainScCallback);

            svcHost = new ServiceHost(typeof(CenterService));
            svcHost.Open();
            CenterService.logCB += DisplayLog;

            webServer             = new SimpleWebSerer();
            webServer.QueryEvent += new SimpleWebSerer.QueryEventHandler(webServer_QueryEvent);
            webServer.StartServer();

            tcpServer = new WcfCommonLib.TcpServer();
            tcpServer.MessageEvent += new TcpServer.MessageEventHandler(tcpServer_MessageEvent);
            tcpServer.StartServer();
        }