diff --git a/ArchivedSamples/Options_Page/C#/OptionsPagePackage.cs b/ArchivedSamples/Options_Page/C#/OptionsPagePackage.cs
index b00e94c9..9d69fab5 100644
--- a/ArchivedSamples/Options_Page/C#/OptionsPagePackage.cs
+++ b/ArchivedSamples/Options_Page/C#/OptionsPagePackage.cs
@@ -11,6 +11,8 @@ IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
using Microsoft.VisualStudio.Shell;
using System;
using System.Runtime.InteropServices;
+using Microsoft.VisualStudio;
+using Microsoft.VisualStudio.Shell.Interop;
namespace Microsoft.Samples.VisualStudio.IDE.OptionsPage
{
@@ -19,7 +21,7 @@ namespace Microsoft.Samples.VisualStudio.IDE.OptionsPage
/// The package class uses a number of registration attributes to specify integration parameters.
///
[PackageRegistration(UseManagedResourcesOnly = true)]
- [ProvideOptionPageAttribute(typeof(OptionsPageGeneral),"My Options Page (C#)","General", 100, 101, true, new string[] { "Change sample general options (C#)" })]
+ [ProvideOptionPageAttribute(typeof(OptionsPageGeneral), "My Options Page (C#)", "General", 100, 101, true, new string[] { "Change sample general options (C#)" })]
[ProvideProfileAttribute(typeof(OptionsPageGeneral), "My Options Page (C#)", "General Options", 100, 101, true, DescriptionResourceID = 100)]
[ProvideOptionPageAttribute(typeof(OptionsPageCustom), "My Options Page (C#)", "Custom", 100, 102, true, new string[] { "Change sample custom options (C#)" })]
[InstalledProductRegistration("My Options Page (C#)", "My Options Page (C#) Sample", "1.0")]
@@ -35,5 +37,41 @@ protected override void Initialize()
base.Initialize();
// TODO: add initialization code here
}
+
+ public static OptionsPagePackageCS EnsurePackageIsLoaded()
+ {
+ IVsShell shell = Package.GetGlobalService(typeof(SVsShell)) as IVsShell;
+ if (shell != null)
+ {
+ IVsPackage package;
+ Guid guid = new Guid(GuidStrings.GuidPackage);
+
+ if (ErrorHandler.Succeeded(shell.LoadPackage(ref guid, out package)))
+ {
+ return package as OptionsPagePackageCS;
+ }
+ }
+ return null;
+ }
+
+ ///
+ /// Get the OptionsPageGeneral
+ ///
+ ///
+ public static OptionsPageGeneral OptionsPageGeneral()
+ {
+ OptionsPagePackageCS package = EnsurePackageIsLoaded();
+ return package?.GetDialogPage(typeof(OptionsPageGeneral)) as OptionsPageGeneral;
+ }
+
+ ///
+ /// Get the OptionsPageCustom
+ ///
+ ///
+ public static OptionsPageCustom OptionsPageCustom()
+ {
+ OptionsPagePackageCS package = EnsurePackageIsLoaded();
+ return package?.GetDialogPage(typeof(OptionsPageCustom)) as OptionsPageCustom;
+ }
}
}