/// <summary> /// 导航控件按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FreqNavBarButtonClick(object sender, RoutedEventArgs e) { Button btn = (Button)sender; Grid grid = (Grid)btn.Parent; FreqNavBar fnr = (FreqNavBar)grid.Parent; fnr.PlaceGuid = LoginService.CurrentActivityPlace.Guid; busyIndicator.IsBusy = true; cds.MeasureID = ((FreqCollectionIndex)lab_collectIndex.Tag).MeasureID; AnalysisFreqData(fnr, true); }
/// <summary> /// 导航条事件采集端 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NavBarGroup_Click(object sender, EventArgs e) { busyIndicator.IsBusy = true; NavBarGroup nbg = (NavBarGroup)sender; //NavBarItem nbi = (NavBarItem)nbg.Content; FreqNavBar fnr = (FreqNavBar)nbg.Items[0]; cds.MeasureID = ((FreqCollectionIndex)lab_collectIndex.Tag).MeasureID; fnr.PlaceGuid = LoginService.CurrentActivityPlace.Guid; //MessageBox.Show("点HEADER变谱图" + fnr.FreqStart + "<>" + fnr.FreqStop + "<>"+fnr.BandWidth); AnalysisFreqData(fnr, false); }
private void AnalysisFreqData(NavBarGroupCollection NavBars) { StatisticFreq sf = new StatisticFreq(); sf.fileNameList = cds.getFileNames(); sf.saveAanalysisDataDelegate = cds.saveAnalysisTable; sf.refreshAnalysisResultDelete = initDataSource; sf.refreshChartResultDelete = setChartDataSouce; sf.refreshChartFreqStatDelete = setFreqStatDataSouce; sf.reminderBoxDelegate = reminderBoxShow; sf.ShowUI = false; sf.MeasureId = cds.MeasureID; sf.freqCount = cds.getFreqCountByMeasureId(cds.MeasureID); //sf.freqNavBar = freqNavBar; string fileAddr = cds.IsHaveAnalysisData(cds.MeasureID); BackgroundWorker worker = new BackgroundWorker(); List <FreqNavBar> freqnavbarList = new List <FreqNavBar>(); for (int i = 0; i < NavBars.Count; i++) { NavBarGroup nbg = NavBars[i]; FreqNavBar fnr = (FreqNavBar)nbg.Items[0]; freqnavbarList.Add(fnr); } worker.DoWork += (o, ea) => { if ("".Equals(fileAddr)) { sf.initStatisticData(); } else { //try //{ // sf.bandWidth = Double.Parse(freqNavBar.BandWidth); //} //catch (Exception) //{ // sf.bandWidth = 100; //} sf.readAnalysisFileForAll(fileAddr, freqnavbarList); } }; worker.RunWorkerCompleted += (o, ea) => { //chart.IsEnabled = false; busyIndicator.IsBusy = false; }; worker.RunWorkerAsync(); }
/// <summary> /// 导航条事件管理端 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NavBarGroupManager_Click(object sender, EventArgs e) { //busyIndicator.IsBusy = true; NavBarGroup nbg = (NavBarGroup)sender; //NavBarItem nbi = (NavBarItem)nbg.Content; FreqNavBar fnr = (FreqNavBar)nbg.Items[0]; //cds.MeasureID = ((FreqCollectionIndex)lab_collectIndex.Tag).MeasureID; fnr.PlaceGuid = activityPlaceInfo.Guid; //MessageBox.Show("点HEADER变谱图" + fnr.FreqStart + "<>" + fnr.FreqStop + "<>"+fnr.BandWidth); //AnalysisFreqData(fnr, false); DrawChartByOraData(fnr); }
/// <summary> /// 手动添加频段 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bt_freqAdd_Click(object sender, RoutedEventArgs e) { NavBarGroup nbg = new NavBarGroup(); nbg.Click += new EventHandler(navBarClickDelegate); nbg.Header = "频率段 " + text_freqStart.Text + "--" + text_freqStop.Text + "MHz"; FreqNavBar fnb = new FreqNavBar(); fnb.FreqStart = text_freqStart.Text; fnb.FreqStop = text_freqStop.Text; fnb.reAnalysisFreqRange.Click += new RoutedEventHandler(freqNavBarButtonClickDelegate); fnb.BandWidth = text_bandWidth.Text; nbg.Items.Add(fnb); navBarControl.Groups.Add(nbg); this.Close(); }
//管理端绘制图形用oracle数据 private void DrawChartByOraData(FreqNavBar fnr) { List <AnalysisResult> analysisList = new List <AnalysisResult>(); //fnr.FreqStart = "80"; //fnr.FreqStop = "107"; //fnr.PlaceGuid = "0638536e6c5d4a358b579f94d8f170b1"; //测试 34,66,0638536e6c5d4a358b579f94d8f170b1 //PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke<I_CO_IA.FreqPlan.I_CO_IA_FreqPlan>(channel => //{ // analysisList = channel.GetAnalysisResultList(Convert.ToDouble(fnr.FreqStart), Convert.ToDouble(fnr.FreqStop), fnr.PlaceGuid); //}); analysisList = PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.FreqStation.I_CO_IA_FreqStation, List <AnalysisResult> >(channel => { return(channel.GetAnalysisResultList(Convert.ToDouble(fnr.FreqStart), Convert.ToDouble(fnr.FreqStop), fnr.PlaceGuid)); }); if (analysisList.Count > 0) { freqList = new ObservableCollection <AnalysisResult>(analysisList); initDataSource(freqList); removeBar(); foreach (AnalysisResult ar in analysisList) { if (ar.Occupy == 0) { continue; } RectangleHighlight rh = new RectangleHighlight(); rh.Bounds = new Microsoft.Research.DynamicDataDisplay.DataRect(new Rect(ar.Frequency, 0, 0, ar.Occupy)); rh.Stroke = Brushes.Yellow; rh.StrokeThickness = 10; rh.ToolTip = ar.Frequency.ToString("0.0000") + "MHz"; BarPlotter.Children.Add(rh); } BarPlotter.MainHorizontalAxis.Background = Brushes.White; BarPlotter.MainVerticalAxis.Background = Brushes.White; BarPlotter.MainHorizontalAxis.Foreground = Brushes.Orange; BarPlotter.MainVerticalAxis.Foreground = Brushes.Orange; BarPlotter.Visible = new Microsoft.Research.DynamicDataDisplay.DataRect(new Rect(Convert.ToDouble(fnr.FreqStart), 0, Convert.ToDouble(fnr.FreqStop) - Convert.ToDouble(fnr.FreqStart), 100)); } else { MessageBox.Show("未查询到分析结果数据!"); } }
/// <summary> /// 分析采集数据 /// </summary> /// <param name="freqNavBar"></param> private void AnalysisFreqData(FreqNavBar freqNavBar, bool isRefresh) { StatisticFreq sf = new StatisticFreq(); sf.fileNameList = cds.getFileNames(); sf.saveAanalysisDataDelegate = cds.saveAnalysisTable; sf.refreshAnalysisResultDelete = initDataSource; sf.refreshChartResultDelete = setChartDataSouce; sf.refreshChartFreqStatDelete = setFreqStatDataSouce; sf.reminderBoxDelegate = reminderBoxShow; sf.isRefresh = isRefresh; sf.MeasureId = cds.MeasureID; sf.freqCount = cds.getFreqCountByMeasureId(cds.MeasureID); sf.freqNavBar = freqNavBar; string fileAddr = cds.IsHaveAnalysisData(cds.MeasureID); BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += (o, ea) => { if ("".Equals(fileAddr)) { sf.initStatisticData(); } else { //sf.bandWidth = 100; try { sf.bandWidth = Double.Parse(freqNavBar.BandWidth); } catch (Exception) { sf.bandWidth = 100; } sf.readAnalysisFile(fileAddr); } }; worker.RunWorkerCompleted += (o, ea) => { //chart.IsEnabled = false; busyIndicator.IsBusy = false; }; worker.RunWorkerAsync(); //chart.IsEnabled = true; }
/// <summary> /// 导入频率规划 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_ImportFreq_Click(object sender, RoutedEventArgs e) { //List<FreqPlanSegment> freqPlanList = GetFreqPartPlan(); //List<FreqPlanActivity> freqPlanList = GetActivityFreqPlanInfoSource(LoginService.CurrentActivityPlace.Guid); List <FreqPlanSegment> freqPlanList = SQLiteDataService.QueryFreqPlanByPlaceID(LoginService.CurrentActivityPlace.Guid); //add by michael 17.07.20 if (freqPlanList != null && freqPlanList.Count > 0) { navBar.Groups.Clear();//add by michael for (int i = 0; i < freqPlanList.Count; i++) { FreqPlanSegment fps = freqPlanList[i]; NavBarGroup nbg = new NavBarGroup(); AT_BC.Data.Range <double> freqValue = fps.FreqValue; //nbg.Header = fps.FreqPlanName + " " + freqValue.Little / 1000000 + "--" + freqValue.Great / 1000000 + "MHz"; nbg.Header = fps.FreqPlanName + " " + freqValue.Little + "--" + freqValue.Great + "MHz"; FreqNavBar fnb = new FreqNavBar(); //fnb.FreqStart = (freqValue.Little / 1000000).ToString(); //fnb.FreqStop = (freqValue.Great / 1000000).ToString(); fnb.FreqStart = (freqValue.Little).ToString(); fnb.FreqStop = (freqValue.Great).ToString(); fnb.reAnalysisFreqRange.Click += new RoutedEventHandler(FreqNavBarButtonClick); //fnb.BandWidth = (Convert.ToDouble(fps.FreqBand.Split('/')[0]) / 1000).ToString(); fnb.BandWidth = (Convert.ToDouble(fps.FreqBand)).ToString(); fnb.FreqGuid = fps.FreqId; nbg.Items.Add(fnb); nbg.Click += new EventHandler(NavBarGroup_Click); nbg.IsExpanded = false; navBar.Groups.Add(nbg); } } else { MessageBox.Show("该活动区域没有频率规划!"); } }
/// <summary> /// 保存分析结果 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_saveResult_Click(object sender, RoutedEventArgs e) { var MeasureStartTime = ((FreqCollectionIndex)lab_collectIndex.Tag).StartTime; var MeasureEndTime = ((FreqCollectionIndex)lab_collectIndex.Tag).EndTime; BackgroundWorker worker = new BackgroundWorker(); if (navBar.Groups.Count == 0) { MessageBox.Show("没有需要保存的数据!"); return; } List <ObservableCollection <AnalysisResult> > freqnavbarList = new List <ObservableCollection <AnalysisResult> >(); for (int i = 0; i < navBar.Groups.Count; i++) { NavBarGroup nbg = navBar.Groups[i]; FreqNavBar fnr = (FreqNavBar)nbg.Items[0]; if (fnr.freqList != null && fnr.freqList.Count > 0) { freqnavbarList.Add(fnr.freqList); } } if (freqnavbarList.Count == 0) { MessageBox.Show("没有需要保存的数据!"); return; } busyIndicator.IsBusy = true; worker.DoWork += (o, ea) => { try { SQLiteDataService.Transaction = SQLiteConnect.GetSQLiteTransaction(LoginService.CurrentActivity.Name); for (int i = 0; i < freqnavbarList.Count; i++) { ObservableCollection <AnalysisResult> freqs = freqnavbarList[i]; if (freqs != null && freqs.Count > 0) { for (int j = 0; j < freqs.Count; j++) { AnalysisResult temp = freqs[j]; temp.MeasureStartTime = MeasureStartTime; temp.MeasureEndTime = MeasureEndTime; temp.PlaceGuid = LoginService.CurrentActivityPlace.Guid; SQLiteDataService.SaveAnalysisResult(temp); } } } SQLiteDataService.Transaction.Commit(); MessageBox.Show("数据保存成功"); } catch (Exception ex) { SQLiteDataService.Transaction.Rollback(); MessageBox.Show(ex.Message); } //if (freqList != null && freqList.Count > 0) //{ // try // { // SQLiteDataService.Transaction = SQLiteConnect.GetSQLiteTransaction(LoginService.CurrentActivity.Name); // for (int i = 0; i < freqList.Count; i++) // { // AnalysisResult temp = freqList[i]; // temp.MeasureStartTime = MeasureStartTime; // temp.MeasureEndTime = MeasureEndTime; // temp.PlaceGuid = LoginService.CurrentActivityPlace.Guid; // SQLiteDataService.SaveAnalysisResult(temp); // } // SQLiteDataService.Transaction.Commit(); // MessageBox.Show("数据保存成功"); // } // catch (Exception ex) // { // SQLiteDataService.Transaction.Rollback(); // MessageBox.Show(ex.Message); // } //} //else //{ // MessageBox.Show("没有需要保存的数据!"); //} }; worker.RunWorkerCompleted += (o, ea) => { busyIndicator.IsBusy = false; }; worker.RunWorkerAsync(); }
/// <summary> /// 管理端自动填充频率规划列表 /// </summary> private void fillNavGroupDataSouce() { //List<FreqPlanActivity> freqPlanList = GetActivityFreqPlanInfoSource(activityPlaceInfo.Guid); //if (freqPlanList.Count > 0) //{ // for (int i = 0; i < freqPlanList.Count; i++) // { // FreqPlanSegment fps = freqPlanList[i]; // NavBarGroup nbg = new NavBarGroup(); // AT_BC.Data.Range<double> freqValue = fps.FreqValue; // //nbg.Header = fps.FreqPlanName + " " + freqValue.Little / 1000000 + "--" + freqValue.Great / 1000000 + "MHz"; // nbg.Header = fps.FreqPlanName; // FreqNavBar fnb = new FreqNavBar(); // fnb.FreqStart = (freqValue.Little / 1000000).ToString(); // fnb.FreqStop = (freqValue.Great / 1000000).ToString(); // //fnb.text_FreqStart.Text = (freqValue.Little / 1000000).ToString(); // //fnb.text_FreqStop.Text = (freqValue.Great / 1000000).ToString(); // //fnb.text_BandWidth.Text = (Convert.ToDouble(fps.FreqBand.Split('/')[0]) / 1000).ToString(); // fnb.reAnalysisFreqRange.Visibility = System.Windows.Visibility.Collapsed; // fnb.delete_freqNavBar.Visibility = System.Windows.Visibility.Collapsed; // fnb.BandWidth = (Convert.ToDouble(fps.FreqBand.Split('/')[0]) / 1000).ToString(); // fnb.DataContext = fnb; // nbg.Items.Add(fnb); // nbg.Click += new EventHandler(NavBarGroupManager_Click); // nbg.IsExpanded = false; // navBar.Groups.Add(nbg); // } //} //else //{ // //NavBarGroup nbg = new NavBarGroup(); // //nbg.Header = "80--107 MHz"; // //FreqNavBar fnb = new FreqNavBar(); // //fnb.text_FreqStart.Text = "80"; // //fnb.text_FreqStop.Text = "107"; // //fnb.text_BandWidth.Text = "100"; // //fnb.reAnalysisFreqRange.Visibility = System.Windows.Visibility.Collapsed; // //fnb.delete_freqNavBar.Visibility = System.Windows.Visibility.Collapsed; // //fnb.MeasureId = "Measure20160830162310"; // //nbg.Items.Add(fnb); // //nbg.Click += new EventHandler(NavBarGroupManager_Click); // //nbg.IsExpanded = false; // //navBar.Groups.Add(nbg); // //NavBarGroup nbg1 = new NavBarGroup(); // //nbg1.Header = "80--120 MHz"; // //FreqNavBar fnb1 = new FreqNavBar(); // //fnb1.text_FreqStart.Text = "80"; // //fnb1.text_FreqStop.Text = "107"; // //fnb1.text_BandWidth.Text = "100"; // //fnb1.reAnalysisFreqRange.Visibility = System.Windows.Visibility.Collapsed; // //fnb1.delete_freqNavBar.Visibility = System.Windows.Visibility.Collapsed; // //fnb1.MeasureId = "Measure20160830162310"; // //nbg1.Items.Add(fnb1); // //nbg1.Click += new EventHandler(NavBarGroupManager_Click); // //nbg1.IsExpanded = false; // //navBar.Groups.Add(nbg1); //} PlaceFreqPlan[] freqPlanList = GetActivityFreqPlanInfoSource(activityPlaceInfo.Guid); if (freqPlanList.Length > 0) { for (int i = 0; i < freqPlanList.Length; i++) { PlaceFreqPlan fps = freqPlanList[i]; NavBarGroup nbg = new NavBarGroup(); //AT_BC.Data.Range<double> freqValue = fps.FreqValue; //nbg.Header = fps.FreqPlanName + " " + freqValue.Little / 1000000 + "--" + freqValue.Great / 1000000 + "MHz"; nbg.Header = fps.Name; FreqNavBar fnb = new FreqNavBar(); fnb.FreqStart = fps.MHzFreqFrom.ToString(); fnb.FreqStop = fps.MHzFreqTo.ToString(); //fnb.text_FreqStart.Text = (freqValue.Little / 1000000).ToString(); //fnb.text_FreqStop.Text = (freqValue.Great / 1000000).ToString(); //fnb.text_BandWidth.Text = (Convert.ToDouble(fps.FreqBand.Split('/')[0]) / 1000).ToString(); fnb.reAnalysisFreqRange.Visibility = System.Windows.Visibility.Collapsed; fnb.delete_freqNavBar.Visibility = System.Windows.Visibility.Collapsed; fnb.BandWidth = fps.kHzBand.ToString(); fnb.DataContext = fnb; nbg.Items.Add(fnb); nbg.Click += new EventHandler(NavBarGroupManager_Click); nbg.IsExpanded = false; navBar.Groups.Add(nbg); } } else { //NavBarGroup nbg = new NavBarGroup(); //nbg.Header = "80--107 MHz"; //FreqNavBar fnb = new FreqNavBar(); //fnb.text_FreqStart.Text = "80"; //fnb.text_FreqStop.Text = "107"; //fnb.text_BandWidth.Text = "100"; //fnb.reAnalysisFreqRange.Visibility = System.Windows.Visibility.Collapsed; //fnb.delete_freqNavBar.Visibility = System.Windows.Visibility.Collapsed; //fnb.MeasureId = "Measure20160830162310"; //nbg.Items.Add(fnb); //nbg.Click += new EventHandler(NavBarGroupManager_Click); //nbg.IsExpanded = false; //navBar.Groups.Add(nbg); //NavBarGroup nbg1 = new NavBarGroup(); //nbg1.Header = "80--120 MHz"; //FreqNavBar fnb1 = new FreqNavBar(); //fnb1.text_FreqStart.Text = "80"; //fnb1.text_FreqStop.Text = "107"; //fnb1.text_BandWidth.Text = "100"; //fnb1.reAnalysisFreqRange.Visibility = System.Windows.Visibility.Collapsed; //fnb1.delete_freqNavBar.Visibility = System.Windows.Visibility.Collapsed; //fnb1.MeasureId = "Measure20160830162310"; //nbg1.Items.Add(fnb1); //nbg1.Click += new EventHandler(NavBarGroupManager_Click); //nbg1.IsExpanded = false; //navBar.Groups.Add(nbg1); } }