@@ -32,6 +32,10 @@ public class MainViewModel : BaseViewModel
3232 private readonly AsyncRelayCommand _browseSecondaryFileCommand ;
3333 private readonly ConfigurationManager _configurationManager ;
3434 private readonly AsyncRelayCommand < Configuration > _deleteConfigurationCommand ;
35+ private readonly RelayCommand _clearPrimaryFileCommand ;
36+ private readonly RelayCommand _clearSecondaryFileCommand ;
37+ public ICommand ClearPrimaryFileCommand => _clearPrimaryFileCommand ;
38+ public ICommand ClearSecondaryFileCommand => _clearSecondaryFileCommand ;
3539
3640 /// <summary>
3741 /// 诊断匹配问题命令
@@ -159,6 +163,8 @@ public MainViewModel(ExcelFileManager excelFileManager, ConfigurationManager con
159163 _saveConfigurationCommand = new AsyncRelayCommand ( SaveConfigurationAsync ) ;
160164 _loadConfigurationCommand = new AsyncRelayCommand ( LoadConfigurationAsync ) ;
161165 _resetConfigurationCommand = new RelayCommand ( ResetConfiguration ) ;
166+ _clearPrimaryFileCommand = new RelayCommand ( ClearPrimaryFile ) ;
167+ _clearSecondaryFileCommand = new RelayCommand ( ClearSecondaryFile ) ;
162168
163169 _updateSelectedPrimaryMatchFieldsCommand = new RelayCommand < IList > ( UpdateSelectedPrimaryMatchFields ) ;
164170 _updateSelectedSecondaryMatchFieldsCommand = new RelayCommand < IList > ( UpdateSelectedSecondaryMatchFields ) ;
@@ -2946,6 +2952,35 @@ private void ResetConfiguration()
29462952 } ) ;
29472953 }
29482954
2955+ private void ClearPrimaryFile ( )
2956+ {
2957+ PrimaryFilePath = string . Empty ;
2958+ PrimaryFilePassword = string . Empty ;
2959+ PrimaryFile = new ExcelFile ( ) ;
2960+ PrimaryWorksheets . Clear ( ) ;
2961+ PrimaryColumns . Clear ( ) ;
2962+ SelectedPrimaryWorksheets . Clear ( ) ;
2963+ SelectedPrimaryMatchFields . Clear ( ) ;
2964+ PrimaryPreviewData = null ;
2965+ PrimaryFilters . Clear ( ) ;
2966+ StatusMessage = "已清除主表文件" ;
2967+ }
2968+
2969+ private void ClearSecondaryFile ( )
2970+ {
2971+ SecondaryFilePath = string . Empty ;
2972+ SecondaryFilePassword = string . Empty ;
2973+ SecondaryFile = new ExcelFile ( ) ;
2974+ SecondaryWorksheets . Clear ( ) ;
2975+ SecondaryColumns . Clear ( ) ;
2976+ SelectedSecondaryWorksheets . Clear ( ) ;
2977+ SelectedSecondaryMatchFields . Clear ( ) ;
2978+ SecondaryPreviewData = null ;
2979+ SecondaryFilters . Clear ( ) ;
2980+ FieldMappings . Clear ( ) ; // 清除字段映射
2981+ StatusMessage = "已清除辅助表文件" ;
2982+ }
2983+
29492984 /// <summary>
29502985 /// 从当前状态创建配置对象
29512986 /// </summary>
0 commit comments