Beispiel #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();
        }
Beispiel #2
0
        void ImportOPML(string filePath)
        {
            Opml opmldoc = new Opml(filePath);

            Log.Info($"Opened: {filePath}");

            foreach (var rssOutline in opmldoc.Body.Outlines[0].Outlines)
            {
                Feeds.Add(new RSSFeed(rssOutline.Title, rssOutline.XMLUrl));

                Log.Info($"Added: {rssOutline.Title}");
            }

            Configuration.Save(Configuration.GenerateConfiguration(downloadDestination, Feeds));

            UpdateSubscriptions();
        }