Пример #1
0
 private void SerialDataReceivedHandler(LaserBaseResponse baseResponse)
 {
     if (baseResponse != null)
     {
         LaserC01Response c01r = baseResponse as LaserC01Response;
         if (c01r != null)
         {
             if (c01r.Flag == 1152)
             {
                 //红光关闭,则强制开启
                 UpdateBtnText("Open");
                 redLaserOpen = false;
             }
             else if (c01r.Flag == 1408)
             {
                 UpdateBtnText("Closed");
                 redLaserOpen = true;
             }
         }
         //LaserC09Response c09r = baseResponse as LaserC09Response;
         //if (c09r != null)
         //{
         //    this.slider.Value = (int)c09r.Current;
         //}
     }
 }
Пример #2
0
 private void InitializeDecoders()
 {
     Decoders       = new Dictionary <byte, LaserBaseResponse>();
     Decoders[0x00] = new LaserC00Response();
     Decoders[0x01] = new LaserC01Response();
     Decoders[0x03] = new LaserC03Response();
     Decoders[0x04] = new LaserC04Response();
     Decoders[0x05] = new LaserC05Response();
     Decoders[0x06] = new LaserC06Response();
     Decoders[0x07] = new LaserC07Response();
     Decoders[0x08] = new LaserC08Response();
     Decoders[0x09] = new LaserC09Response();
     Decoders[0x0B] = new LaserC0BResponse();
     Decoders[0x0C] = new LaserC0CResponse();
     Decoders[0x71] = new LaserC71Response();
     Decoders[0x72] = new LaserC72Response();
     Decoders[0x73] = new LaserC73Response();
     Decoders[0x74] = new LaserC74Response();
     Decoders[0x75] = new LaserC75Response();
     //initialize default decoder
     Decoder = Decoders[0x00];
 }