Пример #1
0
        private PhotoelectricParaManager photo = new PhotoelectricParaManager();//光电数据库实例

        public PhotoelectricMaintenance()
        {
            InitializeComponent();
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            DriftCompensationAngle dca  = new DriftCompensationAngle();
            PhotoelectricParas     data = photo.GetPhotoelectricParas();//数据库查询光电参数

            dca.azimuth1 = data.AzimuthGyroCompensation.ToString();
            dca.pitch1   = data.PitchgGyroCompensation.ToString();
            dca.azimuth2 = data.AzimuthDriverCompensation.ToString();
            dca.pitch2   = data.PitchDriveCompensation.ToString();
            dca.height   = data.SetHeight.ToString();
            DataContext  = dca;
        }
Пример #2
0
        private void comfirmClick(object sender, RoutedEventArgs e)//确定
        {
            try
            {
                if (int.Parse(Azimuth1.Text) > rule1.Max || int.Parse(Azimuth1.Text) < rule1.Min ||
                    int.Parse(Pitch1.Text) > rule2.Max || int.Parse(Pitch1.Text) < rule2.Min ||
                    int.Parse(Azimuth2.Text) > rule3.Max || int.Parse(Azimuth2.Text) < rule3.Min ||
                    int.Parse(Pitch2.Text) > rule4.Max || int.Parse(Pitch2.Text) < rule4.Min ||
                    float.Parse(Height.Text) > rule5.Max || float.Parse(Height.Text) < rule5.Min)
                {
                    MessageBoxX.Show("提示", "数据超出范围!");
                }
                else
                {
                    MonitoringX.azimuthgyroDriveDriftCompensate(int.Parse(Azimuth1.Text));
                    MonitoringX.pitchgyroDriveDriftCompensate(int.Parse(Pitch1.Text));
                    MonitoringX.AzimuthDriveDriftCompensate(int.Parse(Azimuth2.Text));
                    MonitoringX.PitchDriveDriftCompensate(int.Parse(Pitch2.Text));

                    PhotoelectricParas data = new PhotoelectricParas();
                    data.AzimuthDriverCompensation = int.Parse(Azimuth2.Text);
                    data.PitchDriveCompensation    = int.Parse(Pitch2.Text);
                    data.AzimuthGyroCompensation   = int.Parse(Azimuth1.Text);
                    data.PitchgGyroCompensation    = int.Parse(Pitch1.Text);
                    data.SetHeight          = float.Parse(Height.Text);
                    MonitoringX.photoHeight = float.Parse(Height.Text);

                    photo.UpdatePhotoelectricPara(data);
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBoxX.Show("警告", "存在非法或为空的数据!");
            }
        }