public static string RecorderView() { string id = RecorderControl.OpenRecorderShell(); Shell s = Shell.GetShell(id); if (s != null) { RecorderControl p = s.MainControl as RecorderControl; if (p != null) { return(id); } s.Close(); return("Error: unable to open recorder control."); } return("Error: unable to open recoder shell."); }
public RecorderChart(RecorderControl recorder) { Recorder = recorder; ChartPlotter = null; IsClosing = false; IsYZoom = false; NumPointsPerPlot = POINTS_PER_PLOT; CurrentRelativeChartCacheIndex = 0; CurrentChartImageFileName = null; ChartCache = new DataCache(recorder.ShellId, false, true, true, 0); BottomAxis = new RecorderTimeLineAxis(this); LeftAngularAxis = new RecorderLeftAngularAxis(this); LeftSignalAxis = new RecorderLeftSignalAxis(this); AxisPointTaskQueue = new LinkedBlockingCollection <RecorderAxisPoint>(); PointSchedulerTask = new Thread(new ThreadStart(AxisPointScheduler)); PointSchedulerTask.Name = "AxisPointSchedulerThread:" + recorder.ShellId; PointSchedulerTask.Priority = ThreadPriority.Normal; PointSchedulerTask.Start(); }
public static string DumpChartCache(string recorderId, string dataFileName) { if (Application.Current.Dispatcher.CheckAccess()) { if (!String.IsNullOrWhiteSpace(dataFileName)) { Shell s = Shell.GetShell(recorderId); if (s != null) { RecorderControl p = s.MainControl as RecorderControl; if (p != null) { string header = ""; return(p.RecorderScope.ChartCache.DumpToFile(dataFileName, true, header)); } } } return("Error: bad file name."); } return((string)Application.Current.Dispatcher.Invoke( new Func <String>(() => { return DumpChartCache(recorderId, dataFileName); }) )); }
// Collects together properties of enabled and valid axes. public static List <AxisProperties> CollectProperties(RecorderControl recorder) { int k, n, i; List <string> devices = new List <string>(); for (k = 1; k <= 4; k++) { string id = k.ToString(); ComboBox di = recorder.FindName("DeviceId" + id) as ComboBox; if (di != null && !String.IsNullOrWhiteSpace(di.Text)) { devices.Add(di.Text); } else { devices.Add("None"); } } List <AxisProperties> properties = new List <AxisProperties>(); for (k = 1; k <= 8; k++) { string id = k.ToString(); CheckBox cba = recorder.FindName("AxisActive" + id) as CheckBox; CheckBox cbs = recorder.FindName("AxisShow" + id) as CheckBox; CheckBox cbe = recorder.FindName("AxisEnable" + id) as CheckBox; ComboBox cb = recorder.FindName("AxisKind" + id) as ComboBox; TextBox tb = recorder.FindName("AxisDescription" + id) as TextBox; IntegerUpDown iudad = recorder.FindName("AxisDevice" + id) as IntegerUpDown; IntegerUpDown iud = recorder.FindName("AxisIndex" + id) as IntegerUpDown; IntegerUpDown iudh = recorder.FindName("AxisDeviceRank" + id) as IntegerUpDown; IntegerUpDown iudma = recorder.FindName("AxisMinusStopMajor" + id) as IntegerUpDown; IntegerUpDown iudmb = recorder.FindName("AxisMinusStopMinor" + id) as IntegerUpDown; IntegerUpDown iudpa = recorder.FindName("AxisPlusStopMajor" + id) as IntegerUpDown; IntegerUpDown iudpb = recorder.FindName("AxisPlusStopMinor" + id) as IntegerUpDown; if (cbe == null || !cbe.IsChecked.Value) { continue; } n = (iudad == null) ? 1 : iudad.Value.Value; i = (iud == null) ? 0 : iud.Value.Value; if (i < 1 || n < 1 || n > 4 || devices[n - 1].Equals("None")) { continue; } /* Debug: could have multiple axes on same device. * bool inUse = false; * for (int j = 0; j < properties.Count; j++) { * if (properties[j].DeviceNumber == n) { * inUse = true; * break; * } * } * if (inUse) continue; */ AxisProperties ap = new AxisProperties(); ap.DeviceNumber = n; ap.DeviceId = devices[n - 1]; ap.ParamIndex = i; ap.DeviceRank = (iudh == null) ? 0 : iudh.Value.Value; ap.AxisId = k; ap.SeriesIndex = 2 * (k - 1); ap.Show = (cbs == null) ? false : cbs.IsChecked.Value; ap.Active = (cba == null) ? false : cba.IsChecked.Value; try { if (cb == null || String.IsNullOrWhiteSpace(cb.Text)) { ap.AxisKind = AxisKinds.Angular; } else { ap.AxisKind = (AxisKinds)Enum.Parse(typeof(AxisKinds), cb.Text); } } catch (Exception) { ap.AxisKind = AxisKinds.Angular; } int minusmajor = (iudma == null) ? 0 : iudma.Value.Value; int minusminor = (iudmb == null) ? 0 : iudmb.Value.Value; int plusmajor = (iudpa == null) ? 0 : iudpa.Value.Value; int plusminor = (iudpb == null) ? 0 : iudpb.Value.Value; if (ap.AxisKind == AxisKinds.Angular) { ap.MinusStop = minusmajor + ((float)minusminor / 360.0f); ap.PlusStop = plusmajor + ((float)plusminor / 360.0f); } else { ap.MinusStop = minusmajor + ((float)minusminor / 1000.0f); ap.PlusStop = plusmajor + ((float)plusminor / 1000.0f); } string s = tb.Text; if (String.IsNullOrWhiteSpace(s)) { s = "Axis " + id; } ap.Description = s; properties.Add(ap); } return(properties); }
public JobStorage(RecorderControl recorder) { Recorder = recorder; CurrentFilePath = Project.GetProjectDir(); }
// Collects together properties of enabled and valid triggers. public static List <TriggerProperties> CollectProperties(RecorderControl recorder) { int k; List <TriggerProperties> properties = new List <TriggerProperties>(); for (k = 1; k <= 4; k++) { string id = k.ToString(); CheckBox cbe = recorder.FindName("TriggerEnable" + id) as CheckBox; CheckBox cbahi = recorder.FindName("TriggerActiveHighInput" + id) as CheckBox; CheckBox cbaho = recorder.FindName("TriggerActiveHighOutput" + id) as CheckBox; CheckBox cbpi = recorder.FindName("TriggerPlayInput" + id) as CheckBox; CheckBox cbpo = recorder.FindName("TriggerPlayOutput" + id) as CheckBox; CheckBox cbri = recorder.FindName("TriggerRecordInput" + id) as CheckBox; CheckBox cbro = recorder.FindName("TriggerRecordOutput" + id) as CheckBox; CheckBox cbsi = recorder.FindName("TriggerSignalInput" + id) as CheckBox; CheckBox cbso = recorder.FindName("TriggerSignalOutput" + id) as CheckBox; IntegerUpDown iudds = recorder.FindName("TriggerDelaySeconds" + id) as IntegerUpDown; IntegerUpDown iuddf = recorder.FindName("TriggerDelayFrames" + id) as IntegerUpDown; IntegerUpDown iudidm = recorder.FindName("TriggerInputDeviceId" + id) as IntegerUpDown; IntegerUpDown iudibm = recorder.FindName("TriggerInputBitMask" + id) as IntegerUpDown; IntegerUpDown iudodm = recorder.FindName("TriggerOutputDeviceMask" + id) as IntegerUpDown; IntegerUpDown iudobm = recorder.FindName("TriggerOutputBitMask" + id) as IntegerUpDown; DecimalUpDown dudl = recorder.FindName("TriggerPulseLength" + id) as DecimalUpDown; DecimalUpDown dudc = recorder.FindName("TriggerPulseCycle" + id) as DecimalUpDown; IntegerUpDown iudr = recorder.FindName("TriggerRepeat" + id) as IntegerUpDown; TextBox tb = recorder.FindName("TriggerDescription" + id) as TextBox; // if (cbe == null || !cbe.IsChecked.Value) { continue; } TriggerProperties tp = new TriggerProperties(); tp.TriggerId = k; tp.ActiveHighInput = (cbahi == null) ? false : cbahi.IsChecked.Value; tp.ActiveHighOutput = (cbaho == null) ? false : cbaho.IsChecked.Value; tp.PlayInput = (cbpi == null) ? false : cbpi.IsChecked.Value; tp.PlayOutput = (cbpo == null) ? false : cbpo.IsChecked.Value; tp.RecordInput = (cbri == null) ? false : cbri.IsChecked.Value; tp.RecordOutput = (cbro == null) ? false : cbro.IsChecked.Value; tp.SignalInput = (cbsi == null) ? false : cbsi.IsChecked.Value; tp.SignalOutput = (cbso == null) ? false : cbso.IsChecked.Value; tp.DelaySeconds = (uint)((iudds == null) ? 0 : iudds.Value.Value); tp.DelayFrames = (uint)((iuddf == null) ? 0 : iuddf.Value.Value); tp.InputDeviceId = (iudidm == null) ? 0 : iudidm.Value.Value; tp.InputBitMask = (iudibm == null) ? 0 : iudibm.Value.Value; tp.OutputDeviceMask = (iudodm == null) ? 0 : iudodm.Value.Value; tp.OutputBitMask = (iudobm == null) ? 0 : iudobm.Value.Value; tp.PulseLength = (dudl == null) ? 0.0f : (float)(dudl.Value.Value); tp.PulseCycle = (dudc == null) ? 0.0f : (float)(dudc.Value.Value); tp.PulseRepeat = (iudr == null) ? 0 : iudr.Value.Value; string s = tb.Text; if (String.IsNullOrWhiteSpace(s)) { s = "Trigger " + id; } tp.Description = s; tp.InputEnabled = tp.PlayInput || tp.RecordInput || tp.SignalInput; tp.OutputEnabled = tp.PlayOutput || tp.RecordOutput || tp.SignalOutput; if (tp.SignalInput) { foreach (AxisPortProperties app in recorder.Controller.AxisPorts) { if (app.DeviceNumber == tp.InputDeviceId) { tp.AxisPort = app; break; } } if (tp.AxisPort == null) { continue; } } if (tp.InputEnabled && tp.OutputEnabled) // Note: must have defined an input & output. { properties.Add(tp); } } return(properties); }
public Motion(RecorderControl recorder) { Recorder = recorder; }
public Axes(RecorderControl recorder) { Recorder = recorder; }
public Triggers(RecorderControl recorder) { Recorder = recorder; }
public Options(RecorderControl recorder) { Recorder = recorder; }