本文整理汇总了C#中IPythonInterpreterFactory.CanBeDefault方法的典型用法代码示例。如果您正苦于以下问题:C# IPythonInterpreterFactory.CanBeDefault方法的具体用法?C# IPythonInterpreterFactory.CanBeDefault怎么用?C# IPythonInterpreterFactory.CanBeDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPythonInterpreterFactory
的用法示例。
在下文中一共展示了IPythonInterpreterFactory.CanBeDefault方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnvironmentView
internal EnvironmentView(
IInterpreterOptionsService service,
IPythonInterpreterFactory factory,
Redirector redirector
) {
if (service == null) {
throw new ArgumentNullException("service");
}
if (factory == null) {
throw new ArgumentNullException("factory");
}
_service = service;
Factory = factory;
_withDb = factory as IPythonInterpreterFactoryWithDatabase;
if (_withDb != null) {
_withDb.IsCurrentChanged += Factory_IsCurrentChanged;
IsCheckingDatabase = _withDb.IsCheckingDatabase;
IsCurrent = _withDb.IsCurrent;
}
var configurableProvider = _service != null ?
_service.KnownProviders
.OfType<ConfigurablePythonInterpreterFactoryProvider>()
.FirstOrDefault() :
null;
if (configurableProvider != null && configurableProvider.IsConfigurable(factory)) {
IsConfigurable = true;
}
Description = Factory.Description;
IsDefault = (_service != null && _service.DefaultInterpreter == Factory);
PrefixPath = Factory.Configuration.PrefixPath;
InterpreterPath = Factory.Configuration.InterpreterPath;
WindowsInterpreterPath = Factory.Configuration.WindowsInterpreterPath;
LibraryPath = Factory.Configuration.LibraryPath;
Extensions = new ObservableCollection<object>();
Extensions.Add(new EnvironmentPathsExtensionProvider());
if (IsConfigurable) {
Extensions.Add(new ConfigurationExtensionProvider(configurableProvider));
}
CanBeDefault = Factory.CanBeDefault();
}
示例2: EnvironmentView
internal EnvironmentView(
IInterpreterOptionsService service,
IInterpreterRegistryService registry,
IPythonInterpreterFactory factory,
Redirector redirector
) {
if (service == null) {
throw new ArgumentNullException(nameof(service));
}
if (registry == null) {
throw new ArgumentNullException(nameof(registry));
}
if (factory == null) {
throw new ArgumentNullException(nameof(factory));
}
if (factory.Configuration == null) {
throw new ArgumentException("factory must include a configuration");
}
_service = service;
_registry = registry;
Factory = factory;
Configuration = Factory.Configuration;
_withDb = factory as IPythonInterpreterFactoryWithDatabase;
if (_withDb != null) {
_withDb.IsCurrentChanged += Factory_IsCurrentChanged;
IsCheckingDatabase = _withDb.IsCheckingDatabase;
IsCurrent = _withDb.IsCurrent;
}
if (_service.IsConfigurable(Factory.Configuration.Id)) {
IsConfigurable = true;
}
Description = Factory.Configuration.Description;
IsDefault = (_service != null && _service.DefaultInterpreterId == Configuration.Id);
PrefixPath = Factory.Configuration.PrefixPath;
InterpreterPath = Factory.Configuration.InterpreterPath;
WindowsInterpreterPath = Factory.Configuration.WindowsInterpreterPath;
Extensions = new ObservableCollection<object>();
Extensions.Add(new EnvironmentPathsExtensionProvider());
if (IsConfigurable) {
Extensions.Add(new ConfigurationExtensionProvider(_service, alwaysCreateNew: false));
}
CanBeDefault = Factory.CanBeDefault();
Company = _registry.GetProperty(Factory.Configuration.Id, CompanyKey) as string ?? "";
SupportUrl = _registry.GetProperty(Factory.Configuration.Id, SupportUrlKey) as string ?? "";
}