Ejemplo n.º 1
0
        public void Execute(IJobExecutionContext context)
        {
            JobDataMap dataMap = context.Trigger.JobDataMap;

            XElement  notificationNode    = XElement.Parse(dataMap.GetString("notifications"));
            XElement  cloudUrl            = XElement.Parse(dataMap.GetString("cloud"));
            XElement  cloudNode           = null;
            string    appFolderPath       = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            string    path                = Path.Combine(appFolderPath, @"CloudScan\ScheduleConfig.xml");
            XDocument cloudConfig         = XDocument.Load(path);
            IEnumerable <XElement> clouds = cloudConfig.Root.Element("schedule").Elements("clouds");

            foreach (XElement cloud in clouds)
            {
                if (cloud.Element("url").Value == cloudUrl.Value)
                {
                    cloudNode = cloud;
                }
            }
            //Console.WriteLine("Trigger {0} in group {1} was fired", context.Trigger.Key.Name, context.Trigger.Key.Group);*/

            RunCloudScan scan = new RunCloudScan(cloudNode, notificationNode);

            scan.RunScan();
        }
Ejemplo n.º 2
0
        private void Run_Cloud_Scan_Click(object sender, RoutedEventArgs e)
        {
            if ((((MenuItem)e.OriginalSource).Header).ToString() != "Run CloudScan Now")
            {
                XElement xCloud = XElement.Parse(((XmlElement)((MenuItem)e.OriginalSource).Header).OuterXml);
                //XmlElement cloudNode = (XmlElement)((MenuItem)sender).Tag;
                //XDocument cloudsConfig = XDocument.Load("Config\\CloudConfig.xml");
                //IEnumerable<XElement> cloudNodes = cloudsConfig.XPathSelectElements("clouds/cloud");
                //foreach (XElement cloud in cloudNodes)
                //{

                //XDocument doc = XDocument.Load("https://" + xCloud.Element("url").Value + "/services/cradles?operation=list&user="******"username").Value + "&password="******"password").Value);
                //  var testValue = doc.Root.Elements("cradles").Count();
                RunCloudScan scan = new RunCloudScan(xCloud.Element("clouds"), xCloud.Element("notifications"));
                scan.RunScan();
            }
            // }
        }