public static bool ImportOutput(MonitorBox box, FacilityContext context) { if (File.Exists(outputFile)) { try { List <DigitalOutputChannel> channels = new List <DigitalOutputChannel>(); var lines = File.ReadAllLines(outputFile); foreach (var line in lines) { var row = line.Split('\t'); bool connected = (row[4] == "TRUE") ? true : false; LogicType type = (row[3] == "HIGH") ? LogicType.HIGH : LogicType.LOW; DigitalOutputChannel channel = new DigitalOutputChannel(row[0], Convert.ToInt32(row[1]), Convert.ToInt32(row[2]), connected, row[5], type); channel.OutputControl = (row[7] == "SOFTWARE") ? OutputControl.SOFTWARE : OutputControl.HARDWARE; channel.Bypass = (connected) ? false : true; channel.Device = box; box.Registers.Add(channel); context.Registers.Add(channel); } context.SaveChanges(); return(true); } catch { return(false); } } else { return(false); } }
public void ConfigureScanTrigger() { sendScanTriggerTask = new Task("Send Cavity UnlockCavity Trigger"); sendTriggerChannel = (DigitalOutputChannel)Environs.Hardware.DigitalOutputChannels[triggerOutput]; sendTriggerChannel.AddToTask(sendScanTriggerTask); sendScanTriggerTask.Control(TaskAction.Verify); triggerWriter = new DigitalSingleChannelWriter(sendScanTriggerTask.Stream); triggerWriter.WriteSingleSampleSingleLine(true, false); sendScanTriggerTask.Start(); }