public MainWindow() { InitializeComponent(); Util.Setup(); Util.logger.Info("アプリ起動"); TopBar.MouseLeftButtonDown += (o, e) => DragMove(); if (!File.Exists(Util.GetCurrentAppDir() + @"\history.txt")) { using (File.Create(Util.GetCurrentAppDir() + @"\history.txt")) { } } LoadTxtFile(); tokenSource = new CancellationTokenSource(); LoadTs(tokenSource.Token); }
private List<string> LoadTxtFile() { List<string> list = new List<string>(); try { using (var file = new StreamReader(Util.GetCurrentAppDir() + @"\history.txt")) { while (!file.EndOfStream) { list.Add(file.ReadLine()); } } } catch (Exception ex) { MessageBox.Show("エラーが発生しました。このエラーについての詳細は以下を参照してください。\n\n:" + ex.Message); } return list; }