using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using 垂直剖面动态观测系统.Common; using 垂直剖面动态观测系统.Model; using Microsoft.Win32; namespace 垂直剖面动态观测系统.View { /// /// ControlPageView.xaml 的交互逻辑 /// public partial class ControlPageView : UserControl { GlobalValues model = new GlobalValues(); public ControlPageView() { InitializeComponent(); this.DataContext = model; Req_T.SelectedDate = DateTime.Now; string[] _file_name = new string[] { "JADCPL", "JOTHR-", "QADCPL", "QOTHR-", "FOTHR-", "FADCPL", "FBEIDA" }; for (int i = 0; i < _file_name.Length; i++) { this.CB.Items.Add(_file_name[i]); } } private void Button_Click(object sender, RoutedEventArgs e) { } private void button1_Click(object sender, RoutedEventArgs e) { // Create OpenFileDialog Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); // Set filter for file extension and default file extension //dlg.DefaultExt = ".txt"; //dlg.Filter = "Text documents (.txt)|*.txt"; dlg.Title = "选择文件"; dlg.Filter = "所有文件|*.*"; dlg.FileName = string.Empty; dlg.FilterIndex = 1; dlg.RestoreDirectory = true; dlg.DefaultExt = "所有文件"; // Display OpenFileDialog by calling ShowDialog method Nullable result = dlg.ShowDialog(); // Get the selected file name and display in a TextBox if (result == true) { // Open document string filename = dlg.FileName; this.FP.Text = filename; } } } }