当前位置: 首页>>代码示例>>C#>>正文


C# IModuleContext类代码示例

本文整理汇总了C#中IModuleContext的典型用法代码示例。如果您正苦于以下问题:C# IModuleContext类的具体用法?C# IModuleContext怎么用?C# IModuleContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IModuleContext类属于命名空间,在下文中一共展示了IModuleContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UnloadModules

 public void UnloadModules(IModuleContext context)
 {
     foreach (var m in _loadedModules)
     {
         m.Unload(context);
     }
 }
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:7,代码来源:ModuleLoader.cs

示例2: Load

        public void Load(IModuleContext context)
        {
            var settingsManager = context.ServiceLocator.GetInstance<ISettingsManager>();
            settingsManager.RegisterSettings<PathSettings>();

            context.ServiceLocator.RegisterSingleton<IDirectoryManager, DirectoryManager>();
        }
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:7,代码来源:DirectoryModule.cs

示例3: GetMember

        public IMember GetMember(IModuleContext context, string name) {
            if (_attrs == null) {
                Interlocked.CompareExchange(ref _attrs, new Dictionary<string, MemberInfo>(), null);
            }
            bool showClr = context == null || ((IronPythonModuleContext)context).ShowClr;

            MemberInfo member;
            if (!_attrs.TryGetValue(name, out member) || member.Member == null) {
                var res = Interpreter.Remote.GetMember(Value, name);
                if (!res.Equals(Value)) {
                    _attrs[name] = member = new MemberInfo(_interpreter.MakeObject(res));
                }
            }

            if (!showClr) {
                if (!(this is IronPythonNamespace)) {   // namespaces always show all of their members...
                    switch (member.ClrOnly) {
                        case IsClrOnly.NotChecked:
                            CreateNonClrAttrs();
                            if (_attrs.ContainsKey(name) && 
                                _attrs[name].ClrOnly == IsClrOnly.Yes) {
                                return null;
                            }
                            break;
                        case IsClrOnly.No:
                            break;
                        case IsClrOnly.Yes:
                            return null;
                    }
                }
            }

            return member.Member;
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:34,代码来源:PythonObject.cs

示例4: Load

 public bool Load(IModuleContext context)
 {
     Should.NotBeNull(context, nameof(context));
     var mode = _supportedModes & context.Mode;
     if (_supportedModes.HasFlagEx(LoadMode.RuntimeDebug) || _supportedModes.HasFlagEx(LoadMode.RuntimeRelease))
     {
         if (mode != context.Mode)
             return false;
     }
     else
     {
         if (mode == 0)
             return false;
     }
     if (!_iocContainerCanBeNull && context.IocContainer == null)
         return false;
     lock (_locker)
     {
         _context = context;
         _iocContainer = context.IocContainer;
         _mode = context.Mode;
         try
         {
             return LoadInternal();
         }
         finally
         {
             _context = null;
             _iocContainer = null;
             _mode = default(LoadMode);
         }
     }
 }
开发者ID:dbeattie71,项目名称:MugenMvvmToolkit,代码行数:33,代码来源:ModuleBase.cs

示例5: Imported

 public void Imported(IModuleContext context) {
     if (Name == "clr") {
         ((IronPythonModuleContext)context).ShowClr = true;
     } else if (Name == "wpf") {
         AddWpfReferences();
     }
 }
开发者ID:omnimark,项目名称:PTVS,代码行数:7,代码来源:IronPythonModule.cs

示例6: ModuleView

 public ModuleView(IPythonInterpreter interpreter, IModuleContext context, string name, string idbPath) {
     _interpreter = interpreter;
     _context = context;
     Name = name;
     _idbPath = idbPath;
     _children = CalculateChildren().ToArray();
 }
开发者ID:wenh123,项目名称:PTVS,代码行数:7,代码来源:ModuleView.cs

示例7: FunctionOverloadView

 public FunctionOverloadView(IModuleContext context, string name, IPythonFunctionOverload overload) {
     _context = context;
     Name = name;
     _overload = overload;
     _prototype = new Lazy<string>(CalculatePrototype);
     _returnTypes = new Lazy<IEnumerable<IAnalysisItemView>>(CalculateReturnTypes);
     _parameters = new Lazy<IEnumerable<IAnalysisItemView>>(CalculateParameters);
 }
开发者ID:omnimark,项目名称:PTVS,代码行数:8,代码来源:FunctionOverloadView.cs

示例8: GetAllMembers

 public override IDictionary<string, IAnalysisSet> GetAllMembers(IModuleContext moduleContext) {
     var mro = ClassInfo._mro;
     if (!mro.IsValid) {
         return new Dictionary<string, IAnalysisSet>();
     }
     // First item in MRO list is always the class itself.
     return Values.Mro.GetAllMembersOfMro(mro.Skip(1), moduleContext);
 }
开发者ID:wenh123,项目名称:PTVS,代码行数:8,代码来源:SuperInfo.cs

示例9: Load

        public void Load(IModuleContext context)
        {
            var persistenceManager = context.ServiceLocator.GetInstance<IPersistenceManager>();
            persistenceManager.RegiserPersistenceProvider(SettingsPersistenceProviderKey, () => new ApplicationDataXmlPersistenceProvider());

            context.ServiceLocator.RegisterSingleton<ISettingsManager, SettingsManager>();
            context.ServiceLocator.Register<ISettingsEntryKeyBuilder, SettingsEntryKeyBuilder>();
        }
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:8,代码来源:SettingsModule.cs

示例10: Load

        public void Load(IModuleContext context)
        {
            var settingsManager = context.ServiceLocator.GetInstance<ISettingsManager>();
            settingsManager.RegisterSettings<KeyboardBindingSettings>();
            settingsManager.RegisterSettings<GamepadBindingSettings>();
            settingsManager.RegisterSettings<InputSettings>();

            SetDefaults(settingsManager);

            InputManager inputManager = new InputManager();

            context.InputSourceAssembler.ConfigureInputSource((c) =>
                {
                    var settings = settingsManager.LoadSettings<InputSettings>(c);

                    if (settings.IsUserInputEnabled)
                    {
                        var bindings = settingsManager.LoadSettings<KeyboardBindingSettings>(c);
                        KeyboardInputSource keyboard = new KeyboardInputSource(inputManager.GetKeyboard(), bindings);
                        return keyboard;
                    }

                    return null;

                });


            context.InputSourceAssembler.ConfigureInputSource((c) =>
                {
                    var settings = settingsManager.LoadSettings<InputSettings>(c);

                    if (settings.IsUserInputEnabled)
                    {
                        CompositeInputSource cis = new CompositeInputSource();

                        for (Int32 i = 0; i < inputManager.GetJoystickCount(); i++)
                        {
                            var bindings = settingsManager.LoadSettings<GamepadBindingSettings>(c);

                            if (i == 0)
                            {
                                GamepadInputSource gamepad = new GamepadInputSource(inputManager.GetJoystick(i), bindings.Gamepad1Bindings);
                                cis.AddInputSource(gamepad);
                            }
                            else if (i == 1)
                            {
                                GamepadInputSource gamepad = new GamepadInputSource(inputManager.GetJoystick(i), bindings.Gamepad2Bindings);
                                cis.AddInputSource(gamepad);
                            }
                        }

                        return cis;
                    }

                    return null;
                });
        }
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:57,代码来源:InputModule.cs

示例11: ModuleInfo

 public ModuleInfo(string moduleName, ProjectEntry projectEntry, IModuleContext moduleContext)
 {
     _name = moduleName;
     _projectEntry = projectEntry;
     _sequences = new Dictionary<Node, INamespaceSet>();
     _scope = new ModuleScope(this);
     _weakModule = new WeakReference(this);
     _context = moduleContext;
     _scopes = new Dictionary<Node, InterpreterScope>();
 }
开发者ID:borota,项目名称:JTVS,代码行数:10,代码来源:ModuleInfo.cs

示例12: Load

        public void Load(IModuleContext context)
        {
            var settingsManager = context.ServiceLocator.GetInstance<ISettingsManager>();

            var keybindings = new List<Wren.Core.Input.KeyboardBindingSettings.KeyBinding>();
            keybindings.Add(new KeyboardBindingSettings.KeyBinding() { ButtonId = 100, Key = "Escape" });
            keybindings.Add(new KeyboardBindingSettings.KeyBinding() { ButtonId = 101, Key = "M" });
            var defaultKeybindings = new KeyboardBindingSettings() { Bindings = keybindings.ToArray() };
            settingsManager.ApplySettings(defaultKeybindings, new EmulationContext(Game.Empty, new EmulatedSystem("WrenGame")), SettingsScope.EmulatedSystem);
        }
开发者ID:PhilipBrockmeyer,项目名称:Wren,代码行数:10,代码来源:WrenUIModule.cs

示例13: ModuleInfo

 public ModuleInfo(string moduleName, ProjectEntry projectEntry, IModuleContext moduleContext) {
     _name = moduleName;
     _projectEntry = projectEntry;
     _sequences = new Dictionary<Node, IAnalysisSet>();
     _scope = new ModuleScope(this);
     _weakModule = new WeakReference(this);
     _context = moduleContext;
     _scopes = new Dictionary<Node, InterpreterScope>();
     _referencedModules = new HashSet<ModuleReference>();
     _unresolvedModules = new HashSet<string>(StringComparer.Ordinal);
 }
开发者ID:jsschultz,项目名称:PTVS,代码行数:11,代码来源:ModuleInfo.cs

示例14: ParameterView

        public ParameterView(IModuleContext context, IParameterInfo parameter) {
            _context = context;
            _parameter = parameter;
            _types = new Lazy<IEnumerable<IAnalysisItemView>>(CalculateTypes);

            Name = _parameter.Name;
            if (_parameter.IsParamArray) {
                Name = "*" + Name;
            } else if (_parameter.IsKeywordDict) {
                Name = "**" + Name;
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:12,代码来源:ParameterView.cs

示例15: GetAllMembers

 public override IDictionary<string, IAnalysisSet> GetAllMembers(IModuleContext moduleContext, GetMemberOptions options = GetMemberOptions.None) {
     var res = new Dictionary<string, IAnalysisSet>();
     foreach (var kvp in _scope.AllVariables) {
         kvp.Value.ClearOldValues();
         if (kvp.Value._dependencies.Count > 0) {
             var types = kvp.Value.Types;
             if (types.Count > 0) {
                 res[kvp.Key] = types;
             }
         }
     }
     return res;
 }
开发者ID:jsschultz,项目名称:PTVS,代码行数:13,代码来源:ModuleInfo.cs


注:本文中的IModuleContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。