private void button1_Click(object sender, EventArgs e) { NotepadInfoRepository notepadInfoRepository = new NotepadInfoRepository(); var infos = notepadInfoRepository.GetInfos(); listBox1.Items.Clear(); foreach (var item in infos) { listBox1.Items.Add($"【{item.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")}】{item.NotepadContent}"); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Task.Factory.StartNew(() => { NotepadInfoRepository notepadInfoRepository = new NotepadInfoRepository(); var infos = notepadInfoRepository.GetInfos(); }); Application.Run(new Form1()); }