private void ButtonLangs_OnClick(object sender, RoutedEventArgs e)
        {
            if (e.OriginalSource is Button button && button.Tag is string tag)
            {
                PopupConfig.IsOpen = false;
                if (tag.Equals(GlobalDataHelper <AppConfig> .Config.Lang))
                {
                    return;
                }

                Growl.Ask(Lang.ResourceManager.GetString("ChangeLanguage"), b =>
                {
                    if (!b)
                    {
                        return(true);
                    }

                    GlobalDataHelper <AppConfig> .Config.Lang = tag;
                    GlobalDataHelper <AppConfig> .Save();
                    LocalizationManager.Instance.CurrentCulture = new System.Globalization.CultureInfo(tag);
                    ConfigHelper.Instance.SetLang(GlobalDataHelper <AppConfig> .Config.Lang);
                    return(true);
                });
            }
        }
Example #2
0
 public static void WriteApiConfiguration(string tmdbkey, string igdbClientId, string igdbClientSecret,
                                          string dartClientSecret, string dartId)
 {
     GlobalDataHelper <AppConfig> .Config.TmdbKey          = tmdbkey;
     GlobalDataHelper <AppConfig> .Config.IgdbClientId     = igdbClientId;
     GlobalDataHelper <AppConfig> .Config.IgdbClientSecret = igdbClientSecret;
     GlobalDataHelper <AppConfig> .Config.DevClientId      = dartId;
     GlobalDataHelper <AppConfig> .Config.DevClientSecret  = dartClientSecret;
     GlobalDataHelper <AppConfig> .Save();
 }
 //public static void SaveProperties() => File.WriteAllText("ImageConverter.json", JsonSerializer.Serialize(GetPropertiesModel));
 public static void SaveProperties(PropertiesModel propertiesModel)
 {
     GlobalDataHelper <PropertiesModel> .Config.DeleteImage     = propertiesModel.DeleteImage;
     GlobalDataHelper <PropertiesModel> .Config.PlaySound       = propertiesModel.PlaySound;
     GlobalDataHelper <PropertiesModel> .Config.SoundToPlay     = propertiesModel.SoundToPlay;
     GlobalDataHelper <PropertiesModel> .Config.WebPEmulateJpeg = propertiesModel.WebPEmulateJpeg;
     GlobalDataHelper <PropertiesModel> .Config.WebPLosses      = propertiesModel.WebPLosses;
     GlobalDataHelper <PropertiesModel> .Config.WebPQuality     = propertiesModel.WebPQuality;
     GlobalDataHelper <PropertiesModel> .Config.WebPRemoveAlpha = propertiesModel.WebPRemoveAlpha;
     GlobalDataHelper <PropertiesModel> .Save();
 }
Example #4
0
        private void ToggleSkins_OnClick(object sender, RoutedEventArgs e)
        {
            var tag = SkinType.Default;

            tag = tg.IsChecked.Value ? SkinType.Dark : SkinType.Default;

            if (tag.Equals(GlobalDataHelper <AppConfig> .Config.Skin))
            {
                return;
            }

            GlobalDataHelper <AppConfig> .Config.Skin = tag;
            GlobalDataHelper <AppConfig> .Save();

            ((App)Application.Current).UpdateSkin(tag);
        }
        private void ButtonSkins_OnClick(object sender, RoutedEventArgs e)
        {
            if (e.OriginalSource is Button button && button.Tag is SkinType tag)
            {
                PopupConfig.IsOpen = false;
                if (tag.Equals(GlobalDataHelper <AppConfig> .Config.Skin))
                {
                    return;
                }

                GlobalDataHelper <AppConfig> .Config.Skin = tag;
                GlobalDataHelper <AppConfig> .Save();

                ((App)System.Windows.Application.Current).UpdateSkin(tag);
            }
        }
Example #6
0
 protected override void OnClosing(CancelEventArgs e)
 {
     base.OnClosing(e);
     if (GlobalDataHelper <AppConfig> .Config.IsShowNotifyIcon)
     {
         if (GlobalDataHelper <AppConfig> .Config.IsFirstRun)
         {
             MessageBoxResult result = HandyControl.Controls.MessageBox.Show(new MessageBoxInfo
             {
                 Message      = Lang.ResourceManager.GetString("RunInBackgroundMainWindow"),
                 Caption      = Lang.ResourceManager.GetString("Title"),
                 Button       = MessageBoxButton.YesNo,
                 IconBrushKey = ResourceToken.AccentBrush,
                 IconKey      = ResourceToken.InfoGeometry
             });
             if (result == MessageBoxResult.Yes)
             {
                 Hide();
                 e.Cancel = true;
                 GlobalDataHelper <AppConfig> .Config.IsFirstRun = false;
                 GlobalDataHelper <AppConfig> .Save();
             }
             else
             {
                 base.OnClosing(e);
             }
         }
         else
         {
             Hide();
             e.Cancel = true;
         }
     }
     else
     {
         base.OnClosing(e);
     }
 }