Ejemplo n.º 1
0
        public RunCloudScan(XElement cloudEl, XElement notificationEl)
        {
            cloud        = cloudEl;
            notification = notificationEl;
            //Save Cloud Config as class property
            this.cloudUrl      = cloudEl.Element("url").Value;
            this.cloudUsername = cloudEl.Element("username").Value;
            this.cloudPassword = cloudEl.Element("password").Value;
            //this.cloudExpectedCradles = cloudEl.Element("expectedCradles").Value;
            try {
                tb = MainWindow.tw;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            BallonTip tip = showBallonTip;

            object[] myParams = { tb, "CloudScan Started", "Scan started for " + cloudUrl };
            try {
                tb.Dispatcher.BeginInvoke(tip, myParams);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            //  tb.Dispatcher.Invoke(showBallonTip(tb, "CloudScan Started", "Scan started for " + cloudUrl));
            ScanConnectionStatus();
            //Create Results XML File
            this.resultsFile = new XDocument(
                new XElement("results"));
            // 17051QW-D0D-C1B94213D
        }
Ejemplo n.º 2
0
        public void parseResults()
        {
            XElement root = resultsFile.Root;
            // IEnumerable<XElement> address =
            //   from el in root.Elements("device")
            //  where el.Element("finalResult").Element("execution").Element("output").Element("status").Element("success").Value == "false"
            //  select el;
            IEnumerable <XElement> address = root.Elements("device");

            foreach (XElement el in address)
            {
                if (el.Element("runStatus").Value == "started")
                {
                    if (el.Element("finalResult").Element("execution").Element("output").Element("status").Element("success").Value == "false")
                    {
                        //XDocument notifyConfig = XDocument.Load("Config\\NotificationConfig.xml");
                        IEnumerable <XElement> notifys = notification.Elements("email");
                        foreach (XElement notify in notifys)
                        {
                            ThreadPool.QueueUserWorkItem(new WaitCallback((stateInfo) => sendMail(stateInfo, el, notify.Value)));
                        }
                    }
                }
            }
            // MainWindow main = (MainWindow)Application.Current.MainWindow;
            //main.showBallonText("CloudScan Finished", "Scan finished for " + cloudUrl);
            //(

            //((MainWindow)Application.Current.MainWindow).taskBar.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => ((MainWindow)Application.Current.MainWindow).showBallonText("CloudScan Started", "Scan started for " + cloudUrl)));

            BallonTip tip = showBallonTip;

            object[] myParams = { tb, "CloudScan Finished", "Scan finished for " + cloudUrl };
            tb.Dispatcher.BeginInvoke(tip, myParams);
            Thread.Sleep(0);
        }