Example #1
0
        public SettingWindow()
        {
            InitializeComponent();

            IsSetting             = true;
            Language              = XmlLanguage.GetLanguage(Thread.CurrentThread.CurrentCulture.Name);
            FontList.DataContext  = Fonts.SystemFontFamilies.ToList();
            FontList.SelectedItem = Fonts.SystemFontFamilies.FirstOrDefault(x => x.Source == Properties.Settings.Default.Font);
            FontList.ScrollIntoView(Fonts.SystemFontFamilies.FirstOrDefault(x => x.Source == Properties.Settings.Default.Font));

            IsSetting = false;
            OverlayFont.DataContext  = Fonts.SystemFontFamilies.ToList();
            OverlayFont.SelectedItem = Fonts.SystemFontFamilies.FirstOrDefault(x => x.Source == Properties.Settings.Default.OverlayFont);
            IsSetting = true;

            IP.Text             = Properties.Settings.Default.BouyomiIP;
            FontSizeBox.Content = Properties.Settings.Default.FontSize.ToString("N1");

            // - - - - LoadUI
            if (Properties.Settings.Default.Language == "ja-JP")
            {
                JA.IsChecked = true;
            }
            else if (Properties.Settings.Default.Language == "zh-TW")
            {
                TWHK.IsChecked = true;
            }
            else if (Properties.Settings.Default.Language == "en-US")
            {
                EN.IsChecked = true;
            }

            // - - - -

            if (Properties.Settings.Default.BackContent == "Color")
            {
                RadioColor.IsChecked = true;
            }
            else if (Properties.Settings.Default.BackContent == "Image")
            {
                RadioImage.IsChecked = true;
            }
            BackColorInput.Content  = Properties.Settings.Default.BackColor;
            BackPreview.Fill        = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Properties.Settings.Default.BackColor));
            TextColorBox.Content    = Properties.Settings.Default.FontColor;
            TextColorBox.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Properties.Settings.Default.FontColor));

            ForegroundUIColor.Content    = Properties.Settings.Default.Foreground;
            ForegroundUIColor.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(Properties.Settings.Default.Foreground));
            PathLabel.Content            = "Path : " + Properties.Settings.Default.ImagePath;
            if (File.Exists(Properties.Settings.Default.ImagePath))
            {
                try
                {
                    BitmapImage bitmap = new BitmapImage(new Uri(Properties.Settings.Default.ImagePath));
                    PreviewImage.Source = bitmap;
                }
                catch { }
            }
            else
            {
                PathLabel.Content = "Image directory path Error";
            }


            //UpdateInv Slider Loading
            if (Properties.Settings.Default.Updateinv < 1000)
            {
                ChangeInv.Value = Properties.Settings.Default.Updateinv / 50;
            }
            else if (1000 <= Properties.Settings.Default.Updateinv)
            {
                ChangeInv.Value = (Properties.Settings.Default.Updateinv - 1000) / 500 + 11;
            }
            ChangeInvResult.Content = Properties.Settings.Default.Updateinv + "ms";
        }