本文整理汇总了C#中SolutionEvents类的典型用法代码示例。如果您正苦于以下问题:C# SolutionEvents类的具体用法?C# SolutionEvents怎么用?C# SolutionEvents使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SolutionEvents类属于命名空间,在下文中一共展示了SolutionEvents类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AutoLinkerService
public AutoLinkerService(DTE2 visualStudio, IConfigurationService configurationService, IVisualStudioService visualStudioService)
{
Argument.IsNotNull("visualStudio", visualStudio);
Argument.IsNotNull("configurationService", configurationService);
Argument.IsNotNull("visualStudioService", visualStudioService);
_visualStudio = visualStudio;
_configurationService = configurationService;
_visualStudioService = visualStudioService;
var events = (Events2)_visualStudio.Events;
_solutionEvents = events.SolutionEvents;
_solutionEvents.Opened += OnSolutionOpened;
_solutionEvents.AfterClosing += OnSolutionClosed;
_solutionItemsEvents = events.MiscFilesEvents;
_solutionItemsEvents.ItemAdded += OnSolutionItemAdded;
_solutionItemsEvents.ItemRemoved += OnSolutionItemRemoved;
_solutionItemsEvents.ItemRenamed += OnSolutionItemRenamed;
_projectItemsEvents = events.ProjectItemsEvents;
_projectItemsEvents.ItemAdded += OnSolutionItemAdded;
_projectItemsEvents.ItemRemoved += OnSolutionItemRemoved;
_projectItemsEvents.ItemRenamed += OnSolutionItemRenamed;
}
示例2: PluginList
public PluginList()
{
InitializeComponent();
_logger = new Logger();
_dte = Package.GetGlobalService(typeof(DTE)) as DTE;
if (_dte == null)
return;
_solution = _dte.Solution;
if (_solution == null)
return;
_events = _dte.Events;
var windowEvents = _events.WindowEvents;
windowEvents.WindowActivated += WindowEventsOnWindowActivated;
_solutionEvents = _events.SolutionEvents;
_solutionEvents.BeforeClosing += BeforeSolutionClosing;
_solutionEvents.BeforeClosing += SolutionBeforeClosing;
_solutionEvents.ProjectAdded += SolutionProjectAdded;
_solutionEvents.ProjectRemoved += SolutionProjectRemoved;
_solutionEvents.ProjectRenamed += SolutionProjectRenamed;
SelectedAssemblyItem.PropertyChanged += SelectedAssemblyItem_PropertyChanged;
}
示例3: Initialize
protected override void Initialize()
{
base.Initialize();
//if invalid data, adjust it
dataAdjuster.Adjust();
// Get solution build manager
sbm = ServiceProvider.GlobalProvider.GetService(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager2;
if (sbm != null)
{
sbm.AdviseUpdateSolutionEvents(this, out updateSolutionEventsCookie);
}
// Must hold a reference to the solution events object or the events wont fire, garbage collection related
events = GetDTE().Events.SolutionEvents;
events.Opened += Solution_Opened;
PrintLine("Build monitor initialized");
PrintLine("Path to persist data: {0}", Settings.RepositoryPath);
monitor.SolutionBuildFinished = b =>
{
Print("[{0}] Time Elapsed: {1} \t\t", b.SessionBuildCount, b.SolutionBuildTime.ToTime());
PrintLine("Session build time: {0}\n", b.SessionMillisecondsElapsed.ToTime());
};
monitor.ProjectBuildFinished = b => PrintLine(" - {0}\t-- {1} --", b.MillisecondsElapsed.ToTime(), b.ProjectName);
}
示例4: Initialize
protected override void Initialize()
{
_dte = GetService(typeof(DTE)) as DTE2;
Package = this;
Telemetry.SetDeviceName(_dte.Edition);
Logger.Initialize(this, Constants.VSIX_NAME);
Events2 events = (Events2)_dte.Events;
_solutionEvents = events.SolutionEvents;
_solutionEvents.AfterClosing += () => { TableDataSource.Instance.CleanAllErrors(); };
_solutionEvents.ProjectRemoved += (project) => { TableDataSource.Instance.CleanAllErrors(); };
_buildEvents = events.BuildEvents;
_buildEvents.OnBuildBegin += OnBuildBegin;
CreateConfig.Initialize(this);
Recompile.Initialize(this);
CompileOnBuild.Initialize(this);
RemoveConfig.Initialize(this);
CompileAllFiles.Initialize(this);
CleanOutputFiles.Initialize(this);
base.Initialize();
}
示例5: WebResourceList
public WebResourceList()
{
InitializeComponent();
_dte = Package.GetGlobalService(typeof(DTE)) as DTE;
if (_dte == null)
return;
_solution = _dte.Solution;
if (_solution == null)
return;
_events = _dte.Events;
var windowEvents = _events.WindowEvents;
windowEvents.WindowActivated += WindowEventsOnWindowActivated;
_solutionEvents = _events.SolutionEvents;
_solutionEvents.BeforeClosing += BeforeSolutionClosing;
_solutionEvents.Opened += SolutionOpened;
_solutionEvents.ProjectAdded += SolutionProjectAdded;
_solutionEvents.ProjectRemoved += SolutionProjectRemoved;
_solutionEvents.ProjectRenamed += SolutionProjectRenamed;
_events2 = (Events2)_dte.Events;
_projectItemsEvents = _events2.ProjectItemsEvents;
_projectItemsEvents.ItemAdded += ProjectItemAdded;
_projectItemsEvents.ItemRemoved += ProjectItemRemoved;
_projectItemsEvents.ItemRenamed += ProjectItemRenamed;
}
示例6: VSEventsHandler
/// <summary>
/// Initializes a new instance of the <see cref="VSEventsHandler"/> class.
/// </summary>
/// <param name="package">The Visual Studio Extension Package.</param>
public VSEventsHandler(OpenCoverUIPackage package)
{
_package = package;
_solutionEvents = _package.DTE.Events.SolutionEvents;
_solutionEvents.Opened += OnSolutionOpened;
_solutionEvents.AfterClosing += OnSolutionClosing;
}
示例7: GoToDefinitionFilterProvider
public GoToDefinitionFilterProvider(
[Import(typeof(SVsServiceProvider))] System.IServiceProvider serviceProvider,
IVsEditorAdaptersFactoryService editorFactory,
IEditorOptionsFactoryService editorOptionsFactory,
ITextDocumentFactoryService textDocumentFactoryService,
[Import(typeof(DotNetReferenceSourceProvider))] ReferenceSourceProvider referenceSourceProvider,
VSLanguageService fsharpVsLanguageService,
ProjectFactory projectFactory)
{
_serviceProvider = serviceProvider;
_editorFactory = editorFactory;
_editorOptionsFactory = editorOptionsFactory;
_textDocumentFactoryService = textDocumentFactoryService;
_referenceSourceProvider = referenceSourceProvider;
_fsharpVsLanguageService = fsharpVsLanguageService;
_projectFactory = projectFactory;
var dte = serviceProvider.GetService(typeof(SDTE)) as DTE;
var events = dte.Events as Events2;
if (events != null)
{
_solutionEvents = events.SolutionEvents;
_solutionEvents.AfterClosing += Cleanup;
}
}
示例8: OnConnection
/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
/// <param term='application'>Root object of the host application.</param>
/// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
/// <param term='addInInst'>Object representing this Add-in.</param>
/// <seealso class='IDTExtensibility2' />
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
Globals.DTE = (DTE2)application;
Globals.Addin = (AddIn)addInInst;
solutionEvents = Globals.DTE.Events.SolutionEvents;
solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);
solutionEvents.BeforeClosing += new _dispSolutionEvents_BeforeClosingEventHandler(SolutionEvents_BeforeClosing);
commandManager = new CommandManager(Globals.DTE, Globals.Addin);
commandBarBuilder = new CommandBarBuilder(Globals.DTE, Globals.Addin);
switch (connectMode)
{
case ext_ConnectMode.ext_cm_UISetup:
// Initialize the UI of the add-in
break;
case ext_ConnectMode.ext_cm_Startup:
// The add-in was marked to load on startup
// Do nothing at this point because the IDE may not be fully initialized
// Visual Studio will call OnStartupComplete when fully initialized
break;
case ext_ConnectMode.ext_cm_AfterStartup:
// The add-in was loaded by hand after startup using the Add-In Manager
// Initialize it in the same way that when is loaded on startup
Initialize();
break;
}
}
示例9: SolutionHandler
private SolutionHandler(DTE2 dte)
{
_dte = dte;
_events = _dte.Events.SolutionEvents;
_events.Opened += OnSolutionOpened;
_events.AfterClosing += OnSolutionClosed;
}
示例10: ReloadFactory
static ReloadFactory()
{
var dte = (DTE2)Package.GetGlobalService(typeof(DTE));
_solutionEvents = dte.Events.SolutionEvents;
_solutionEvents.AfterClosing += SolutionEvents_AfterClosing;
_solutionEvents.ProjectRemoved += _solutionEvents_ProjectRemoved;
}
示例11: 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));
}
示例12: VsEventProvider
public VsEventProvider( ISourceControlService sourceControlService)
{
_vsEnvironment = Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SDTE)) as DTE2;
_sourceControlService = sourceControlService;
_solutionEvents = _vsEnvironment.Events.SolutionEvents;
_solutionEvents.AfterClosing += OnSolutionClosing;
_solutionEvents.Opened += OnSolutionOpened;
}
示例13: Storage
private Storage(RegistryKey storeTarget, DTE2 application)
{
_storeTarget = storeTarget;
_application = application;
_solutionEvents = application.Events.SolutionEvents;
_historicProcesses = new List<AttachData>();
_sessionProcesses = new List<AttachData>();
}
示例14: VisualStudioConnection
public VisualStudioConnection(Package package)
{
_package = package;
_dte = (DTE2)Package.GetGlobalService(typeof(DTE));
_solutionEvents = ((Events2)_dte.Events).SolutionEvents;
_buildEvents = ((Events2)_dte.Events).BuildEvents;
_subject = new Subject<EventType>();
}
示例15: InstallerProjectManagementService
public InstallerProjectManagementService(InstallBakerEventAggregator eventAggregator, SolutionEvents solutionEvents, Solution solution)
: base(eventAggregator)
{
_solutionEvents = solutionEvents;
_currentSolution = solution;
LoadInstallerProject();
HookEvents();
}