12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- using Microsoft.WindowsAPICodePack.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- namespace Phihong_EVSE_UI_Tool
- {
- /// <summary>
- /// SaveSdCard.xaml 的互動邏輯
- /// </summary>
- public partial class SaveSdCard : UserControl
- {
- private string sdFolderPath;
- public SaveSdCard()
- {
- InitializeComponent();
- }
- private void uxBrowseButton_Click(object sender, RoutedEventArgs e)
- {
- var dlg = new CommonOpenFileDialog()
- {
- IsFolderPicker = true,
- Title = "Locate the SD card",
- };
- if (dlg.ShowDialog() == CommonFileDialogResult.Ok)
- {
- sdFolderPath = dlg.FileName;
- uxSdBrowseTextBox.Text = sdFolderPath;
- SaveToSdCard();
- }
- }
- private void SaveToSdCard()
- {
- Directory.CreateDirectory(Path.Combine(sdFolderPath, Utility.SDCARD_SUBDIR));
- foreach (string fileName in Utility.FILES_LIST)
- {
- File.Copy(Path.Combine(Utility.OUTPUT_DIRECTORY, fileName),
- Path.Combine(sdFolderPath, Utility.SDCARD_SUBDIR, fileName), true);
- }
- }
- }
- }
|