예제 #1
0
        public PatternRepeatLogic(
            IDbLocal dbLocal,
            CutRollList cutRolls,
            InspectionAreaList inspectionAreaList,
            ISapRollAssigner sapRollAssigner,
            IPatternRepeatSrc srcData,
            ISewinQueue sewinQueue,
            IServiceSettings serviceSettings,
            IUserAttentions <PatternRepeatModel> userAttentions,
            ICriticalStops <PatternRepeatModel> criticalStops,
            IProgramState programState,
            IScheduler scheduler)
            : base(dbLocal, srcData, sewinQueue, serviceSettings, userAttentions, criticalStops, programState, scheduler)
        {
            this.dbLocal            = dbLocal;
            this.cutRolls           = cutRolls;
            this.inspectionAreaList = inspectionAreaList;
            this.sapRollAssigner    = sapRollAssigner;
            this.serviceSettings    = serviceSettings;
            this.srcData            = srcData;
            this.sewinQueue         = sewinQueue;
            this.programState       = programState;

            this.nextCutRollId = dbLocal.GetNextCutRollId();

            this.SeamDelayLine.DelayTicks = serviceSettings.SeamToCutKnife;

            programState.Saving += this.SaveState;

            this.KeepBowAndSkewUpToDateAsync().NoWait();
        }
예제 #2
0
 public StateContext(IProgramState internalState, UserInterfaceOutputFacade outputFacade, GameController gameController, TrackingManager trackingManager, TrackingResultProcessing trackingResultProcessing)
 {
     InternalState            = internalState;
     OutputFacade             = outputFacade;
     GameController           = gameController;
     TrackingManager          = trackingManager;
     TrackingResultProcessing = trackingResultProcessing;
 }
예제 #3
0
        public SimInfo(IDbMfgSim dbMfgSim, IProgramState programState)
        {
            this.dbMfgSim     = dbMfgSim;
            this.programState = programState;
            this.SetCheckRollLength();

            this.FeetPerMinute = programState.GetSubState(nameof(SimInfo)).Get <double?>(nameof(this.FeetPerMinute)) ?? this.FeetPerMinute;
        }
 public TrackingResultProcessing(UserInterfaceOutputFacade outputFacade, GameController gameController, IProgramState programState)
 {
     OutputFacade        = outputFacade;
     GameController      = gameController;
     ProgramState        = programState;
     FpsCounter          = new FPSCounter();
     TrackningInProgress = false;
     AveragingQueue      = new Queue <TimestampObject <TrackingState> >();
     TimeOffset          = DateTime.Now + TimeSpan.FromSeconds(1.5);
 }
예제 #5
0
 /// <summary>
 /// Creates a new instance of the <see cref="ExecutionContext"/> class.
 /// </summary>
 /// <param name="serviceProvider">The object providing additional services to the emulator.</param>
 /// <param name="programState">The current state of the program.</param>
 /// <param name="cancellationToken">The cancellation token to use for cancelling the execution.</param>
 public ExecutionContext(
     IServiceProvider serviceProvider,
     IProgramState <IConcreteValue> programState,
     CancellationToken cancellationToken)
 {
     _serviceProvider  = serviceProvider;
     ProgramState      = programState ?? throw new ArgumentNullException(nameof(programState));
     CancellationToken = cancellationToken;
     Result            = new ExecutionResult();
 }
예제 #6
0
        public TrackingManager(UserInterfaceOutputFacade outputFacade, TrackingResultProcessing trackingResultProcessing, UserDefinedParametersPrototypeFactory userParameters, IProgramState programState)
        {
            OutputFacade             = outputFacade;
            TrackingResultProcessing = trackingResultProcessing;
            ProgramState             = programState;

            ProcessingCommandsQueue = new BlockingCollection <Message>(new ConcurrentQueue <Message>());
            ProcessingOutputQueue   = new BlockingCollection <Message>(new ConcurrentQueue <Message>());

            InitPipelineThread(userParameters);
        }
예제 #7
0
 public MahloLogic(
     IDbLocal dbLocal,
     IMahloSrc mahloSrc,
     ISewinQueue sewinQueue,
     IServiceSettings appInfo,
     IUserAttentions <MahloModel> userAttentions,
     ICriticalStops <MahloModel> criticalStops,
     IProgramState programState,
     IScheduler scheduler)
     : base(dbLocal, mahloSrc, sewinQueue, appInfo, userAttentions, criticalStops, programState, scheduler)
 {
     this.dbLocal = dbLocal;
 }
예제 #8
0
        public UserInterfaceInputFacade(UserInterfaceOutputFacade outputFacade, UserDefinedParametersPrototypeFactory userParameters)
        {
            var programStateController = new ProgramStateController();

            ProgramState = programStateController;

            OutputFacade             = outputFacade;
            GameController           = new GameController(outputFacade, ProgramState);
            TrackingResultProcessing = new TrackingResultProcessing(outputFacade, GameController, ProgramState);
            TrackingManager          = new TrackingManager(OutputFacade, TrackingResultProcessing, userParameters, ProgramState);

            programStateController.SetInitialContext(outputFacade, GameController, TrackingManager, TrackingResultProcessing);
        }
예제 #9
0
 public BowAndSkewLogic(
     IDbLocal dbLocal,
     IBowAndSkewSrc dataSrc,
     ISewinQueue sewinQueue,
     IServiceSettings appInfo,
     IUserAttentions <BowAndSkewModel> userAttentions,
     ICriticalStops <BowAndSkewModel> criticalStops,
     IProgramState programState,
     IScheduler scheduler)
     : base(dbLocal, dataSrc, sewinQueue, appInfo, userAttentions, criticalStops, programState, scheduler)
 {
     this.dbLocal = dbLocal;
     this.dataSrc = dataSrc;
     this.SeamDelayLine.DelayTicks = appInfo.SeamToBowAndSkew;
 }
예제 #10
0
        public FormSim(
            IDbMfg dbMfg,
            IMahloSrc mahloSrc,
            IBowAndSkewSrc bowAndSkewSrc,
            IPatternRepeatSrc patternRepeatSrc,
            IProgramState programState)
        {
            this.InitializeComponent();

            this.dbMfgSim         = (IDbMfgSim)dbMfg;
            this.mahloSrc         = mahloSrc;
            this.bowAndSkewSrc    = bowAndSkewSrc;
            this.patternRepeatSrc = patternRepeatSrc;
            this.programState     = programState;

            this.simInfo = new SimInfo(this.dbMfgSim, this.programState);
            this.srcSimInfo.DataSource = this.simInfo;
            this.srcFormSim.DataSource = this;
            this.srcGrid.DataSource    = this.dbMfgSim.SewinQueue;
        }
예제 #11
0
        public CommandManager(IAppFactory appFactory, IProgramState programState, ILogger logger, IConsole console)
        {
            this._unRecognisedCommand = new UnRecognisedCommand();
            this._console             = console ?? throw new ArgumentNullException(nameof(console));
            this._logger = logger ?? throw new ArgumentNullException(nameof(logger));

            if (appFactory == null)
            {
                throw new ArgumentNullException(nameof(appFactory));
            }

            this._commands = new List <ICommand>
            {
                new InitiateCommand(programState, this),
                new HelpCommand(),
                new QuitCommand(programState),
                new DemoCommand(appFactory),
                new DemoCsvCommand(appFactory),
                new DemoNetworkingCommand(appFactory),
                new DemoTradeFileCommand(appFactory),
                new DemoTradeFileNetworkingCommand(appFactory),
                new SpoofingCommand(appFactory),
                new ScheduleRuleCommand(appFactory),
                new DemoMarketEquityFileCommand(appFactory),
                new DemoMarketEquityFileNetworkingCommand(appFactory),
                new CancellationCommand(appFactory),
                new NukeCommand(appFactory),
                new DemoDataGenerationCommand(appFactory),
                new Cancellation2Command(appFactory),
                new HighVolumeCommand(appFactory),
                new MarkingTheCloseCommand(appFactory),
                new Spoofing2Command(appFactory),
                new LayeringCommand(appFactory),
                new HighProfitCommand(appFactory),
                new WashTradeCommand(appFactory),
                this._unRecognisedCommand
            };
        }
예제 #12
0
 public void ChangeState(IProgramState state)
 {
     State = state;
 }
예제 #13
0
 void ChangeState(IProgramState state)
 {
     Program.ChangeState(state);
     _moved = false;
 }
예제 #14
0
 /// <inheritdoc />
 public TInstruction GetCurrentInstruction(IProgramState <SymbolicValue <TInstruction> > currentState) =>
 Instructions.GetInstructionAtOffset(currentState.ProgramCounter);
예제 #15
0
        public MeterLogic(
            IDbLocal dbLocal,
            IMeterSrc <Model> srcData,
            ISewinQueue sewinQueue,
            IServiceSettings appInfo,
            IUserAttentions <Model> userAttentions,
            ICriticalStops <Model> criticalStops,
            IProgramState programState,
            IScheduler scheduler)
        {
            this.dbLocal         = dbLocal;
            this.sewinQueue      = sewinQueue;
            this.srcData         = srcData;
            this.appInfo         = appInfo;
            this.UserAttentions  = userAttentions;
            this.CriticalStops   = criticalStops;
            this.programState    = programState;
            programState.Saving += this.SaveState;
            this.Disposables     = new List <IDisposable>
            {
                Observable
                .FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.srcData).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.srcData).PropertyChanged -= h)
                .Subscribe(args => this.OpcValueChanged(args.EventArgs.PropertyName)),

                Observable
                .Interval(TimeSpan.FromSeconds(1), scheduler)
                .Subscribe(_ =>
                {
                    this.Recipe       = this.srcData.Recipe;
                    this.IsManualMode = this.srcData.IsAutoMode;
                }),

                Observable
                .FromEvent(
                    h => this.sewinQueue.QueueChanged += h,
                    h => this.sewinQueue.QueueChanged -= h)
                .Subscribe(_ => this.SewinQueueChanged()),

                Observable
                .FromEventPattern <CancelEventHandler, CancelEventArgs>(
                    h => this.sewinQueue.CanRemoveRollQuery += h,
                    h => this.sewinQueue.CanRemoveRollQuery -= h)
                .Subscribe(args => args.EventArgs.Cancel    |= args.Sender == this.currentRoll),

                Observable
                .FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.UserAttentions).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.UserAttentions).PropertyChanged -= h)
                .Subscribe(_ =>
                {
                    this.IsMapValid &= this.UserAttentions.Any;
                    this.IsChanged   = true;
                }),

                Observable
                .FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.CriticalStops).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.CriticalStops).PropertyChanged -= h)
                .Subscribe(_ =>
                {
                    this.IsMapValid &= this.CriticalStops.Any;
                    this.IsChanged   = true;
                }),

                Observable
                .FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.sewinQueue).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.sewinQueue).PropertyChanged -= h)
                .Where(args => args.EventArgs.PropertyName == nameof(this.sewinQueue.Message))
                .Subscribe(args => this.QueueMessage = this.sewinQueue.Message),
            };
        }
예제 #16
0
 void ChangeState(IProgramState state, CrossStateData data)
 {
     CommitManager.GetInstance().RestoreBranchLabel(data.AttachedBranch);
     Program.AggregationFocus(null);
     Program.ChangeState(state);
 }
예제 #17
0
 void ChangeState(IProgramState state)
 {
     Aimed = null;
     Program.ChangeState(state);
 }
예제 #18
0
 public void Setup()
 {
     this._programState   = A.Fake <IProgramState>();
     this._commandManager = A.Fake <ICommandManager>();
 }
예제 #19
0
 public MainProgram(IProgramState state)
 {
     State = state;
 }
예제 #20
0
        public OpcSrcSim(
            IDbMfgSim dbMfg,
            ISewinQueue sewinQueue,
            IUserAttentions <Model> userAttentions,
            ICriticalStops <Model> criticalStops,
            IOpcSettings mahloSettings,
            IProgramState programState,
            SynchronizationContext synchronizationContext,
            ILogger logger,
            IServiceSettings settings)
        {
            this.dbMfg          = dbMfg;
            this.sewinQueue     = sewinQueue;
            this.userAttentions = userAttentions;
            this.criticalStops  = criticalStops;
            this.mahloSettings  = mahloSettings;
            //this.seamSettings = seamSettings;
            this.synchronizationContext = synchronizationContext;
            this.programState           = programState;
            this.log      = logger;
            this.settings = settings;

            this.disposables.AddRange(new IDisposable[]
            {
                Observable.FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.criticalStops).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.criticalStops).PropertyChanged -= h)
                .Where(args => args.EventArgs.PropertyName == nameof(CriticalStops <Model> .Any))
                .Subscribe(_ => this.SetCriticalAlarmIndicator(this.criticalStops.Any)),

                Observable.FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.userAttentions).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.userAttentions).PropertyChanged -= h)
                .Where(args => args.EventArgs.PropertyName == nameof(UserAttentions <Model> .Any))
                .Subscribe(_ => this.SetStatusIndicator(this.userAttentions.Any)),
            });

            var state = programState.GetSubState(nameof(OpcSrcSim <Model>), typeof(Model).Name);

            this.cutRollCount           = state.Get <int?>(nameof(this.cutRollCount)) ?? 0;
            this.rollIndex              = state.Get <int?>(nameof(this.rollIndex)) ?? 0;
            this.FeetCounter            = state.Get <double?>(nameof(this.FeetCounter)) ?? this.FeetCounter;
            this.feetCounterAtRollStart = state.Get <double?>(nameof(this.feetCounterAtRollStart)) ?? this.feetCounterAtRollStart;

            //
            state = this.programState.GetSubState(nameof(MeterLogic <MahloModel>), typeof(Model).Name);
            string rollNo = state.Get <string>(nameof(GreigeRoll.RollNo)) ?? string.Empty;

            if (!string.IsNullOrEmpty(rollNo))
            {
                var currentRoll = this.sewinQueue.Rolls.FirstOrDefault(item => item.RollNo == rollNo) ?? new GreigeRoll();
                this.rollIndex = this.sewinQueue.Rolls.IndexOf(currentRoll);
            }

            programState.Saving += ps =>
            {
                ps.GetSubState(nameof(OpcSrcSim <Model>))
                .Set(typeof(Model).Name, new
                {
                    this.cutRollCount,
                    this.rollIndex,
                    this.FeetCounter,
                    this.feetCounterAtRollStart,
                });
            };

            this.isCheckRollEndSeamNeeded = this.sewinQueue.Rolls.FirstOrDefault()?.IsCheckRoll ?? false;
        }
예제 #21
0
 /// <summary>
 /// Pulls all symbolic data sources tracked into the current snapshot.
 /// </summary>
 /// <param name="other">The snapshot to pull data sources from.</param>
 /// <returns><c>true</c> if new data sources were introduced, <c>false</c> otherwise.</returns>
 public bool MergeWith(IProgramState <SymbolicValue <TInstruction> > other)
 {
     return(Stack.MergeWith(other.Stack) | Variables.MergeWith(other.Variables));
 }
예제 #22
0
 public void SaveState(IProgramState state)
 {
     state = state.GetSubState(nameof(DelayLine <T>));
     state.Set(nameof(this.delayItems), this.delayItems);
 }
예제 #23
0
 public GameController(UserInterfaceOutputFacade outputFacade, IProgramState programState)
 {
     OutputFacade = outputFacade;
     ProgramState = programState;
 }
예제 #24
0
 public void RestoreState(IProgramState state)
 {
     state           = state.GetSubState(nameof(DelayLine <T>));
     this.delayItems = state.Get <List <DelayItem> >(nameof(this.delayItems)) ?? new List <DelayItem>();
 }
 public InitiateCommand(IProgramState state, ICommandManager commandManager)
 {
     this._state          = state ?? throw new ArgumentNullException(nameof(state));
     this._commandManager = commandManager ?? throw new ArgumentNullException(nameof(commandManager));
 }
예제 #26
0
 public QuitCommand(IProgramState programState)
 {
     this._programState = programState ?? throw new ArgumentNullException(nameof(programState));
 }