Пример #1
0
        public mainApp()
        {
            InitializeComponent();
            InitializeColorsSyringe();

            decoder       = new ProgressDecoder(syringe);
            communication = Communication.createCommunicationManager(serialPort, decoder);

            decoder.NewPositionArrived    += new EventHandler <DecoderArgs>(newPosEvent);
            decoder.StartPosArrived       += new EventHandler <DecoderArgs>(startPosEvent);
            decoder.SyringeStoppedArrived += new EventHandler <DecoderArgs>(stoppedEvent);
            decoder.HomingDoneArrived     += new EventHandler <DecoderArgs>(homingDoneEvent);
            decoder.BolusDoneArrived      += new EventHandler <DecoderArgs>(bolusDoneEvent);

            t           = new System.Timers.Timer();
            t.Interval  = 25;
            t.AutoReset = true;

            t.Elapsed += new ElapsedEventHandler(getData);

            arduino = new ArduinoConnectionManager();
            arduino.ConnectionChanged += new EventHandler <ConnectionArgs>(connectionChanged);

            baseConnector = SyringesBaseConnector.getInstance();
        }
Пример #2
0
        /// <summary>
        /// Create New Syringe Form.
        /// </summary>
        /// <param ID="id">
        /// Id of new syringe to create
        /// </param>
        /// <param Decoder="d"></param>
        public NewSyringe(int id, ProgressDecoder d)
        {
            InitializeComponent();
            initColors();

            decoder    = d;
            connector  = SyringesBaseConnector.getInstance();
            newSyringe = new Syringe()
            {
                ID = id
            };

            this.ok_btn.DialogResult = DialogResult.OK;

            t           = new System.Timers.Timer();
            t.Interval  = 25;
            t.Elapsed  += new ElapsedEventHandler(getData);
            t.AutoReset = true;

            communication = Communication.getCommunicationManager();

            speed_cmb.SelectedIndex = 0;

            decoder.NewPositionArrived += new EventHandler <DecoderArgs>(newPositionEvent);
            decoder.HomingDoneArrived  += new EventHandler <DecoderArgs>(homeDoneEvent);
        }
 /// <summary>
 /// Methods to return instance of class.
 /// </summary>
 /// <returns>
 /// Instance of SyringeBaseConnector instance.
 /// </returns>
 public static SyringesBaseConnector getInstance()
 {
     if (instance == null)
     {
         instance = new SyringesBaseConnector();
     }
     return(instance);
 }