Ejemplo n.º 1
0
        private void InitInstrument()
        {
            //初始化控件信息
            foreach (InstrumentInfo instrumnet in InstrumentInfoList.getInstence())
            {
                System.Windows.Data.Binding bd = new System.Windows.Data.Binding("DevInfoState");
                bd.Mode = BindingMode.TwoWay;
                System.Windows.Data.Binding bdEnable = new System.Windows.Data.Binding("Enabled");
                bdEnable.Mode = BindingMode.TwoWay;

                //
                if (instrumnet.InstrumentTypeID == InstrumentType.SignalSource)
                {
                    this.SG.instrument = instrumnet;
                    this.SG.SetBinding(imageControl.DevEnableProperty, bdEnable);
                    this.SG.SetBinding(imageControl.DevStateProperty, bd);

                    this.SG.DataContext = instrumnet;
                }
                //频谱仪
                if (instrumnet.InstrumentTypeID == InstrumentType.SA)
                {
                    this.PXA.instrument = instrumnet;
                    this.PXA.SetBinding(imageControl.DevEnableProperty, bdEnable);
                    this.PXA.SetBinding(imageControl.DevStateProperty, bd);

                    this.PXA.DataContext = instrumnet;
                }
            }
            DutInfo = InstrumentInfoList.getInstence().GetInstrument("RackSys.TestLab.Instrument.DUT", "1");
            //this.cmbPort.ItemsSource = new List<string>()
            //{
            //    "COM1"
            //};
        }
Ejemplo n.º 2
0
        public void ReqQryInstrument()
        {
            bIsLast = false;
            InstrumentInfoList.Clear();

            foreach (var api in XApiList)
            {
                api.ReqQryInstrument("", "");
            }
        }
Ejemplo n.º 3
0
        public void ReqQryInstrument()
        {
            bIsLast = false;
            InstrumentInfoList.Clear();

            foreach (var api in XApiList)
            {
                ReqQueryField query = default(ReqQueryField);
                api.ReqQuery(QueryType.ReqQryInstrument, ref query);
            }
        }
Ejemplo n.º 4
0
        private void OnRspQryInstrument(object sender, ref InstrumentField instrument, int size1, bool bIsLast)
        {
            if (size1 > 0)
            {
                InstrumentInfoList.Add(new InstrumentInfo()
                {
                    Symbol     = instrument.Symbol,
                    Instrument = instrument.InstrumentID,
                    Exchange   = instrument.ExchangeID,
                    TickSize   = instrument.PriceTick,
                    Factor     = instrument.VolumeMultiple
                });
            }

            this.bIsLast = bIsLast;
        }
Ejemplo n.º 5
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Id.GetHashCode();
         result = (result * 397) ^ FilePath.GetHashCode();
         result = (result * 397) ^ (FileWriteTime.HasValue ? FileWriteTime.Value.GetHashCode() : 0);
         result = (result * 397) ^ (RunStartTime.HasValue ? RunStartTime.Value.GetHashCode() : 0);
         result = (result * 397) ^
                  (InstrumentInfoList != null ? InstrumentInfoList.GetHashCodeDeep() : 0);
         result = (result * 397) ^
                  (RetentionTimeAlignments == null ? 0 : RetentionTimeAlignments.GetHashCodeDeep());
         result = (result * 397) ^ MaxIntensity.GetHashCode();
         result = (result * 397) ^ MaxRetentionTime.GetHashCode();
         return(result);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 应用
        /// </summary>
        private void btnApply_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtDevName.Text.Trim()))
            {
                MessageBox.Show("已更新设备名称为空,请先添写设备名称!", "提示消息", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            else
            {
                var snList = (from q in InstrumentInfoList.getInstence()
                              where q != this.instrumentInfo &&
                              (q.InstrumentTypeID == InstrumentType.DCPower || q.InstrumentTypeID == InstrumentType.DCPowerAnalyzer)
                              select q.InstrumentName).ToList();
                if (snList != null && snList.Contains(this.txtDevName.Text))
                {
                    MessageBox.Show("电源名称不能相同,请修改!", "提示消息", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
            }
            if (!string.IsNullOrEmpty(this.txtInnerNum.Text.Trim()))
            {
                var snList = (from q in InstrumentInfoList.getInstence()
                              where q != this.instrumentInfo
                              select q.IDInInstitute).ToList();
                if (snList != null && snList.Contains(this.txtInnerNum.Text))
                {
                    if (MessageBox.Show("当前输入的所内编号已存在,是否强制修改?", "提示消息", MessageBoxButton.OKCancel, MessageBoxImage.Information)
                        == MessageBoxResult.OK)
                    {
                        SaveChange();
                        instrumentAddress.IsApply = false;
                    }
                    else
                    {
                        return;
                    }
                }
            }

            SaveChange();
            instrumentAddress.IsApply = false;
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 保存
 /// </summary>
 protected void SaveChange()
 {
     IsOk = true;
     this.instrumentInfo.IpAddress = txtVisaAddr.Text;
     if (!string.IsNullOrEmpty(this.txtInnerNum.Text))
     {
         this.instrumentInfo.IDInInstitute = this.txtInnerNum.Text;
     }
     else
     {
         this.instrumentInfo.IDInInstitute = "";
     }
     if (!string.IsNullOrEmpty(this.txtDevName.Text.ToString()) && this.txtDevName.Text.ToString() != this.instrumentInfo.InstrumentName)
     {
         this.instrumentInfo.InstrumentName = this.txtDevName.Text.Trim();
     }
     if (!string.IsNullOrEmpty(this.txtChanneNum.Text))
     {
         this.instrumentInfo.DCModleNum = Convert.ToInt32(this.txtChanneNum.Text.Trim());
     }
     InstrumentInfoList.getInstence().SaveParameterToXMLFile();
     ///巡检,以初始化设备信息
     SystemHardware.SysHardware.CreateInstrumentInstanceByInstrumentType(this.instrumentInfo.InstrumentTypeID);
 }
Ejemplo n.º 8
0
 // 可用于定时订阅
 public void ReSubscribe()
 {
     Log.Info("重新订阅:{0}", InstrumentInfoList.Count());
     Unsubscribe(InstrumentInfoList);
     Subscribe(InstrumentInfoList);
 }