OLD | NEW |
| (Empty) |
1 /// Copyright (c) Microsoft Corporation. All rights reserved. | |
2 | |
3 using System; | |
4 using System.ComponentModel; | |
5 using Microsoft.VisualStudio.Shell; | |
6 using Microsoft.VisualStudio.Shell.Interop; | |
7 using ErrorHandler = Microsoft.VisualStudio.ErrorHandler; | |
8 | |
9 namespace Microsoft.VisualStudio.Project | |
10 { | |
11 /// <summary> | |
12 /// This class is used to enable launching the project properties | |
13 /// editor from the Properties Browser. | |
14 /// </summary> | |
15 [CLSCompliant(false)] | |
16 public class PropertiesEditorLauncher : ComponentEditor | |
17 { | |
18 private ServiceProvider serviceProvider; | |
19 | |
20 #region ctor | |
21 public PropertiesEditorLauncher(ServiceProvider serviceProvider) | |
22 { | |
23 if(serviceProvider == null) | |
24 throw new ArgumentNullException("serviceProvider
"); | |
25 | |
26 this.serviceProvider = serviceProvider; | |
27 } | |
28 #endregion | |
29 #region overridden methods | |
30 /// <summary> | |
31 /// Launch the Project Properties Editor (properties pages) | |
32 /// </summary> | |
33 /// <returns>If we succeeded or not</returns> | |
34 public override bool EditComponent(ITypeDescriptorContext contex
t, object component) | |
35 { | |
36 if(component is ProjectNodeProperties) | |
37 { | |
38 IVsPropertyPageFrame propertyPageFrame = (IVsPro
pertyPageFrame)serviceProvider.GetService((typeof(SVsPropertyPageFrame))); | |
39 | |
40 int hr = propertyPageFrame.ShowFrame(Guid.Empty)
; | |
41 if(ErrorHandler.Succeeded(hr)) | |
42 return true; | |
43 else | |
44 ErrorHandler.ThrowOnFailure(propertyPage
Frame.ReportError(hr)); | |
45 } | |
46 | |
47 return false; | |
48 } | |
49 #endregion | |
50 | |
51 } | |
52 } | |
OLD | NEW |