private void btnExport_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show("确定导出批量配置参数?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.Cancel) { return; } if (txtExportFile.Text == "") { Microsoft.Win32.SaveFileDialog SaveFileDialog = new Microsoft.Win32.SaveFileDialog(); SaveFileDialog.Filter = "Text File(*.txt)|*.txt|All files(*.*)|*.*"; SaveFileDialog.AddExtension = true; SaveFileDialog.RestoreDirectory = true; if ((bool)SaveFileDialog.ShowDialog()) { try { txtExportFile.Text = SaveFileDialog.FileName; if (SaveFileDialog.FileName != null && SaveFileDialog.FileName != "") { JsonInterFace.BatchConfigurationOutputParameter.LocalDir = SaveFileDialog.FileName; if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.BatchConfigurationInfoRequest(new FileInfo(JsonInterFace.BatchConfigurationOutputParameter.LocalDir).Name)); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "提示", MessageBoxButton.OK, MessageBoxImage.Warning); } } } else { try { JsonInterFace.BatchConfigurationOutputParameter.LocalDir = txtExportFile.Text; if (NetWorkClient.ControllerServer.Connected) { NetWorkClient.ControllerServer.Send(JsonInterFace.BatchConfigurationInfoRequest(new FileInfo(JsonInterFace.BatchConfigurationOutputParameter.LocalDir).Name)); } } catch (Exception ex) { MessageBox.Show(ex.Message, "提示", MessageBoxButton.OK, MessageBoxImage.Warning); } } }