Beispiel #1
0
        public void OnDeviceRemoving(DevEventArgs e)
        {
            if (!string.IsNullOrEmpty(ConnectorId))
            {
                if (ConnectorId == e.ConnectorId)
                {
                    if (NptWorker != null)
                    {
                        NptWorker.Command = NptCommand.AbortOperation;
                        NptWorker.Stop();

                        EnableControls = false;
                        WorkFlowState  = WFState.Nothing;
                        NptWorker      = null;

                        if (e.CleanConnectorId)
                        {
                            ConnectorId = null;
                        }

                        OnPropertychanged("Tempr");
                        OnPropertychanged("WorkFlowBtnEnabled");
                        OnPropertychanged("EnableControls");
                        OnPropertychanged("SlotDeviceStateAsColor");
                        OnPropertychanged("DevName");
                        OnPropertychanged("WarmUpTimer");
                    }
                }
            }
        }
Beispiel #2
0
 public void OnDeviceAttached(DevEventArgs e)
 {
     if (!string.IsNullOrEmpty(ConnectorId))
     {
         if (ConnectorId == e.ConnectorId)
         {
             if (!AppManager.Worker.DevTypesList.ContainsKey(e.NptType))
             {
                 throw new Exception("Npt type not supported");
             }
             NptWorker      = AppManager.Worker.DevTypesList[e.NptType].Device;
             NptWorker.Slot = this;
             NptWorker.Connect(e.PortName);
             NptWorker.ExecuteRead(NptRegisters.Registers._DEVTYPE);
             NptWorker.ExecuteRead(NptRegisters.Registers._PARAMS);
             NptWorker.GetRegisters().OnDeviceRegistersRead("PARAMS");
             NptWorker.Start();
             OnPropertychanged("SlotDeviceStateAsColor");
             OnPropertychanged("DevName");
             OnPropertychanged("WarmUpTimer");
             EnableControls = true;
             WorkFlowState  = WFState.Nothing;
         }
     }
 }
        private void CalibBtn_Click(object sender, RoutedEventArgs e)
        {
            NptWorker npt = ((Slot)DataContext).NptWorker;

            if (npt != null)
            {
                npt.Command         = NptCommand.Calibrate;
                npt.TotalTimes      = 1000 * npt.TimesByOpearation[npt.Command];
                npt.PrevOperationMs = 0;
            }
        }
        private void StartBtn_Click(object sender, RoutedEventArgs e)
        {
            NptWorker npt = ((Slot)DataContext).NptWorker;

            if (npt != null)
            {
                if (npt.Command == NptCommand.ReadState)
                {
                    npt.Command = NptCommand.StartWorkFlow;
                }
                else
                {
                    npt.Command = NptCommand.AbortOperation;
                }
            }
        }