本文整理汇总了C#中IVsSolution类的典型用法代码示例。如果您正苦于以下问题:C# IVsSolution类的具体用法?C# IVsSolution怎么用?C# IVsSolution使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IVsSolution类属于命名空间,在下文中一共展示了IVsSolution类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SolutionEventsListener
public SolutionEventsListener(IVsSolution service, IVsSolutionBuildManager3 buildManager = null) {
if (service == null) {
throw new ArgumentNullException("service");
}
_solution = service;
_buildManager = buildManager;
}
示例2: SolutionManager
internal SolutionManager(DTE dte, IVsSolution vsSolution, IVsMonitorSelection vsMonitorSelection)
{
if (dte == null)
{
throw new ArgumentNullException("dte");
}
_initNeeded = true;
_dte = dte;
_vsSolution = vsSolution;
_vsMonitorSelection = vsMonitorSelection;
// Keep a reference to SolutionEvents so that it doesn't get GC'ed. Otherwise, we won't receive events.
_solutionEvents = _dte.Events.SolutionEvents;
// can be null in unit tests
if (vsMonitorSelection != null)
{
Guid solutionLoadedGuid = VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid;
_vsMonitorSelection.GetCmdUIContextCookie(ref solutionLoadedGuid, out _solutionLoadedUICookie);
uint cookie;
int hr = _vsMonitorSelection.AdviseSelectionEvents(this, out cookie);
ErrorHandler.ThrowOnFailure(hr);
}
_solutionEvents.BeforeClosing += OnBeforeClosing;
_solutionEvents.AfterClosing += OnAfterClosing;
_solutionEvents.ProjectAdded += OnProjectAdded;
_solutionEvents.ProjectRemoved += OnProjectRemoved;
_solutionEvents.ProjectRenamed += OnProjectRenamed;
// Run the init on another thread to avoid an endless loop of SolutionManager -> Project System -> VSPackageManager -> SolutionManager
ThreadPool.QueueUserWorkItem(new WaitCallback(Init));
}
示例3: LocatorWindowCommand
/// <summary>
/// Initializes a new instance of the <see cref="LocatorWindowCommand"/> class.
/// Adds our command handlers for menu (commands must exist in the command table file)
/// </summary>
/// <param name="package">Owner package, not null.</param>
private LocatorWindowCommand(Package package)
{
if (package == null)
{
throw new ArgumentNullException("package");
}
this.package = package;
OleMenuCommandService commandService = ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (commandService != null)
{
var menuCommandID = new CommandID(CommandSet, CommandId);
var menuItem = new MenuCommand(this.ShowToolWindow, menuCommandID);
commandService.AddCommand(menuItem);
}
// Get the instance number 0 of this tool window. This window is single instance so this instance
// is actually the only one.
// The last flag is set to true so that if the tool window does not exists it will be created.
_locatorWindow = package.FindToolWindow(typeof(LocatorWindow), 0, true) as LocatorWindow;
if ((null == _locatorWindow) || (null == _locatorWindow.Frame))
{
throw new NotSupportedException("Cannot create tool window");
}
_locator = new Locator();
_solution = ServiceProvider.GetService(typeof(SVsSolution)) as IVsSolution;
_solution.AdviseSolutionEvents(_locator, out _cookie);
_locatorWindow.SetLocator(_locator);
_locator.StartWorkerThread();
}
示例4: VisualStudioProjectTracker
public VisualStudioProjectTracker(IServiceProvider serviceProvider)
{
_projectMap = new Dictionary<ProjectId, AbstractProject>();
_projectPathToIdMap = new Dictionary<string, ProjectId>(StringComparer.OrdinalIgnoreCase);
_serviceProvider = serviceProvider;
_workspaceHosts = new List<WorkspaceHostState>(capacity: 1);
_vsSolution = (IVsSolution)serviceProvider.GetService(typeof(SVsSolution));
_runningDocumentTable = (IVsRunningDocumentTable4)serviceProvider.GetService(typeof(SVsRunningDocumentTable));
uint solutionEventsCookie;
_vsSolution.AdviseSolutionEvents(this, out solutionEventsCookie);
_solutionEventsCookie = solutionEventsCookie;
// It's possible that we're loading after the solution has already fully loaded, so see if we missed the event
var shellMonitorSelection = (IVsMonitorSelection)serviceProvider.GetService(typeof(SVsShellMonitorSelection));
uint fullyLoadedContextCookie;
if (ErrorHandler.Succeeded(shellMonitorSelection.GetCmdUIContextCookie(VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid, out fullyLoadedContextCookie)))
{
int fActive;
if (ErrorHandler.Succeeded(shellMonitorSelection.IsCmdUIContextActive(fullyLoadedContextCookie, out fActive)) && fActive != 0)
{
_solutionLoadComplete = true;
}
}
}
示例5: SolutionEventsListener
public SolutionEventsListener(IServiceProvider serviceProvider)
{
solution = serviceProvider.GetService(typeof(SVsSolution)) as IVsSolution;
if (solution != null)
{
solution.AdviseSolutionEvents(this, out solutionEventsCookie);
}
}
示例6: SolutionChangeEventListener
/// <summary>
/// Constructor.
/// Register Solution events.
/// </summary>
public SolutionChangeEventListener() {
InitNullEvents();
solution = Package.GetGlobalService(typeof(SVsSolution)) as IVsSolution;
if(solution != null) {
solution.AdviseSolutionEvents(this, out solutionEventsCookie);
}
}
示例7: CreateItem
/// <summary>
/// Create an IItemContainer wrapper object against pHier
/// </summary>
internal static IItemContainer CreateItem(IServiceProvider serviceProvider, IVsSolution solution, IVsHierarchy pHier)
{
Debug.Assert(serviceProvider != null && solution != null && pHier != null);
using (HierarchyNode current = new HierarchyNode(solution, pHier))
{
return CreateItem(serviceProvider, current);
}
}
示例8: ProjectNode
public ProjectNode(IVsSolution vsSolution, Guid projectGuid)
: base(vsSolution, projectGuid)
{
this.project = this.Hierarchy as IVsProject;
// Commented because it will show up an error dialog before getting back control to the recipe (caller)
//Debug.Assert(project != null);
Debug.Assert(ItemId == VSConstants.VSITEMID_ROOT);
}
示例9: AdviceSolutionEvents
private void AdviceSolutionEvents()
{
solution = Package.GetGlobalService(typeof(SVsSolution)) as IVsSolution;
if (solution != null)
{
ErrorHandler.ThrowOnFailure(solution.AdviseSolutionEvents(this, out solutionCookie));
}
}
示例10: SolutionEventSinks
public SolutionEventSinks()
{
solution = (IVsSolution)Package.GetGlobalService(typeof(SVsSolution));
if (null == solution)
Trace.WriteLine("Can't access solution service");
else
solution.AdviseSolutionEvents((IVsSolutionEvents)this, out solutionEventsCookie);
}
示例11: SelectItemInSolutionExplorer
public static void SelectItemInSolutionExplorer(this IVsUIShell uiShell, IVsSolution solution, string fileName)
{
HierarchyNodeIterator it = new HierarchyNodeIterator(solution);
HierarchyNode hierarchyNode = it.FirstOrDefault(node => node.FullName == fileName);
uiShell.SelectItemInSolutionExplorer(hierarchyNode);
}
示例12: SolutionEvents
public SolutionEvents([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider)
{
Guard.NotNull(() => serviceProvider, serviceProvider);
this.serviceProvider = serviceProvider;
this.solution = serviceProvider.GetService<SVsSolution, IVsSolution>();
this.solutionEvents = new VsSolutionEvents(this);
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(this.solution.AdviseSolutionEvents(this.solutionEvents, out this.solutionEventsCookie));
}
示例13: ProjectItemsSynchronizer
public ProjectItemsSynchronizer(Project sourceProject, Project targetProject, ILogger logger, IVsSolution solution, IHierarchyHelper hierarchyHelper, IProjectItemsFilter projectItemsFilter)
{
this.logger = logger;
this.solution = solution;
this.hierarchyHelper = hierarchyHelper;
SourceProject = sourceProject;
TargetProject = targetProject;
this.projectItemsFilter = projectItemsFilter;
}
示例14: SolutionEventListener
public SolutionEventListener([Import(typeof (SVsServiceProvider))] IServiceProvider serviceProvider)
{
ValidateArg.NotNull(serviceProvider, "serviceProvider");
_solution = (IVsSolution) serviceProvider.GetService(typeof (IVsSolution));
if (_solution != null)
{
_solution.AdviseSolutionEvents(this, out _solutionEventsCookie);
}
}
示例15: SolutionListener
/// <summary>
/// Initializes a new instance of the SolutionListener class.
/// </summary>
/// <param name="serviceProvider">The system service provider.</param>
internal SolutionListener(IServiceProvider serviceProvider)
{
Param.AssertNotNull(serviceProvider, "serviceProvider");
this.solution = serviceProvider.GetService(typeof(SVsSolution)) as IVsSolution;
if (this.solution == null)
{
throw new InvalidOperationException();
}
}