本文整理汇总了C#中PythonProjectNode.AddActionOnClose方法的典型用法代码示例。如果您正苦于以下问题:C# PythonProjectNode.AddActionOnClose方法的具体用法?C# PythonProjectNode.AddActionOnClose怎么用?C# PythonProjectNode.AddActionOnClose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PythonProjectNode
的用法示例。
在下文中一共展示了PythonProjectNode.AddActionOnClose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnsureReplWindow
internal static IVsInteractiveWindow/*!*/ EnsureReplWindow(IServiceProvider serviceProvider, IPythonInterpreterFactory factory, PythonProjectNode project) {
var compModel = serviceProvider.GetComponentModel();
var provider = compModel.GetService<InteractiveWindowProvider>();
string replId = PythonReplEvaluatorProvider.GetReplId(factory, project);
var window = provider.FindReplWindow(replId);
if (window == null) {
window = provider.CreateInteractiveWindow(
serviceProvider.GetPythonContentType(),
factory.Description + " Interactive",
typeof(PythonLanguageInfo).GUID,
replId
);
var toolWindow = window as ToolWindowPane;
if (toolWindow != null) {
toolWindow.BitmapImageMoniker = KnownMonikers.PYInteractiveWindow;
}
var pyService = serviceProvider.GetPythonToolsService();
window.InteractiveWindow.SetSmartUpDown(pyService.GetInteractiveOptions(factory).ReplSmartHistory);
}
if (project != null && project.Interpreters.IsProjectSpecific(factory)) {
project.AddActionOnClose(window, BasePythonReplEvaluator.CloseReplWindow);
}
return window;
}
示例2: EnsureReplWindow
internal static IVsInteractiveWindow/*!*/ EnsureReplWindow(IServiceProvider serviceProvider, InterpreterConfiguration config, PythonProjectNode project) {
var compModel = serviceProvider.GetComponentModel();
var provider = compModel.GetService<InteractiveWindowProvider>();
var vsProjectContext = compModel.GetService<VsProjectContextProvider>();
var projectId = project != null ? PythonReplEvaluatorProvider.GetEvaluatorId(project) : null;
var configId = config != null ? PythonReplEvaluatorProvider.GetEvaluatorId(config) : null;
IVsInteractiveWindow window;
// If we find an open window for the project, prefer that to a per-config one
if (!string.IsNullOrEmpty(projectId)) {
window = provider.Open(projectId);
if (window != null) {
if (window.InteractiveWindow.GetPythonEvaluator()?.AssociatedProjectHasChanged == true) {
// We have an existing window, but it needs to be reset.
// Let's create a new one
window = provider.Create(projectId);
project.AddActionOnClose(window, InteractiveWindowProvider.Close);
}
return window;
}
}
// If we find an open window for the configuration, return that
if (!string.IsNullOrEmpty(configId)) {
window = provider.Open(configId);
if (window != null) {
return window;
}
}
// No window found, so let's create one
if (!string.IsNullOrEmpty(projectId)) {
window = provider.Create(projectId);
project.AddActionOnClose(window, InteractiveWindowProvider.Close);
} else if (!string.IsNullOrEmpty(configId)) {
window = provider.Create(configId);
} else {
var interpService = compModel.GetService<IInterpreterOptionsService>();
window = provider.Create(PythonReplEvaluatorProvider.GetEvaluatorId(interpService.DefaultInterpreter.Configuration));
}
return window;
}