private void SaveSearchChart(object sender, RoutedEventArgs e) { ((GraphView)this.GraphSearchView).SaveChart(); Window1 alert = new Window1("成功保存曲线。"); alert.ShowDialog(); }
private void ExportDataListToFile(List<Dictionary<string, object>> dataList) { DateTime now = DateTime.Now; string fileName = string.Format("{0}-{1}-{2}-{3}.csv", now.Year, now.Month, now.Day, now.Ticks); string filePath = string.Format("./csv/{0}", fileName); using (StreamWriter sw = new StreamWriter(filePath)) { foreach (Dictionary<string, object> i in dataList) { StringBuilder sb = new StringBuilder(); foreach (object item in i.Values) { sb.Append(item.ToString()).Append(","); } string line = sb.ToString(0, sb.Length - 1); sw.WriteLine(line); } Window1 alert = new Window1("成功导出CSV文件。"); alert.ShowDialog(); } }