Example #1
0
        public Form1()
        {
            if (!Directory.Exists(AppProps.DefaultPodcastDownloadDir))
            {
                Directory.CreateDirectory(AppProps.DefaultPodcastDownloadDir);
            }

            InitializeComponent();

            Log.Configure(logRTB);

            currentConfiguration = Configuration.Load();

            Feeds = currentConfiguration.Podcasts;
            downloadDestination = currentConfiguration.Destination;

            currentConfiguration.Language = currentConfiguration.Language;

            locale = LocaleManager.InitialiseLocales();

            foreach (var localeEntry in locale.Locales)
            {
                ToolStripMenuItem item = new ToolStripMenuItem(localeEntry.Value.GetString("human_name"), image: null, onClick: (e, sender) =>
                {
                    currentConfiguration.Language = localeEntry.Key;

                    currentConfiguration.Save();

                    Log.Info($"Using \"{localeEntry.Value.GetString("human_name")}\" as current language");

                    UpdateLanguage();
                })
                {
                    Checked    = true,
                    CheckState = currentConfiguration.Language == localeEntry.Key ? CheckState.Checked : CheckState.Unchecked,
                };

                selectLanguageToolStripMenuItem.DropDownItems.Add(item);

                if (currentConfiguration.Language == localeEntry.Key)
                {
                    Log.Info($"Using \"{localeEntry.Value.GetString("human_name")}\" as current language");
                }
            }

            showWindowNotificationMenu.Visible = false;
            showWindowNotificationMenu.Click  += ShowWindowNotificationMenu_Click;
            closeNotificationTray.Click       += CloseNotificationTray_Click;
            closeNotificationTray.Checked      = currentConfiguration.CloseNotifTray;

            UpdateLanguage();

            UpdateSubscriptions();
        }