using butterflow_ui.Properties; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; 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.Shapes; namespace butterflow_ui { /// /// Interaction logic for OptionsWindow.xaml /// public partial class OptionsWindow : Window { #region Properties /// The butterflow wrapper used to call butterflow. public ButterflowWrapper ButterflowWrapper { get; set; } = new ButterflowWrapper(); /// Gets or sets the supported languages. /// The supported languages. public List SupportedLanguages { get; set; } = new List(new[] { CultureInfo.CreateSpecificCulture("en-US"), CultureInfo.CreateSpecificCulture("es"), CultureInfo.CreateSpecificCulture("ar"), CultureInfo.CreateSpecificCulture("ja"), CultureInfo.CreateSpecificCulture("ru"), CultureInfo.CreateSpecificCulture("zh-CN"), }); #endregion Properties #region Constructors /// Default constructor. public OptionsWindow() { this.ButterflowWrapper.GetDevices(); this.ButterflowWrapper.ButterflowExited += ButterflowWrapper_ButterflowExited; InitializeComponent(); } #endregion Constructors #region Methods /// Event handler. Called by btnSave for click events. /// Source of the event. /// Routed event information. private void btnSave_Click(object sender, RoutedEventArgs e) { Properties.Settings.Default.Save(); this.Close(); } /// Butterflow wrapper butterflow exited. /// Source of the event. /// The ButterflowExitArgs to process. private void ButterflowWrapper_ButterflowExited(object sender, ButterflowWrapper.ButterflowExitArgs e) { if(Settings.Default.Device >= 0) { this.comboDeviceList.Dispatcher.Invoke(() => this.comboDeviceList.SelectedIndex = Settings.Default.Device); } else { this.comboDeviceList.Dispatcher.Invoke(() => this.comboDeviceList.SelectedIndex = 0); } } #endregion Methods } }