public override void DeriveFromIssue(ServiceIssue issue)
        {
            base.DeriveFromIssue(issue);
            DiagnosableServiceIssue diagnosableServiceIssue = issue as DiagnosableServiceIssue;

            this.DiagnosableObject = diagnosableServiceIssue.DiagnosableObject;
        }
 public virtual void DeriveFromIssue(ServiceIssue issue)
 {
     this.Guid        = issue.Guid;
     this.CreatedTime = issue.CreatedTime;
 }
        XElement IDiagnosable.GetDiagnosticInfo(DiagnosableParameters parameters)
        {
            XElement xelement = new XElement(this.ComponentName);
            SICDiagnosticArgument arguments = this.CreateDiagnosticArgumentParser();

            try
            {
                arguments.Initialize(parameters);
            }
            catch (DiagnosticArgumentException ex)
            {
                xelement.Add(new XElement("Error", "Encountered exception: " + ex.Message));
                xelement.Add(new XElement("Help", "Supported arguments: " + arguments.GetSupportedArguments()));
                return(xelement);
            }
            List <ServiceIssue> list = null;

            if (arguments.HasArgument("invokescan"))
            {
                this.InvokeScan();
            }
            lock (this.cacheLock)
            {
                xelement.Add(new object[]
                {
                    new XElement("ScanFrequency", this.FullScanFrequency.ToString()),
                    new XElement("IssueLimit", this.IssueLimit),
                    new XElement("IsScanning", this.isScanning),
                    new XElement("IsEnabled", this.ScanningIsEnabled),
                    new XElement("LastScanStartTime", this.lastScanStartTime),
                    new XElement("LastScanDuration", this.lastScanDuration.TotalMilliseconds),
                    new XElement("NumberOfIssues", this.issueCache.Count)
                });
                if (this.LastScanError != null)
                {
                    xelement.Add(new object[]
                    {
                        new XElement("LastScanErrorName", this.LastScanError.GetType().Name),
                        new XElement("LastScanErrorMessage", this.LastScanError.Message)
                    });
                }
                if (arguments.HasArgument("issue"))
                {
                    list = new List <ServiceIssue>(this.issueCache.Values);
                }
            }
            if (list != null)
            {
                int      argumentOrDefault = arguments.GetArgumentOrDefault <int>("maxsize", list.Count);
                XElement xelement2         = new XElement("ServiceIssues");
                using (IEnumerator <ServiceIssue> enumerator = list.Take(argumentOrDefault).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ServiceIssue issue = enumerator.Current;
                        xelement2.Add(arguments.RunDiagnosticOperation(() => issue.GetDiagnosticInfo(arguments)));
                    }
                }
                xelement.Add(xelement2);
            }
            if (arguments.ArgumentCount == 0)
            {
                xelement.Add(new XElement("Help", "Supported arguments: " + arguments.GetSupportedArguments()));
            }
            return(xelement);
        }