///-------------------------------------------------------------------------------------- /// <summary> /// Read settings as the result of a tools, import operation /// </summary> /// <param name="reader">VsSetings reader that contains our values as written previously</param> ///-------------------------------------------------------------------------------------- public override void LoadSettingsFromXml(Microsoft.VisualStudio.Shell.Interop.IVsSettingsReader reader) { try { InitializeDefaults(); string exePath, exeCmdLine; int enablePreview; if (SlowCheetahPackage.Succeeded(reader.ReadSettingString(regPreviewExe, out exePath)) && !string.IsNullOrEmpty(exePath)) { PreviewToolExecutablePath = exePath; } if (SlowCheetahPackage.Succeeded(reader.ReadSettingString(regPreviewCmdLine, out exeCmdLine)) && !string.IsNullOrEmpty(exeCmdLine)) { PreviewToolCommandLine = exeCmdLine; } if (SlowCheetahPackage.Succeeded(reader.ReadSettingBoolean(regPreviewEnable, out enablePreview))) { EnablePreview = enablePreview == 1; } } catch (Exception e) { Debug.Assert(false, "Error importing Slow Cheetah settings: " + e.Message); } }
public void SetSite() { // Create the package IVsPackage package = new SlowCheetahPackage() as IVsPackage; Assert.IsNotNull(package, "The object does not implement IVsPackage"); // Create a basic service provider OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices(); // Site the package Assert.AreEqual(0, package.SetSite(serviceProvider), "SetSite did not return S_OK"); // Unsite the package Assert.AreEqual(0, package.SetSite(null), "SetSite(null) did not return S_OK"); }
/// <summary> /// Default constructor of the package. /// Inside this method you can place any initialization code that does not require /// any Visual Studio service because at this point the package object is created but /// not sited yet inside Visual Studio environment. The place to do all the other /// initialization is the Initialize method. /// </summary> public SlowCheetahPackage() { this.LogMessageWriteLineFormat("Entering constructor for: {0}", this.ToString()); OurPackage = this; }
public void IsIVsPackage() { SlowCheetahPackage package = new SlowCheetahPackage(); Assert.IsNotNull(package as IVsPackage, "The object does not implement IVsPackage"); }
public void CreateInstance() { SlowCheetahPackage package = new SlowCheetahPackage(); }