private void Btn_export2_Click(object sender, RoutedEventArgs e) { if (RadioButtonZL.IsChecked == true) { ZLPage zlPage = new ZLPage(); zlPage = (ZLPage)frame.Content; if (zlPage.DisplayInstructValues.Items.Count > 0) { //ExportExcel.ExportDataGridSaveAs(true, zlPage.DisplayInstructValues); //此方法打开会报异常 DataGridRow rowContainer = (DataGridRow)zlPage.DisplayInstructValues.ItemContainerGenerator.ContainerFromIndex(0); ExportToExcel2.EE(zlPage.DisplayInstructValues, "指令查询数据结果", "制表时间:" + DateTime.Now.ToString()); } else { MessageBox.Show("没有数据!"); } } else if (RadioButtonYC.IsChecked == true) { YCPage ycPage = new YCPage(); ycPage = (YCPage)frame.Content; if (ycPage.DisplayValues.Items.Count > 0) { // ExportExcel.ExportDataGridSaveAs(true, ycPage.DisplayValues);//此方法打开会报异常 DataGridRow rowContainer = (DataGridRow)ycPage.DisplayValues.ItemContainerGenerator.ContainerFromIndex(0); ExportToExcel2.EE(ycPage.DisplayValues, "遥测查询数据结果", "制表时间:" + DateTime.Now.ToString()); } else { MessageBox.Show("没有数据!"); } } else { MessageBox.Show("无法保存"); } //ExportToExcel2 testExcel = new ExportToExcel2(); //testExcel.Export(this.DATA_GRIDpp, "rrr"); }
private void BtnSeek_Click(object sender, RoutedEventArgs e) { string whichPara = null; List <BsonDocument> temp = new List <BsonDocument>(); //if (string.IsNullOrEmpty(tBPara.Text)) if (string.IsNullOrEmpty(ComboxPara.Text)) { //MessageBox.Show("请输入查询信息!"); MessageBox.Show("请选择查询信息!"); return; } else if (RadioButtonZL.IsChecked == false && RadioButtonYC.IsChecked == false) { // MessageBox.Show("请选择参数信息!"); MessageBox.Show("请选择查询信息!"); return; } if (RadioButtonYC.IsChecked == true) { whichPara = "RadioButtonYC".ToString(); YCPage yCPage = new YCPage(); frame.Content = yCPage; yCPage.ParentWindow = this; yCPage.GetTelemetryData(); //为遥测数据page赋值 } else if (RadioButtonZL.IsChecked == true) { whichPara = "RadioButtonZL".ToString(); ZLPage zlPage = new ZLPage(); frame.Content = zlPage; zlPage.ParentWindow = this; //指定父级窗口 zlPage.GetInstructionData(whichPara); //为遥测数据page赋值 } }