Пример #1
0
        /// <summary>
        /// Constructor. Where the magic lovin' happens.
        /// </summary>
        public FeedwinManager()
        {
            Log.Info("Starting up");
            try
            {
                Log.Debug("Building Manager window");
                InitializeComponent();

                //We're going to use the notifyicon and context menu from Winforms, because the WPF versions are a bit shit at the moment.
                CreateIconContextMenu();

                LoadSettings();

                thisinst = this;

                Log.Debug("Removing SSL cert validation");
                ServicePointManager.Expect100Continue = false;
                //We currently don't care if your RSS feed is being MITM'd.
                ServicePointManager.ServerCertificateValidationCallback =
                    (sender, certificate, chain, sslPolicyErrors) => true;

                LoadPlugins();

                //We serialize the configuration to the app.config. To let us do this, we need a serlializer.
                Log.Debug("Creating XML serializer for the saved FeedConfigItems");
                serializer = new XmlSerializer(FeedConfigItems.GetType());
                ReloadFeedConfigItems();

                //If we don't have any feeds loaded, prompt the user to add some.
                if (FeedConfigItems.Items.Count == 0)
                {
                    notifyicon.ShowBalloonTip(1000);
                }

                LoadProxy();

                SetGuiConfigValues();

                Visibility = Visibility.Collapsed;
                Hide();

                Log.Debug("Checking for updates on startup");
                var updater = new AutoUpdate();
                updater.CheckForUpdates(true);
            }
            catch (Exception ex)
            {
                Log.Error("Exception caught during FeedwinManager constructor", ex);
                throw;
            }
        }
        public void XmlImportTest1()
        {
            var actual     = new FeedConfigItemList();
            var serializer = new XmlSerializer(actual.GetType());
            var sr         = new StringReader(Properties.Resources.XmlImportTest1);
            var xmlr       = XmlReader.Create(sr);

            if (serializer.CanDeserialize(xmlr))
            {
                actual = (FeedConfigItemList)serializer.Deserialize(xmlr);
            }
            xmlr.Close();
            sr.Close();
            Assert.AreEqual(16, actual.Items.Count);
        }