public FormMahlo(IMahloLogic logic, ISewinQueue sewinQueue, IMahloIpcClient ipcClient, IServiceSettings serviceSettings) { this.InitializeComponent(); this.logic = logic; this.sewinQueue = sewinQueue; this.ipcClient = ipcClient; this.serviceSettings = serviceSettings; this.statusBar1.StatusBarInfo = (IStatusBarInfo)this.logic; this.MahloPropertyChangedSubscription = Observable.FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>( h => ((INotifyPropertyChanged)this.logic).PropertyChanged += h, h => ((INotifyPropertyChanged)this.logic).PropertyChanged -= h) .Where(args => args.EventArgs.PropertyName == nameof(this.logic.CurrentRoll)) .Subscribe(args => { this.srcCurrentRoll.DataSource = this.logic.CurrentRoll; int nextIndex = this.sewinQueue.Rolls.IndexOf(this.logic.CurrentRoll) + 1; this.srcNextRoll.DataSource = nextIndex < this.sewinQueue.Rolls.Count ? this.sewinQueue.Rolls[nextIndex] : new GreigeRoll(); this.DataGridView1_SelectionChanged(this.dataGridView1, EventArgs.Empty); this.dataGridView1.EnsureVisibleRow(this.logic.CurrentRollIndex); this.myScrollBar1.AutoScrollPosition = this.logic.CurrentRollIndex - 2; }); // Make column heading alignment match column data alignment foreach (DataGridViewColumn column in this.dataGridView1.Columns) { column.HeaderCell.Style.Alignment = column.DefaultCellStyle.Alignment; } }
public CarpetProcessor( ISewinQueue sewinQueue, IMahloLogic mahloLogic, IBowAndSkewLogic bowAndSkewLogic, IPatternRepeatLogic patternRepeatLogic) { this.SewinQueue = sewinQueue; this.MahloLogic = mahloLogic; this.BowAndSkewLogic = bowAndSkewLogic; this.PatternRepeatLogic = patternRepeatLogic; }
public CarpetProcessor( ISewinQueue sewinQueue, IMahloLogic mahloLogic, IBowAndSkewLogic bowAndSkewLogic, IPatternRepeatLogic patternRepeatLogic, ICutRollLogic cutRollLogic, IOpcServerController opcServerController, IServiceSettings appInfo) { this.SewinQueue = sewinQueue; this.MahloLogic = mahloLogic; this.BowAndSkewLogic = bowAndSkewLogic; this.PatternRepeatLogic = patternRepeatLogic; this.CutRollLogic = cutRollLogic; this.opcServerController = opcServerController; this.appInfo = appInfo; }
public MahloServer( ILogger logger, ISewinQueue sewinQueue, CutRollList cutRolls, InspectionAreaList inspectionAreaList, IMahloLogic mahloLogic, IBowAndSkewLogic bowAndSkewLogic, IPatternRepeatLogic patternRepeatLogic, IScheduler scheduler) { this.log = logger; this.sewinQueue = sewinQueue; this.cutRolls = cutRolls; this.inspectionAreaList = inspectionAreaList; this.mahloLogic = mahloLogic; this.bowAndSkewLogic = bowAndSkewLogic; this.patternRepeatLogic = patternRepeatLogic; this.disposables = new List <IDisposable> { Observable .Interval(TimeSpan.FromMilliseconds(1000), scheduler) .Subscribe(_ => { this.UpdateMeterLogic(nameof(IMahloLogic), this.mahloLogic); this.UpdateMeterLogic(nameof(IBowAndSkewLogic), this.bowAndSkewLogic); this.UpdateMeterLogic(nameof(IPatternRepeatLogic), this.patternRepeatLogic); this.UpdateCutRollList(); this.UpdateInspectionArea(); if (this.sewinQueue.IsChanged) { this.UpdateSewinQueue(); } }), Observable .FromEvent( h => this.sewinQueue.QueueChanged += h, h => this.sewinQueue.QueueChanged -= h) .Subscribe(_ => this.UpdateSewinQueue()), }; }