You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

60 lines
1.9 KiB

using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
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.Shapes;
namespace formula_manage.EX
{
/// <summary>
/// Exchange.xaml 的交互逻辑
/// </summary>
public partial class Exchange : Window
{
string Log_time = DateTime.Now.ToString("yyyy-MM-dd");
DataTable logdataTable = new DataTable(); //建立log缓存
public Exchange()
{
InitializeComponent();
logdataTable.Columns.Add("Name", typeof(string));
logdataTable.Columns.Add("Length", typeof(int));
LOG_file();
}
private void LOG_file()//建立列表
{
DirectoryInfo loginfo = new DirectoryInfo(System.Environment.CurrentDirectory + "\\Exchange"); //new文件夹
DataRow FileRow = logdataTable.NewRow();
foreach (var item in loginfo.GetFiles())
{
// DataRow FileRow = logdataTable.NewRow();
FileRow["Name"] = item.Name;
FileRow["Length"] = item.Length/1024;
logdataTable.Rows.Add(FileRow);
}
gridLog.ItemsSource = logdataTable.DefaultView;
// FileInfo[] logFile = loginfo.GetFiles("*.log");//生成文件夹中的文件名合集
//gridLog.ItemsSource = logFile;//加载合集
// DataRow row = logdataTable.NewRow(); //ID列
//logdataTable. =
// logFile.fill()
// //gridLog.DataContext = "Name"; // 显示文件名
// gridLog.ItemsSource = logFile;//加载合集
}
}
}