public void Run(Action <IPoint> onPointAction) { while (IsContinue) { var pt = Logger.RunWithExceptionLogging(CreatePoint, true); if (pt != null) { onPointAction(pt); OnPointProduced?.Invoke(this, pt); } System.Threading.Thread.Sleep(1000); } }
public void Run(Action <IPoint> onPointProduced) { while (KeepRunning) { var point = loggerService.RunWithExceptionLogging(BuildPoint, true); if (point != null) { onPointProduced(point); OnPointProduced?.Invoke(this, point); } System.Threading.Thread.Sleep(1000); } loggerService.Info($"{this.GetType()} is done."); }
public void Run(Func <IPoint, bool> isPointValid) { decimal x = 0; IsContinue = true; while (IsContinue) { var point = LoggerService.RunWithExceptionLogging(() => this.BuildPoint(x++), isSilent: true); if (isPointValid(point)) { OnPointProduced?.Invoke(this, point); } } this.LoggerService?.Info($"{this.GetType()} -> Going to exit..."); }
public void Run(Action <IPoint> onPointReceiver) { IsContinue = true; while (IsContinue) { decimal x = rnd.Next(-5, 25); var point = BuildPoint(x); System.Threading.Thread.Sleep(1000); if (x == 0) { continue; } if (x < 0) { continue; } OnPointProduced?.Invoke(this, point); } }
public void Run(Action <IPoint> onPointRecieve, decimal startingValue, decimal step) { var x = startingValue; IsContinue = true; while (IsContinue) { var point = BuildPoint(x); onPointRecieve(point); if (point != null) { OnPointProduced?.Invoke(this, point); } x += step; System.Threading.Thread.Sleep(1000); } loggerService.Info($"{GetType()} -> Going to exit"); }
public void Start(Action <IPoint> onPointRecieve, int startValue, int step) { int a = startValue; IsContinue = true; while (IsContinue) { IPoint point = CreatePoint(a); onPointRecieve(point); if (point != null) { OnPointProduced?.Invoke(this, point); } a += step; System.Threading.Thread.Sleep(1000); } loggerService.Info($"{GetType()} -> to exit"); }
public void Run(Action <IPoint> onPointReceive) { IsContinue = true; decimal x = 1; while (IsContinue) { var point = this.BuildPoint(x++); onPointReceive(point); if (point != null) { OnPointProduced?.Invoke(this, point); } System.Threading.Thread.Sleep(1000); } this.loggerService.Info($"{this.GetType()} -> Going to exit..."); }