Пример #1
0
        void IDriverPresenter.OnRegisterDriver()
        {
            try
            {
                DriverClient listener = new DriverClient(this);
                _scsClient = ScsServiceClientBuilder.CreateClient <IDriverServer>(
                    new ScsTcpEndPoint(defaultIP, defaultPort), listener);
                _scsClient.Connect();

                _server = _scsClient.ServiceProxy;

                _driverId = _view.GetDriverId();

                if (_driverId != INVALID_DRIVER_ID)
                {
                    _server.RegisterDriver(_driverId, 0);
                    _view.OnConnected();
                }
                else
                {
                    _scsClient = null;
                    _view.OnDisconnected();
                }
            }

            catch (Exception)
            {
                _scsClient = null;
                _view.OnDisconnected();
            }
        }
Пример #2
0
        void IDriverPresenter.RegisterDriver(int driverID)
        {
            try
            {
                _driverId = driverID;

                DriverClient listener = new DriverClient(this);
                _scsClient = ScsServiceClientBuilder.CreateClient <IDriverServer>(
                    new ScsTcpEndPoint(defaultIP, defaultPort), listener);
                _scsClient.Connect();

                _server = _scsClient.ServiceProxy;

                if (_driverId != INVALID_DRIVER_ID && _server.RegisterDriver(_driverId, 0) == 0)
                {
                    NotifyConnected();
                }
                else
                {
                    _scsClient = null;
                    NotifyDisconnected();
                }
            }

            catch (Exception)
            {
                _scsClient = null;
                NotifyDisconnected();
            }
        }