using SWS.CAD.ViewModels; using System.Diagnostics; using System.Reflection; using System; using System.Windows; using System.IO; namespace SWS.CAD.Views { /// /// Config.xaml 的交互逻辑 /// public partial class Config : Window { public Config(ConfigViewModel viewModel) { InitializeComponent(); viewModel.CloseWindowAction = this.Close; // 将关闭方法传递给 ViewModel DataContext = viewModel; } private void RadFilePathPicker_FilePathChanged(object sender, Telerik.Windows.Controls.FileDialogs.FilePathChangedEventArgs e) { if (string.IsNullOrEmpty(e.FilePath)) { this.filepath.FilePath = ""; var x = DataContext as ConfigViewModel; x.Directory = ""; } else { var x = DataContext as ConfigViewModel; x.Directory = e.FilePath; } } } }