コード例 #1
0
        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;
            }
        }
コード例 #2
0
        public MeterLogic(IMahloIpcClient ipcClient, ISewinQueue sewinQueue, IServiceSettings serviceSettings)
        {
            this.ipcClient       = ipcClient;
            this.sewinQueue      = sewinQueue;
            this.serviceSettings = serviceSettings;

            this.sewinQueueChangedSubscription = Observable
                                                 .FromEventPattern <EventHandler, EventArgs>(
                h => this.sewinQueue.Changed += h,
                h => this.sewinQueue.Changed -= h)
                                                 .Subscribe(args =>
            {
                bool indexInRange = this.CurrentRollIndex >= 0 && this.currentRollIndex < this.sewinQueue.Rolls.Count;
                this.CurrentRoll  = indexInRange ? this.sewinQueue.Rolls[this.CurrentRollIndex] : new GreigeRoll();
            });

            this.updateMeterLogicSubscription = Observable
                                                .FromEvent <Action <(string, JObject)>, (string name, JObject jObject)>(
                h => this.ipcClient.MeterLogicUpdated += h,
                h => this.ipcClient.MeterLogicUpdated -= h)
                                                .Where(tuple => tuple.name == this.InterfaceName)
                                                .Subscribe(tuple =>
            {
                tuple.jObject.Populate(this);
                this.RefreshStatusDisplay();
            });

            this.connectionStateSubscription = Observable
                                               .FromEvent <Action <string>, string>(
                h => this.ipcClient.IpcStatusMessageChanged += h,
                h => this.ipcClient.IpcStatusMessageChanged -= h)
                                               .Subscribe(message => this.ConnectionStatusMessage = message);

            this.userAttentionsSubscription = Observable
                                              .FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                h => ((INotifyPropertyChanged)this.UserAttentions).PropertyChanged += h,
                h => ((INotifyPropertyChanged)this.UserAttentions).PropertyChanged -= h)
                                              .Subscribe(args => this.OnPropertyChanged(nameof(this.UserAttentions)));

            this.criticalStopsSubscription = Observable
                                             .FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                h => ((INotifyPropertyChanged)this.CriticalStops).PropertyChanged += h,
                h => ((INotifyPropertyChanged)this.CriticalStops).PropertyChanged += h)
                                             .Subscribe(args => this.OnPropertyChanged(nameof(this.CriticalStops)));
        }
コード例 #3
0
ファイル: MahloLogic.cs プロジェクト: bradleyhanon/Mahlo2
 public MahloLogic(IMahloIpcClient ipcClient, ISewinQueue sewinQueue, IServiceSettings serviceSettings)
     : base(ipcClient, sewinQueue, serviceSettings)
 {
 }
コード例 #4
0
        public FormCoaterSchedule(IMahloIpcClient mahloClient)
        {
            this.InitializeComponent();

            this.mahloClient = mahloClient;
        }
コード例 #5
0
        public MainForm(ICarpetProcessor carpetProcessor, ICutRollList cutRollList, IInspectionAreaList inspectionAreaList, IMahloIpcClient mahloClient, IServiceSettings serviceSettings)
        {
            this.InitializeComponent();
            this.carpetProcessor          = carpetProcessor;
            this.cutRollList              = cutRollList;
            this.inspectionAreaList       = inspectionAreaList;
            this.mahloClient              = mahloClient;
            this.serviceSettings          = serviceSettings;
            this.statusBar1.StatusBarInfo = (IStatusBarInfo)this.carpetProcessor.PatternRepeatLogic;
            this.defaultCellColor         = new CellColor
            {
                ForeColor = this.grdGreigeRoll.DefaultCellStyle.ForeColor,
                BackColor = this.grdGreigeRoll.DefaultCellStyle.BackColor
            };

            this.disposables.Add(
                Observable.FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.carpetProcessor.MahloLogic).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.carpetProcessor.MahloLogic).PropertyChanged -= h)
                .Where(args => args.EventArgs.PropertyName == nameof(this.carpetProcessor.MahloLogic.CurrentRoll))
                .Subscribe(args =>
            {
                this.mahloRollSrc.DataSource = this.carpetProcessor.MahloLogic.CurrentRoll;
                this.DoAutoScroll();
                this.grdGreigeRoll.Invalidate();
            }));

            this.disposables.Add(
                Observable.FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.carpetProcessor.BowAndSkewLogic).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.carpetProcessor.BowAndSkewLogic).PropertyChanged -= h)
                .Where(args => args.EventArgs.PropertyName == nameof(this.carpetProcessor.BowAndSkewLogic.CurrentRoll))
                .Subscribe(args =>
            {
                this.bowAndSkewRollSrc.DataSource = this.carpetProcessor.BowAndSkewLogic.CurrentRoll;
                this.DoAutoScroll();
                this.grdGreigeRoll.Invalidate();
            }));

            this.disposables.Add(
                Observable.FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(
                    h => ((INotifyPropertyChanged)this.carpetProcessor.PatternRepeatLogic).PropertyChanged += h,
                    h => ((INotifyPropertyChanged)this.carpetProcessor.PatternRepeatLogic).PropertyChanged -= h)
                .Where(args => args.EventArgs.PropertyName == nameof(this.carpetProcessor.PatternRepeatLogic.CurrentRoll))
                .Subscribe(args =>
            {
                this.patternRepeatRollSrc.DataSource = this.carpetProcessor.PatternRepeatLogic.CurrentRoll;
                this.DoAutoScroll();
                this.grdGreigeRoll.Invalidate();
            }));

            // Make column heading alignment match column data alignment
            foreach (DataGridViewColumn column in this.grdGreigeRoll.Columns)
            {
                column.HeaderCell.Style.Alignment = column.DefaultCellStyle.Alignment;
            }

            foreach (DataGridViewColumn column in this.grdCutRoll.Columns)
            {
                column.HeaderCell.Style.Alignment = column.DefaultCellStyle.Alignment;
            }

            foreach (DataGridViewColumn column in this.grdInspectionArea.Columns)
            {
                column.HeaderCell.Style.Alignment = column.DefaultCellStyle.Alignment;
            }

            this.colMalFeet.Tag         =
                this.colBasFeet.Tag     =
                    this.colPrsFeet.Tag = new CellFormattingAction(this.SetFeetColor);

            this.colBow.Tag        = new CellFormattingAction(this.SetBowColor);
            this.colSkew.Tag       = new CellFormattingAction(this.SetSkewColor);
            this.colElongation.Tag = new CellFormattingAction(this.SetElongationColor);

            this.colCutBow.Tag        = new CellFormattingAction(this.SetCutBowColor);
            this.colCutSkew.Tag       = new CellFormattingAction(this.SetCutSkewColor);
            this.colCutElongation.Tag = new CellFormattingAction(this.SetCutEPEColor);
        }
コード例 #6
0
 public PatternRepeatLogic(IMahloIpcClient ipcClient, ISewinQueue sewinQueue, IServiceSettings serviceSettings)
     : base(ipcClient, sewinQueue, serviceSettings)
 {
 }