private void MainForm_Load(object sender, EventArgs e)
{
CommonInfo.TaskName = "版权查询";
CommonInfo.MasterDatabaseName = "Master.db";
CommonInfo.LogDatabaseName = "AppCommon.db";
CommonInfo.DatabasePath = Environment.CurrentDirectory + "\\数据库\\";
CommonInfo.MasterDbSQLPath = Environment.CurrentDirectory + "\\RunTime\\AppSQL\\MasterSQL";
CommonInfo.LogDbSQLPath = Environment.CurrentDirectory + "\\RunTime\\AppSQL\\LogSQL";
CommonHelp.CreateDataBase(); //新建数据库
CommonInfo.SetDefaultConfig(); //设置各个控件的初始值
gridControl2.DataSource= ReadConfig();//数据出不来
gridView1.BestFitColumns();
viewPager1.FillData();
gridControl3.DataSource = viewPager1.DataSource;
//BindSystemInfo();
welcomeLable.Text = @"欢迎使用本工具:" + CommonInfo.TaskName;
this.Text = CommonInfo.TaskName;
//去标题的图片和文字
gridView1.OptionsView.ShowGroupPanel = false;
gridView2.OptionsView.ShowGroupPanel = false;
gridView3.OptionsView.ShowGroupPanel = false;
//DevExpress.XtraTab.XtraTabPage tabPage = xtraTabControl.TabPages[4];//删除TabPages
//this.xtraTabControl.TabPages.Remove(tabPage);
}
private static DataTable ReadConfig()
{
//先查看数据库里面有无配置、没有的话,读取默认值/
SQLiteHelper.connectionString = CommonInfo.AutoConnection(CommonInfo.LogDatabaseName);
System.Data.DataSet ds = new DataSet();
ds = null;
string ID, ConfigID, DefaultName, CustomName, Color, Important, ScriptID, UpdateTime, CreateTime, RecentUseTime;
string sql = @"select * from ConfigList";
ds = SQLiteHelper.ExecuteDataSet(sql);
ds.Tables[0].Columns.Add("时间", typeof(DateTime));
foreach (DataRow rowsList in ds.Tables[0].Rows) //循环获取设置的参数值
{
ID = rowsList["id"].ToString();
ConfigID = rowsList["ConfigID"].ToString();
DefaultName = rowsList["ConfigDefaultName"].ToString();
CustomName = rowsList["ConfigCustomName"].ToString();
Color = rowsList["ConfigColor"].ToString();
Important = rowsList["ConfigImportant"].ToString();
ScriptID = rowsList["ScriptID"].ToString();
UpdateTime = rowsList["UpdateTime"].ToString();
CreateTime = rowsList["CreateTime"].ToString();
RecentUseTime = rowsList["RecentUseTime"].ToString();
DateTime t = CommonHelp.StampToDateTime(ConfigID); //时间戳 转换为C#标准时间格式
//configTreeList.AddFilter("f");
}
return ds.Tables[0];
}
|