Пример #1
0
 private static ReadOnlyCollection <string> GetEnabledWidgets()
 {
     using (var service = ServiceFactory.GetCallbackServiceWrapper <ISettingsService>(new SettingsServiceCallback()))
     {
         ExportConfiguration exports = service.Instance.GetSetting(SettingKeys.WidgetConfigurationKey).GetValue <ExportConfiguration>();
         return(new ReadOnlyCollection <string>(exports.GetEnabledExports()));
     }
 }
Пример #2
0
        bool IJob.Initialize()
        {
            // Get export configuration
            ExportConfiguration exports = SettingsManager.Instance.GetSetting("GrowlJob", "GrowlSender").GetValue <ExportConfiguration>();

            // Add each export to the list, if initialization succeeded
            foreach (string exportAlias in exports.GetEnabledExports())
            {
                try
                {
                    IGrowlSender growlSender = ExportedTypeLibrary.Import <IGrowlSender>(exportAlias);

                    // This one has passed!
                    _growlSender.Add(growlSender);
                    Logger.Instance.LogFormat(LogType.Info, this, "Added growl sender '{0}'.", exportAlias);
                }
                catch
                {
                    Logger.Instance.LogFormat(LogType.Warning, this, "An error occurred while initialization plug-in '{0}'. Ignoring plug-in.", exportAlias);
                }
            }

            return(true);
        }