/// <summary> /// 功能按钮,鼠标在控件上移动的事件,根据控件的Tag值,进行操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FuncBtn_MouseMove(object sender, MouseEventArgs e) { PictureBox pbx; int tag; if (sender is PictureBox) { pbx = (sender as PictureBox); tag = int.Parse(pbx.Tag.ToString()); switch (tag) { case 1: { pbx.Image = ImagesManage.GetImage("isolation", "start.gif"); break; } case 2: { pbx.Image = ImagesManage.GetImage("isolation", "carrier1.gif"); break; } case 3: { pbx.Image = ImagesManage.GetImage("isolation", "carrier2.gif"); break; } case 4: { pbx.Image = ImagesManage.GetImage("isolation", "freq.gif"); break; } case 5: { pbx.Image = ImagesManage.GetImage("isolation", "mark.gif"); break; } case 6: { pbx.Image = ImagesManage.GetImage("isolation", "autoscale.gif"); break; } case 7: { pbx.Image = ImagesManage.GetImage("isolation", "save.gif"); break; } case 8: { pbx.Image = ImagesManage.GetImage("isolation", "read.gif"); break; } case 9: { pbx.Image = ImagesManage.GetImage("isolation", "setting.gif"); break; } } } }
private void IsolationActive() { if (frmIsolation == null) { frmIsolation = new IsolationForm(); this.Controls.Add(frmIsolation); frmIsolation.Parent = this.pnlModule; } SetActiveModules(2); frmIsolation.pltIso.SetMarkText(frmIsolation.Sweep_MarkText); frmIsolation.pltIso.SetMarkText(frmIsolation.Fixed_MarkText); this.SuspendLayout(); LoadInactiveImages(); pbxIsolation.Image = ImagesManage.GetImage("main", "isolation.gif"); frmIsolation.Show(); HideInActiveModules(); this.ResumeLayout(true); }
private void HarActive() { if (frmHar == null) { frmHar = new HarForm(); this.Controls.Add(frmHar); frmHar.Parent = this.pnlModule; } SetActiveModules(4); frmHar.pltHar.SetMarkText(frmHar.Sweep_MarkText); frmHar.pltHar.SetMarkText(frmHar.Fixed_MarkText); this.SuspendLayout(); LoadInactiveImages(); pbxHarmonic.Image = ImagesManage.GetImage("main", "harmonic.gif"); frmHar.Show(); HideInActiveModules(); this.ResumeLayout(true); }
private void HarForm_Load(object sender, EventArgs e) { pbxFreq.Image = ImagesManage.GetImage("harmonic", "freq.gif"); pltHar.SetLimitEnalbe(true, this.settings.Limit, Color.FromArgb(160, 245, 255)); UpdateWihtNewSettings(); }
/// <summary> /// 初始化,将全部功能按钮的贴图设置为不活动的 /// </summary> private void LoadInactiveImages() { pbxPim.Image = ImagesManage.GetImage("main", "pim_in.gif"); pbxSpectrum.Image = ImagesManage.GetImage("main", "spectrum_in.gif"); pbxIsolation.Image = ImagesManage.GetImage("main", "isolation_in.gif"); pbxVswr.Image = ImagesManage.GetImage("main", "vswr_in.gif"); pbxHarmonic.Image = ImagesManage.GetImage("main", "harmonic_in.gif"); pbxCnfg.Image = ImagesManage.GetImage("main", "config_in.gif"); pbxHelp.Image = ImagesManage.GetImage("main", "lock_in.gif"); }
private void IsolationForm_Load(object sender, EventArgs e) { sweep_params = new SweepParams(); Prepare_Time_Sweep1(sweep_params); pbxFreq.Image = ImagesManage.GetImage("isolation", "freq.gif"); pltIso.SetLimitEnalbe(true, this.settings.Limit, Color.FromArgb(160, 245, 255)); UpdateWihtNewSettings(); }
private void pbxFreq_MouseClick(object sender, MouseEventArgs e) { float f_value = 0.0f; if (!Sweeping) { sweep_or_time = SweepType.Time_Sweep; pbxCarrier1.Image = ImagesManage.GetImage("harmonic", "carrier1_in.gif"); pbxCarrier2.Image = ImagesManage.GetImage("harmonic", "carrier2_in.gif"); HarFreqForm fm = new HarFreqForm(this.settings.F); if (fm.ShowDialog() == DialogResult.OK) { f_value = fm.Value; if ((f_value >= App_Settings.sgn_1.Min_Freq) && (f_value <= App_Settings.sgn_1.Max_Freq)) { settings.F = f_value; lblF.Text = "F:" + f_value.ToString("0.0") + "MHz"; float f = f_value * 2; lblSweep.Text = "Carrier1 Time Sweep (" + f.ToString("0.#") + "MHz)"; } else if ((f_value >= App_Settings.sgn_2.Min_Freq) && (f_value <= App_Settings.sgn_2.Max_Freq)) { settings.F = f_value; lblF.Text = "F:" + f_value.ToString("0.0") + "MHz"; float f = f_value * 2; lblSweep.Text = "Carrier2 Time Sweep (" + f.ToString("0.#") + "MHz)"; } else { MessageBox.Show(this, "Frequency Must In [" + App_Settings.sgn_1.Min_Freq.ToString("0.0") + "~" + App_Settings.sgn_1.Max_Freq.ToString("0.0") + "]/[" + App_Settings.sgn_2.Min_Freq.ToString("0.0") + "~" + App_Settings.sgn_2.Max_Freq.ToString("0.0") + "]"); } } else { float f = settings.F * 2; lblSweep.Text = "Carrier2 Time Sweep (" + f.ToString("0.#") + "MHz)"; } fm.Dispose(); pltHar.SetXStartStop(0, this.settings.Time_Points); } }
private void CnfgActive() { pbxCnfg.Image = ImagesManage.GetImage("main", "config.gif"); if (frmConfig == null) { frmConfig = new Config(); frmConfig.ShowDialog(); frmConfig.Dispose(); frmConfig = null; } }
/// <summary> /// 将CSV格式的报表文件读入内存,进行回放操作 /// </summary> /// <param name="csvFileName"></param> private void ReadIsoCsv(string csvFileName) { if (!csv_playbacking) { csv_playbacking = true; csv_points_playback = 0; pltIso.Clear(); CsvReport.Read_Csv_IVH(csvFileName, out csv_entries_playback, out csv_header_playback); if ((csv_entries_playback != null) && (csv_header_playback != null)) { if (csv_header_playback.Swp_Type == SweepType.Time_Sweep) { pltIso.SetMarkText(Fixed_MarkText); pbxFreq.Image = ImagesManage.GetImage("isolation", "freq.gif"); pbxCarrier1.Image = ImagesManage.GetImage("isolation", "carrier1_in.gif"); pbxCarrier2.Image = ImagesManage.GetImage("isolation", "carrier2_in.gif"); pltIso.SetXStartStop(0, csv_header_playback.Point_Num); } else { pltIso.SetMarkText(Sweep_MarkText); if ((csv_header_playback.Sweep_Start >= App_Settings.sgn_1.Min_Freq) && (csv_header_playback.Sweep_Start <= App_Settings.sgn_1.Max_Freq)) { pbxCarrier1.Image = ImagesManage.GetImage("isolation", "carrier1.gif"); pbxCarrier2.Image = ImagesManage.GetImage("isolation", "carrier2_in.gif"); pbxFreq.Image = ImagesManage.GetImage("isolation", "freq_in.gif"); } else { pbxCarrier2.Image = ImagesManage.GetImage("isolation", "carrier2.gif"); pbxCarrier1.Image = ImagesManage.GetImage("isolation", "carrier1_in.gif"); pbxFreq.Image = ImagesManage.GetImage("isolation", "freq_in.gif"); } pltIso.SetXStartStop(csv_header_playback.Sweep_Start, csv_header_playback.Sweep_Stop); } pltIso.SetYStartStop(this.settings.Min_Iso, this.settings.Max_Iso); } //启动定时器 timPlayback.Enabled = true; } }
private void pbxCarrier1_MouseClick(object sender, MouseEventArgs e) { if (!Sweeping) { rf_involved = RFInvolved.Rf_1; sweep_or_time = SweepType.Freq_Sweep; pbxCarrier2.Image = ImagesManage.GetImage("harmonic", "carrier2_in.gif"); pbxFreq.Image = ImagesManage.GetImage("harmonic", "freq_in.gif"); lblSweep.Text = "Carrier1 Frequncy Sweep"; pltHar.SetXStartStop(App_Settings.sgn_1.Min_Freq * settings.Multiplier, App_Settings.sgn_1.Max_Freq * settings.Multiplier); } }
private void pbxCarrier2_MouseClick(object sender, MouseEventArgs e) { if (!Sweeping) { rf_involved = RFInvolved.Rf_2; sweep_or_time = SweepType.Freq_Sweep; pbxCarrier1.Image = ImagesManage.GetImage("isolation", "carrier1_in.gif"); pbxFreq.Image = ImagesManage.GetImage("isolation", "freq_in.gif"); lblSweep.Text = "Carrier2 Frequncy Sweep"; pltIso.SetXStartStop(App_Settings.sgn_2.Min_Freq, App_Settings.sgn_2.Max_Freq); } }
/// <summary> /// 检测可存储设备 /// </summary> private void LoadItems() { foreach (DriveInfo drive in DriveInfo.GetDrives()) { if (drive.DriveType == DriveType.Removable) { _usbSize = drive.AvailableFreeSpace; SendToolStripMenuItem.DropDownItems.Add(drive.Name); SendToolStripMenuItem.DropDownItemClicked += new ToolStripItemClickedEventHandler(SendToolStripMenuItem_DropDownItemClicked); foreach (ToolStripItem item in SendToolStripMenuItem.DropDownItems) { item.Font = new Font("宋体", 12F); item.Image = ImagesManage.GetImage("resources", "usb.png"); } } } }
private void PimActive() { if (frmPim == null) { frmPim = new PimForm(); this.Controls.Add(frmPim); frmPim.Parent = this.pnlModule; } SetActiveModules(0); frmPim.pltPim.SetMarkText(frmPim.PimMarkText); frmPim.pltPim.SetPeakText(frmPim.PimPeakText); this.SuspendLayout(); LoadInactiveImages(); pbxPim.Image = ImagesManage.GetImage("main", "pim.gif"); frmPim.Show(); HideInActiveModules(); this.ResumeLayout(true); }
private void VswrActive() { if (frmVswr == null) { frmVswr = new VswrForm(); this.Controls.Add(frmVswr); frmVswr.Parent = this.pnlModule; } SetActiveModules(3); frmVswr.pltVswr.SetMarkText(frmVswr.VswrMarkText); this.SuspendLayout(); LoadInactiveImages(); pbxVswr.Image = ImagesManage.GetImage("main", "vswr.gif"); frmVswr.Show(); HideInActiveModules(); this.ResumeLayout(true); }
private void SpectrumActive() { if (frmSpectrum == null) { frmSpectrum = new SpectrumForm(); this.Controls.Add(frmSpectrum); frmSpectrum.Parent = this.pnlModule; } SetActiveModules(1); frmSpectrum.plot.SetMarkText(frmSpectrum.MakeupMarkText); frmSpectrum.plot.SetPeakText(frmSpectrum.MakeupPeakText); this.SuspendLayout(); LoadInactiveImages(); pbxSpectrum.Image = ImagesManage.GetImage("main", "spectrum.gif"); frmSpectrum.Show(); HideInActiveModules(); this.ResumeLayout(true); }
private void YesNoCancel_Load(object sender, EventArgs e) { pbxYesNo.Image = ImagesManage.GetImage("ico", "warning.ico"); }
/// <summary> /// 功能按钮,鼠标移出的事件,根据控件的Tag值,进行操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FuncBtn_MouseLeave(object sender, EventArgs e) { PictureBox pbx; int tag; if (sender is PictureBox) { pbx = (sender as PictureBox); tag = int.Parse(pbx.Tag.ToString()); switch (tag) { case 1: { if (!Sweeping) { pbx.Image = ImagesManage.GetImage("isolation", "start_in.gif"); } break; } case 2: { if ((sweep_or_time == SweepType.Freq_Sweep) && (rf_involved == RFInvolved.Rf_1)) { pbx.Image = ImagesManage.GetImage("isolation", "carrier1.gif"); } else { pbx.Image = ImagesManage.GetImage("isolation", "carrier1_in.gif"); } break; } case 3: { if ((sweep_or_time == SweepType.Freq_Sweep) && (rf_involved == RFInvolved.Rf_2)) { pbx.Image = ImagesManage.GetImage("isolation", "carrier2.gif"); } else { pbx.Image = ImagesManage.GetImage("isolation", "carrier2_in.gif"); } break; } case 4: { if (sweep_or_time == SweepType.Time_Sweep) { pbx.Image = ImagesManage.GetImage("isolation", "freq.gif"); } else { pbx.Image = ImagesManage.GetImage("isolation", "freq_in.gif"); } break; } case 5: { if (!MarkVisible) { pbx.Image = ImagesManage.GetImage("isolation", "mark_in.gif"); } break; } case 6: { if (!AutoscaleEnable) { pbx.Image = ImagesManage.GetImage("isolation", "autoscale_in.gif"); } break; } case 7: { pbx.Image = ImagesManage.GetImage("isolation", "save_in.gif"); break; } case 8: { pbx.Image = ImagesManage.GetImage("isolation", "read_in.gif"); break; } case 9: { pbx.Image = ImagesManage.GetImage("isolation", "setting_in.gif"); break; } } } }
protected override void WndProc(ref Message m) { switch (m.Msg) { //完成一趟操作 case MessageID.ISO_SWEEP_DONE: { Sweeping = false; pbxStart.Image = ImagesManage.GetImage("isolation", "start_in.gif"); break; } //完成单点扫描 case MessageID.ISO_SUCCED: { SweepProcessing(); break; } //功放操作错误 case MessageID.RF_ERROR: { SweepObj.CloneReference(ref ps1, ref ps2, ref sr, ref rfr_errors1, ref rfr_errors2); MessageBox.Show(this, rfr_errors1.ToString() + "\n\r" + rfr_errors2.ToString()); BreakSweep(1000); break; } //频谱分析错误 case MessageID.SPECTRUM_ERROR: { MessageBox.Show(this, "Spectrum analysis failed. It may be caused by the spectrum device does not connect or scanning failed!"); BreakSweep(1000); break; } //频谱分析成功 case MessageID.SPECTRUEME_SUCCED: { SweepObj.Spectrum_Succed(); break; } //功放操作成功 case MessageID.RF_SUCCED_ALL: { if (m.WParam.ToInt32() == App_Configure.Cnfgs.ComAddr1) { SweepObj.Power1_Succed(); } else if (m.WParam.ToInt32() == App_Configure.Cnfgs.ComAddr2) { SweepObj.Power2_Succed(); } break; } default: { base.WndProc(ref m); break; } } }
/// <summary> /// 使用扫描参数对象,启动隔离度分析 /// </summary> /// <param name="sweepParams"></param> private void StartSweep() { bool power_too_large = false; if ((!Sweeping) && (!csv_playbacking)) { Sweeping = true; MarkVisible = false; AutoscaleEnable = false; PointsDone = 0; csv_points_playback = 0; pbxStart.Image = ImagesManage.GetImage("isolation", "start.gif"); pbxMark.Image = ImagesManage.GetImage("isolation", "mark_in.gif"); pbxAutoscale.Image = ImagesManage.GetImage("isolation", "autoscale_in.gif"); pltIso.Clear(); pltIso.SetYStartStop(this.settings.Min_Iso, this.settings.Max_Iso); sweep_params = new SweepParams(); //准备扫描参数,并启动扫描 if (sweep_or_time == SweepType.Freq_Sweep) { pltIso.SetMarkText(Sweep_MarkText); if (rf_involved == RFInvolved.Rf_1) { pbxCarrier1.Image = ImagesManage.GetImage("isolation", "carrier1.gif"); pbxCarrier2.Image = ImagesManage.GetImage("isolation", "carrier2_in.gif"); pbxFreq.Image = ImagesManage.GetImage("isolation", "freq_in.gif"); if (!IsoSettingForm.bEnableCAL_RF1) { MessageBox.Show(this, "Please calibrate carrier 1!"); pbxStart.Image = ImagesManage.GetImage("isolation", "start_in.gif"); Sweeping = false; return; } pltIso.SetXStartStop(App_Settings.sgn_1.Min_Freq, App_Settings.sgn_1.Max_Freq); if (this.settings.Tx > App_Settings.sgn_1.Max_Power || this.settings.Tx < App_Settings.sgn_1.Min_Power) { power_too_large = true; } Prepare_Freq_Sweep1(sweep_params); //for (int i = 0; i < sweep_params.FrqParam.Items1.Length; i++) //if (sweep_params.FrqParam.Items1[i].P1 > App_Settings.sgn_1.Max_Power) //{ // power_too_large = true; // break; //} } else { if (!IsoSettingForm.bEnableCAL_RF2) { MessageBox.Show(this, "Please calibrate carrier 2!"); pbxStart.Image = ImagesManage.GetImage("isolation", "start_in.gif"); Sweeping = false; return; } pbxCarrier2.Image = ImagesManage.GetImage("isolation", "carrier2.gif"); pbxCarrier1.Image = ImagesManage.GetImage("isolation", "carrier1_in.gif"); pbxFreq.Image = ImagesManage.GetImage("isolation", "freq_in.gif"); pltIso.SetXStartStop(App_Settings.sgn_2.Min_Freq, App_Settings.sgn_2.Max_Freq); if (this.settings.Tx > App_Settings.sgn_2.Max_Power || this.settings.Tx < App_Settings.sgn_2.Min_Power) { power_too_large = true; } Prepare_Freq_Sweep2(sweep_params); //for (int i = 0; i < sweep_params.FrqParam.Items2.Length; i++) //if (sweep_params.FrqParam.Items2[i].P2 > App_Settings.sgn_2.Max_Power) //{ // power_too_large = true; // break; //} } } else { pltIso.SetMarkText(Fixed_MarkText); pbxFreq.Image = ImagesManage.GetImage("isolation", "freq.gif"); pbxCarrier1.Image = ImagesManage.GetImage("isolation", "carrier1_in.gif"); pbxCarrier2.Image = ImagesManage.GetImage("isolation", "carrier2_in.gif"); //pltIso.SetXStartStop(0, (this.settings.Time_Points - 1)); pltIso.SetXStartStop(0, (this.settings.Time_Points)); if ((this.settings.F >= App_Settings.sgn_1.Min_Freq) && (this.settings.F <= App_Settings.sgn_1.Max_Freq)) { if (!IsoSettingForm.bEnableCAL_RF1) { MessageBox.Show(this, "Please calibrate carrier 1!"); pbxStart.Image = ImagesManage.GetImage("isolation", "start_in.gif"); Sweeping = false; return; } rf_involved = RFInvolved.Rf_1; } else { if (!IsoSettingForm.bEnableCAL_RF2) { MessageBox.Show(this, "Please calibrate carrier 2!"); pbxStart.Image = ImagesManage.GetImage("isolation", "start_in.gif"); Sweeping = false; return; } rf_involved = RFInvolved.Rf_2; } if (rf_involved == RFInvolved.Rf_1) { if (this.settings.Tx > App_Settings.sgn_1.Max_Power || this.settings.Tx < App_Settings.sgn_1.Min_Power) { power_too_large = true; } Prepare_Time_Sweep1(sweep_params); //if (sweep_params.TmeParam.P1 > App_Settings.sgn_1.Max_Power) // power_too_large = true; } else { if (this.settings.Tx > App_Settings.sgn_2.Max_Power || this.settings.Tx < App_Settings.sgn_2.Min_Power) { power_too_large = true; } Prepare_Time_Sweep2(sweep_params); //if (sweep_params.TmeParam.P2 > App_Settings.sgn_2.Max_Power) // power_too_large = true; } } if (power_too_large) { Sweeping = false; MessageBox.Show(this, "The carrier power setup is out of its range!"); } else { SweepObj.InitSweep(); SweepObj.Prepare(sweep_params); SweepObj.StartSweep(); } } }
private void Error_Load(object sender, EventArgs e) { pbxError.Image = ImagesManage.GetImage("ico", "error.ico"); }
private void Demo_Load(object sender, EventArgs e) { picX.Image = ImagesManage.GetImage("ico", "x.gif"); this.txtBox.Text = _value; sb = new StringBuilder(); }
private void OkCancel_Load(object sender, EventArgs e) { pbxOkCancel.Image = ImagesManage.GetImage("ico", "info.ico"); }
private void YesNo_Load(object sender, EventArgs e) { picBox.Image = ImagesManage.GetImage("ico", "warning.ico"); }