public static Setting Initialize(DTE serviceProvider) { var settings = Setting.Instance; if (settings.ServiceProvider == null || settings.ServiceProvider != serviceProvider) { settings.ServiceProvider = serviceProvider; } try { var solfile = VisualStudioUtility.GetSolutionSettingsFileFullPath(); if (!string.IsNullOrWhiteSpace(solfile)) { var solconf = Deserialize(solfile); settings.BackgroundImageAbsolutePath = solconf.BackgroundImageAbsolutePath; settings.BackgroundImagesDirectoryAbsolutePath = solconf.BackgroundImagesDirectoryAbsolutePath; settings.ExpandToIDE = solconf.ExpandToIDE; settings.Extensions = solconf.Extensions; settings.ImageBackgroundType = solconf.ImageBackgroundType; settings.ImageFadeAnimationInterval = solconf.ImageFadeAnimationInterval; settings.ImageStretch = solconf.ImageStretch; settings.LoopSlideshow = solconf.LoopSlideshow; settings.MaxHeight = solconf.MaxHeight; settings.MaxWidth = solconf.MaxWidth; settings.Opacity = solconf.Opacity; settings.PositionHorizon = solconf.PositionHorizon; settings.PositionVertical = solconf.PositionVertical; settings.ShuffleSlideshow = solconf.ShuffleSlideshow; settings.SoftEdgeX = solconf.SoftEdgeX; settings.SoftEdgeY = solconf.SoftEdgeY; settings.UpdateImageInterval = solconf.UpdateImageInterval; settings.ViewBoxPointX = solconf.ViewBoxPointX; settings.ViewBoxPointY = solconf.ViewBoxPointY; settings.SolutionConfigFilePath = solfile; settings.IsLimitToMainlyEditorWindow = solconf.IsLimitToMainlyEditorWindow; settings.TileMode = solconf.TileMode; settings.ViewPortHeight = solconf.ViewPortHeight; settings.ViewPortWidth = solconf.ViewPortWidth; settings.ViewPortPointX = solconf.ViewPortPointX; settings.ViewPortPointY = solconf.ViewPortPointY; } else { settings.Load(); } } catch { return(Setting.Deserialize()); } return(settings); }
public static Setting Initialize(IServiceProvider serviceProvider) { var settings = Setting.Instance; if (settings.ServiceProvider != serviceProvider) { settings.ServiceProvider = serviceProvider; } try { settings.Load(); } catch { return(Setting.Deserialize()); } return(settings); }
public static async Task <Setting> InitializeAsync(IServiceProvider serviceProvider) { var settings = Setting.Instance; if (settings.ServiceProvider != serviceProvider) { settings.ServiceProvider = serviceProvider; } try { await settings.LoadAsync(); } catch { return(Setting.Deserialize()); } return(settings); }