using InitializerModel; 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; using System.Windows.Shapes; namespace ConfigEditor.SubPage.AppConfig { /// /// AppConfigPanel.xaml 的互動邏輯 /// public partial class AppConfigPanel : UserControl { public AppConfigPanel() { InitializeComponent(); uxLanguage.ItemsSource = AppSettingConfigModel.DefinedLanguages; uxMes.ItemsSource = MesAdaptor.SajetConnect.DefinedMes; } public void Reset() { AppSettingConfig.Reload(); ViewModel = AppSettingConfig.Instance; this.DataContext = ViewModel; } private AppSettingConfigModel ViewModel { get; set; } private void uxSaveConfigBtn_Click(object sender, RoutedEventArgs e) { AppSettingConfig.Save(); } private void FirmwareFolder_PreviewMouseUp(object sender, MouseButtonEventArgs e) { var dlg = new CommonOpenFileDialog(); dlg.InitialDirectory = Directory.GetCurrentDirectory(); dlg.IsFolderPicker = true; //var dlg = new FolderBrowserDialog(); var result = dlg.ShowDialog(); if (result != CommonFileDialogResult.Ok) { return; } ViewModel.FirmwareRoot = dlg.FileName; this.DataContext = null; this.DataContext = ViewModel; } } }