示例#1
0
        /// <summary>
        /// 绑定实时数据,更新生产数据到界面
        /// </summary>
        public override void StartLoadingData()
        {
            ApplicationStateManager.RecoveryMachineState(this);
            ApplicationStateManager.ClearApplicationStatePath();

            if (ProductionInfo == null)
            {
                ProductionInfo =
                    OnlineDataCenter.GetMachineProductionInfo(MachineName);
                if (ProductionInfo == null)
                {
                    MessageBox.Show("配置的机台名称与数据库中的不一致!",
                                    "错误提示", MessageBoxButton.OK, MessageBoxImage.Error);
                    System.Environment.Exit(0);
                }
            }
            else
            {
                OnlineDataCenter.SetMachineProductionInfo(ProductionInfo);
            }

            odChart.Upper = Configuration.OuterDiameterUpper;
            odChart.Lower = Configuration.OuterDiameterLower;

            // 绑定数据源对象
            rootGrid.DataContext = ProductionInfo;

            ProductionInfo.PdfService.ChangeProductionProcessPdf
                += PdfService_ChangeProductionProcessPdf;
            ProductionInfo.DoublePropertyChanged += cpi_DoublePropertyChanged;

            AppEventsManager.OnUpdateOuterDiameterUpperAndLower +=
                AppEventsManager_OnUpdateOuterDiameterUpperAndLower;

            // 重新加载工艺规格文件
            if (!string.IsNullOrEmpty(WorksheetNo))
            {
                Task.Run(() => {
                    updateWorkSheetInfo(WorksheetNo.Trim());
                });
            }
        }