Ejemplo n.º 1
0
 public void SetBqDeviceInfo(List <string> list)
 {
     try
     {
         if (isSave)
         {
             Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
             dlg.Filter   = "csv files(*.csv)|*.csv";
             dlg.FileName = System.DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv";
             //dlg.InitialDirectory = "D:\\";
             dlg.AddExtension     = false;
             dlg.RestoreDirectory = true;
             System.Nullable <bool> result = dlg.ShowDialog();
             if (result == true)
             {
                 string desFilePath = dlg.FileName.ToString();
                 if (File.Exists(desFilePath))
                 {
                     File.Delete(desFilePath);
                 }
                 if (dataGridRecord.Columns[2].Visibility == Visibility.Visible)
                 {
                     CSVFileHelper.SaveDdRecordDataCSV(m_ListRecordsInfo, desFilePath, true, UID, list);
                 }
                 else
                 {
                     CSVFileHelper.SaveDdRecordDataCSV(m_ListRecordsInfo, desFilePath, false, UID, list);
                 }
                 MessageBox.Show("备份数据保存成功!");
                 isSave = false;
             }
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
         isSave = false;
     }
 }