/// <summary> /// Process a district's OneRoster CSV feed /// </summary> public async Task Process(ProcessingAction action) { switch (action) { default: case ProcessingAction.None: case ProcessingAction.LoadSample: throw new NotImplementedException(); case ProcessingAction.Load: await ProcessStage(ProcessingStage.Load); break; case ProcessingAction.Analyze: await ProcessStage(ProcessingStage.Analyze); break; case ProcessingAction.Apply: await ProcessStage(ProcessingStage.Apply); break; case ProcessingAction.FullProcess: bool success = // rely on lazy eval... await ProcessStage(ProcessingStage.Load) && await ProcessStage(ProcessingStage.Analyze) && await ProcessStage(ProcessingStage.Apply); break; } }
public ProcessIterator(IIteratorLink <TSource, TIntermediate> source, ProcessingAction <TIntermediate, TResult> processingAction) : this(source, (v, n, c) => { processingAction(v, n, c); return(true); }) { if (processingAction == null) { throw new ArgumentNullException("processingAction"); } }
private void ActionBody(ProcessingAction act) { new Thread(() => { var s = _scene.StackC1C2; var f = s.CurrentFrame; var rect = f.ClientRectangle; s.ProcessedActions.Add(act); s.ZoomRectangle(rect); f = s.CurrentFrame; pbC1C2.Image = f.ActualImage; }).Start(); new Thread(() => { var s = _scene.StackC0C1; var f = s.CurrentFrame; var rect = f.ClientRectangle; s.ProcessedActions.Add(act); s.ZoomRectangle(rect); f = s.CurrentFrame; pbC0C1.Image = f.ActualImage; }).Start(); new Thread(() => { var s = _scene.StackC0C2; var f = s.CurrentFrame; var rect = f.ClientRectangle; s.ProcessedActions.Add(act); s.ZoomRectangle(rect); f = s.CurrentFrame; pbC0C2.Image = f.ActualImage; }).Start(); }
private async Task <IActionResult> Process(int districtId, ProcessingAction processingAction) { District district = await db.Districts.FindAsync(districtId); district.ProcessingAction = processingAction; await db.SaveChangesAsync(); return(RedirectToDistrict(districtId).WithSuccess($"{processingAction} has been queued")); }
private void ActionBodySimple(ProcessingAction act, bool cleanTrackActions = false) { new Thread(() => { var s = _scene.StackC1C2; var f = s.CurrentFrame; if (cleanTrackActions) { var tracks = s.ProcessedActions.OfType <SceneTrackPointAction>().ToList(); foreach (var sceneTrackPointAction in tracks) { s.ProcessedActions.Remove(sceneTrackPointAction); } } f.ProcessedImage = new Bitmap(s.ProcessedActions.Count > 0 ? f.DrawedImage ?? f.ActualImage : f.Image); s.ProcessedActions.Add(act); s.DoAllSimpleActions(); pbC1C2.Image = f.ActualImage; }).Start(); new Thread(() => { var s = _scene.StackC0C1; var f = s.CurrentFrame; if (cleanTrackActions) { var tracks = s.ProcessedActions.OfType <SceneTrackPointAction>().ToList(); foreach (var sceneTrackPointAction in tracks) { s.ProcessedActions.Remove(sceneTrackPointAction); } } f.ProcessedImage = new Bitmap(s.ProcessedActions.Count > 0 ? f.DrawedImage ?? f.ActualImage : f.Image); s.ProcessedActions.Add(act); s.DoAllSimpleActions(); pbC0C1.Image = f.ActualImage; }).Start(); new Thread(() => { var s = _scene.StackC0C2; var f = s.CurrentFrame; if (cleanTrackActions) { var tracks = s.ProcessedActions.OfType <SceneTrackPointAction>().ToList(); foreach (var sceneTrackPointAction in tracks) { s.ProcessedActions.Remove(sceneTrackPointAction); } } f.ProcessedImage = new Bitmap(s.ProcessedActions.Count > 0 ? f.DrawedImage ?? f.ActualImage : f.Image); s.ProcessedActions.Add(act); s.DoAllSimpleActions(); pbC0C2.Image = f.ActualImage; }).Start(); }
private static void SetCoordinates(ProcessingAction action, Point3d startPosition, Point3d endPosition, bool flag = false) { if (Math.Abs(startPosition.X - endPosition.X) > CalcUtils.Tolerance || flag) { action.X = Round(endPosition.X); } if (Math.Abs(startPosition.Y - endPosition.Y) > CalcUtils.Tolerance || flag) { action.Y = Round(endPosition.Y); } if (Math.Abs(startPosition.Z - endPosition.Z) > CalcUtils.Tolerance) { action.Z = Round(endPosition.Z); } }
private static void AddGCommand(ProcessingAction processingAction) { if (processingAction.ActionType != _actionType) { AddLine("; " + processingAction.ActionType); } _actionType = processingAction.ActionType; var line = processingAction.ToolpathCurveType == null ? processingAction.Param : processingAction.ToolpathCurveType == ToolpathCurveType.Line ? "G1" : (processingAction.ToolpathCurveType == ToolpathCurveType.ArcClockwise ? "G2" : "G3"); if (processingAction.X != null) { line += " X" + processingAction.X; } if (processingAction.Y != null) { line += " Y" + processingAction.Y; } if (processingAction.Z != null) { line += " Z" + processingAction.Z; } if (processingAction.I != null) { line += " I" + (Settings.Machine == MachineKind.Ravelli ? processingAction.Irel : processingAction.I); } if (processingAction.J != null) { line += " J" + (Settings.Machine == MachineKind.Ravelli ? processingAction.Jrel : processingAction.J); } if (processingAction.Speed != null) { line += " F" + processingAction.Speed; } AddLine(line); }
/// <summary> /// Создать действие процесса обработки /// </summary> /// <param name="actionType">Действие</param> /// <param name="param">Параметр</param> private ProcessingAction CreateProcessAction(ActionType actionType, string param = null, double?x = null, double?y = null, double?z = null, int?speed = null) { var action = new ProcessingAction { No = _processingActions.Count + 1, ActionType = actionType, Param = param, Speed = speed, //_speed, //_isSpeedChanged ? _speed : null, X = Round(x), Y = Round(y), Z = Round(z) }; _processingActions.Add(action); if (_processingActions.Count % 100 == 0) { OnChangeActionsCount(_processingActions.Count); } _isSpeedChanged = false; return(action); }
public RosterProcessorWorker(int districtId, IServiceProvider services, ProcessingAction processingAction) { DistrictId = districtId; Services = services; ProcessingAction = processingAction; }
public static IIteratorLink <TSource, TResult> Process <TSource, TIntermediate, TResult>(this IIteratorLink <TSource, TIntermediate> source, ProcessingAction <TIntermediate, TResult> processingAction) { return(new ProcessIterator <TSource, TIntermediate, TResult>(source, processingAction)); }
public static IIteratorLink <TSource, TResult> Process <TSource, TResult>(ProcessingAction <TSource, TResult> processingAction) { return(Process <TSource, TSource, TResult>(null, processingAction)); }