コード例 #1
0
ファイル: RepostoryCallback.cs プロジェクト: formist/LinkMe
        public void EventStatusChanged(CatalogueElements elementType, string fullName)
        {
            const string method = "EventStatusChanged";

            try
            {
                switch (elementType)
                {
                case CatalogueElements.Namespace:
                    InstrumentationManager.UpdateNamespace(fullName);
                    break;

                case CatalogueElements.Source:
                    InstrumentationManager.UpdateSource(fullName);
                    break;

                default:
                    Debug.Fail("Unexpected value of elementType: " + elementType);
                    break;
                }
            }
            catch (System.Exception ex)
            {
                if (_errorCount < Constants.Errors.MaximumErrorsToLog)
                {
                    _errorCount++;
                    HandleException(method, string.Format(
                                        "Failed to process an EventStatusChanged notification for {0} '{1}':{2}{3}",
                                        elementType, fullName, System.Environment.NewLine, ex));
                }
            }
        }
コード例 #2
0
        public void EventStatusChanged(CatalogueElements elementType, string fullName)
        {
            // Store the changes in static properties on the LinkMe_InstrumentationEventStatusChange class.

            var config = new ManagementClass(_scope,
                                             new ManagementPath(Constants.Wmi.EventStatusChange.Class), null);

            WmiUtil.SetPropertyValue(config, Constants.Wmi.EventStatusChange.FullNameProperty, fullName);
            WmiUtil.SetPropertyValue(config, Constants.Wmi.EventStatusChange.ElementTypeProperty, (int)elementType);

            config.Put();
        }