private MechanicalService CreateMechanicalService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new MechanicalService(userId);

            return(service);
        }
Пример #2
0
        public bool startService()
        {
            if (this.StartedService)
            {
                return(false);
            }

            mMechanicalConn = new SerialPortInput();
            mCodec          = new MotionCodec();
            mMechanicalConn.SetPort(mConnPort, mBaudrate);
            mMechanicalService = new MechanicalService(mMechanicalConn, mCodec);
            mMechanicalService.passingMessageEvent += new PassingMessageHandler(handleResponseMessage);
            if (!mMechanicalService.startService())
            {
                this.StartedService = false;
                return(false);
            }

            this.StartedService = true;
            this.ReadyMotion    = false;
            this.mReadyFlag     = true;
            this.enableMotion();
//            this.controlHomeMotion();
            if (this.mTimerCheckReady == null)
            {
                this.mTimerCheckReady = new DispatcherTimer();
            }
            this.mTimerCheckReady.Interval = TimeSpan.FromSeconds(1);
            this.mTimerCheckReady.Tick    += this.onTimerTick;
            this.mTimerCheckReady.Start();
            return(true);
        }