private void btnMerge_Click(object sender, RoutedEventArgs e) { if (!Directory.Exists(dirPath)) { WinMessageBox.Show("请选择一个有效的文件夹"); return; } if (ExcelHelper.GetAvailableExcelCount(dirPath) == 0) { WinMessageBox.Show("当前文件夹中没有Excel文件"); return; } Merger.Instance.Start(dirPath);//合并开始 }
/// <summary> /// 显示对话框 /// </summary> /// <param name="content">内容</param> /// <param name="owner">父窗体</param> public static void Show(string content, Window owner = null) { WinMessageBox winMessage = new WinMessageBox(content); if (owner != null) { winMessage.Owner = owner; winMessage.WindowStartupLocation = WindowStartupLocation.CenterOwner; } else { if (Application.Current.MainWindow != null) { winMessage.Owner = Application.Current.MainWindow; winMessage.WindowStartupLocation = WindowStartupLocation.CenterOwner; } else { winMessage.WindowStartupLocation = WindowStartupLocation.CenterScreen; } } winMessage.ShowDialog(); }
/// <summary> /// 显示错误一旦发生 /// </summary> /// <param name="error"></param> private void ShowError(string error) { WinMessageBox.Show(error); }