Beispiel #1
0
 public EditConfig()
 {
     InitializeComponent();
     RSSConfig = new RSSNotifierConfig()
     {
         RSSFilePath     = "rss.xml",
         Title           = "QuickMon RSS alerts",
         Language        = "en-us",
         Generator       = "QuickMon RSS notifier",
         KeepEntriesDays = 10,
         LineTitle       = "%CollectorName% - %AlertLevel%",
         LineCategory    = "%CurrentState%",
         LineDescription = "<b>Date Time:</b> %DateTime%\r\n" +
                           "<b>Current state:</b> %CurrentState%\r\n" +
                           "<b>Collector:</b> %CollectorType%\r\n" +
                           "<b>Details</b>\r\n" +
                           "%Details%"
     };
 }
Beispiel #2
0
        public override string ConfigureAgent(string config)
        {
            XmlDocument configXml = new XmlDocument();

            if (config.Length > 0)
            {
                configXml.LoadXml(config);
            }
            else
            {
                configXml.LoadXml(Properties.Resources.RSSFeedConfigTemplate_xml);
            }
            ReadConfiguration(configXml);
            EditConfig editConfig = new EditConfig();

            editConfig.RSSConfig = rssConfig;
            if (editConfig.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                rssConfig = editConfig.RSSConfig;
                configXml = new XmlDocument();
                configXml.LoadXml(Properties.Resources.RSSFeedConfigTemplate_xml);
                XmlElement root          = configXml.DocumentElement;
                XmlNode    rssConfigNode = root.SelectSingleNode("rssConfig");
                rssConfigNode.SetAttributeValue("rssFilePath", rssConfig.RSSFilePath);
                rssConfigNode.SetAttributeValue("title", rssConfig.Title);
                rssConfigNode.SetAttributeValue("link", rssConfig.Link);
                rssConfigNode.SetAttributeValue("description", rssConfig.Description);
                rssConfigNode.SetAttributeValue("language", rssConfig.Language);
                rssConfigNode.SetAttributeValue("generator", rssConfig.Generator);
                rssConfigNode.SetAttributeValue("keepEntriesDays", rssConfig.KeepEntriesDays.ToString());
                rssConfigNode.SetAttributeValue("lineTitle", rssConfig.LineTitle);
                rssConfigNode.SetAttributeValue("lineCategory", rssConfig.LineCategory);
                //rssConfigNode.SetAttributeValue("lineComments", rssConfig.LineComments);
                rssConfigNode.SetAttributeValue("lineDescription", rssConfig.LineDescription);
                config = configXml.OuterXml;
            }
            return(config);
        }