/// <summary>
 /// Registers an <see cref="IAction{TState,TInput}"/> or <see cref="IPrecondition{TState,TInput}"/>
 /// using the AssemblyQualifiedName of the <see cref="Type"/> as the Identifier and resolvable by the
 /// same value in a <see cref="Schematics.ConnectorKey"/>.
 /// </summary>
 /// <typeparam name="TConnector">
 /// The type of the connector, to use unbound generics, see the overload accepting a <see cref="Type"/> parameter.
 /// </typeparam>
 /// <param name="registrar"></param>
 /// <param name="registrationName">
 /// The name to register the type as in the <see cref="IComponentContainer"/>.
 /// <para />
 /// Registration names should ALWAYS be unique, overriding is NOT supported for safety/clarity reasons.
 /// <para />
 /// The default is the assembly qualified name of the type.
 /// </param>
 /// <remarks>
 /// Connectors are available for use by a <see cref="IStateMachine{TState,TInput}"/> when a <see cref="Schematics.ConnectorKey"/>
 /// in its <see cref="Schematics.ISchematic{TState,TInput}"/> matches a <see cref="IConnectorConfiguration"/>,
 /// that has been registered in a <see cref="IConnectorRegistration"/>'s <c>WithConfiguration</c> method.
 /// </remarks>
 public static IConnectorRegistration RegisterConnector <TConnector>(
     this IRegistrar registrar,
     string registrationName = null)
     where TConnector : IConnector
 {
     return(registrar.RegisterConnector(typeof(TConnector), registrationName));
 }
            async void Init()
            {
                try
                {
                    if (_appMenu)
                    {
                        await _dbus.RegisterObjectAsync(this);

                        _registrar = DBusHelper.Connection.CreateProxy <IRegistrar>(
                            "com.canonical.AppMenu.Registrar",
                            "/com/canonical/AppMenu/Registrar");
                        if (!_disposed)
                        {
                            await _registrar.RegisterWindowAsync(_xid, ObjectPath);
                        }
                    }
                    else
                    {
                        await _dbus.RegisterObjectAsync(this);
                    }
                }
                catch (Exception e)
                {
                    Logging.Logger.TryGet(Logging.LogEventLevel.Error, Logging.LogArea.X11Platform)
                    ?.Log(this, e.Message);

                    // It's not really important if this code succeeds,
                    // and it's not important to know if it succeeds
                    // since even if we register the window it's not guaranteed that
                    // menu will be actually exported
                }
            }
 public DefaultMailboxProviderKeeperPluginTest()
     : base()
 {
     registrar = Substitute.For <IRegistrar>();
     keeper    = Substitute.For <IMailboxProviderKeeper>();
     plugin    = new DefaultMailboxProviderKeeperPlugin(keeper, new DefaultMailboxProviderKeeperPluginConfiguration());
 }
Beispiel #4
0
        void ConfigureRegistrar(IListenerFactory factory, IListenerFactoryProcessor processor)
        {
            var r = new ListenerRegistrar(processor, factory);
            r.Add(new ReflectionListenerRegistrar());

            _registrar = r;
        }
Beispiel #5
0
        void ConfigureRegistrar(IControllerFactory factory, IControllerFactoryProcessor processor)
        {
            var r = new ControllerRegistrar(processor, factory);
            r.Add(new ReflectionControllerRegistrar());

            _registrar = r;
        }
Beispiel #6
0
 private static void InitializeIoc()
 {
     if (s_iocRegistrar == null)
     {
         // Initialize default dependency injection engine
         // Scan for internal assemblies only
         s_iocRegistrar = new DefaultRegistrar();
         Assembly[] loadedAssemblies   = AppDomain.CurrentDomain.GetAssemblies();
         Type       iocModuleInterface = typeof(IModule);
         s_iocRegistrar.RegisterModule <TfxModule>();
         foreach (Assembly assembly in loadedAssemblies)
         {
             if (!assembly.FullName.StartsWith("Tfx."))
             {
                 continue;
             }
             IEnumerable <Type> assemblyIocModules = assembly.GetTypes()
                                                     .Where(x =>
             {
                 return(iocModuleInterface.IsAssignableFrom(x));
             });
             foreach (Type iocModule in assemblyIocModules)
             {
                 s_iocRegistrar.RegisterModule(iocModule);
             }
         }
     }
 }
Beispiel #7
0
        /// <summary>
        /// Registers an <see cref="IAction{TState,TInput}"/> or <see cref="IPrecondition{TState,TInput}"/>.
        /// </summary>
        /// <param name="registrar"></param>
        /// <param name="connectorType">
        /// The unbound generic type of the connector aka generic type definition. e.g.
        /// <c>typeof(LoggingAction&lt;,&gt;)</c>
        /// </param>
        /// <param name="registrationName">
        /// The name to register the type as in the <see cref="IComponentContainer"/>.
        /// <para />
        /// Multiple registrations with the same name will override each other.
        /// <para />
        /// The default is the assembly qualified name of the type.
        /// </param>
        /// <returns>A <see cref="IConnectorRegistration"/> that allows the caller to
        /// register an <see cref="IConnectorConfiguration"/> that includes an Identifier
        /// that can be resolved using a <see cref="Schematics.ConnectorKey"/> in a <see cref="Schematics.ISchematic{TState,TInput}"/>.
        /// </returns>
        /// <remarks>
        /// Connectors are available for use by a <see cref="IStateMachine{TState,TInput}"/> when a <see cref="Schematics.ConnectorKey"/>
        /// in it's <see cref="Schematics.ISchematic{TState,TInput}"/> matches a <see cref="IConnectorConfiguration"/>,
        /// that has been registered in a <see cref="IConnectorRegistration"/>'s <c>WithConfiguration</c> method.
        /// </remarks>
        public static IConnectorRegistration RegisterConnector(this IRegistrar registrar, Type connectorType, string registrationName = null)
        {
            var registrationKey = registrationName ?? connectorType.FullName;

            var interfaces = connectorType
                             .GetInterfaces()
                             .Where(type => type.IsConstructedGenericType)
                             .Select(type => type.GetGenericTypeDefinition())
                             .ToList();

            var registered = false;

            if (interfaces.Any(type => type == typeof(IAction <,>)))
            {
                registrar.Register(typeof(IAction <,>), connectorType, registrationKey);

                registered = true;
            }

            if (interfaces.Any(type => type == typeof(IPrecondition <,>)))
            {
                registrar.Register(typeof(IPrecondition <,>), connectorType, registrationKey);

                registered = true;
            }

            if (!registered)
            {
                throw new ArgumentException(
                          message: "Type must be either IAction<,> or IPrecondition<,> to be registered.",
                          paramName: nameof(connectorType));
            }

            return(new ConnectorRegistration(registrar, connectorType));
        }
Beispiel #8
0
        void ConfigureRegistrar(IViewEngine engine, IViewProcessor processor)
        {
            var r = new ViewRegistrar(processor, engine);
            r.Add(new ReflectionViewRegistrar());

            _registrar = r;
        }
Beispiel #9
0
        /// <summary>
        /// Awake is called when the script instance is being loaded.
        /// </summary>
        void Awake()
        {
            Initialize();
            CurrentType   = DefaultType;
            Registrar     = GetComponentInParent <IRegistrar <Hitbox> >();
            Source        = GetComponentInParent <Character>();
            Damageable    = GetComponentInParent <IDamageable>();
            Knockbackable = GetComponentInParent <IKnockbackable>();
            _history      = new HashSet <object>();
            //_effect = GetComponent<ParticleSystem>();
            //_soundEffect = GetComponent<AudioSource>();

            gameObject.tag = Config.Tags.HitboxTag;
            switch (CurrentType)
            {
            case Type.Damageable:
            case Type.Shield:
                gameObject.layer = Config.Tags.HurtboxLayer;
                break;

            default:
                gameObject.layer = Config.Tags.HitboxLayer;
                break;
            }
            _colliders = GetComponents <Collider>();
            foreach (Collider col in _colliders)
            {
                col.isTrigger = true;
            }
        }
Beispiel #10
0
 public static void Initialize(IRegistrar registrar)
 {
     registrar.RegisterLibrary(libraryName, preferredRepositoryVersion);
     registrar.RegisterShapeType(new ShapeType("BusBar", libraryName, libraryName,
                                               delegate(ShapeType shapeType, Template t) { return(new BusBarSymbol(shapeType, t)); },
                                               BusBarSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceHorizontalBar));
     registrar.RegisterShapeType(new ShapeType("Disconnector", libraryName, libraryName,
                                               delegate(ShapeType shapeType, Template t) { return(new DisconnectorSymbol(shapeType, t)); },
                                               DisconnectorSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceCircleWithBar));
     registrar.RegisterShapeType(new ShapeType("AutoDisconnector", libraryName, libraryName,
                                               delegate(ShapeType shapeType, Template t) { return(new AutoDisconnectorSymbol(shapeType, t)); },
                                               AutoDisconnectorSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceCircleWithBar));
     registrar.RegisterShapeType(new ShapeType("AutoSwitch", libraryName, libraryName,
                                               delegate(ShapeType shapeType, Template t) { return(new AutoSwitchSymbol(shapeType, t)); },
                                               AutoSwitchSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceQuadrangle));
     registrar.RegisterShapeType(new ShapeType("Switch", libraryName, libraryName,
                                               delegate(ShapeType shapeType, Template t) { return(new SwitchSymbol(shapeType, t)); },
                                               SwitchSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceQuadrangle));
     registrar.RegisterShapeType(new ShapeType("Transformer", libraryName, libraryName,
                                               delegate(ShapeType shapeType, Template t) { return(new TransformerSymbol(shapeType, t)); },
                                               TransformerSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceDoubleCircle));
     registrar.RegisterShapeType(new ShapeType("Earth", libraryName, libraryName,
                                               delegate(ShapeType shapeType, Template t) { return(new EarthSymbol(shapeType, t)); },
                                               EarthSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceEarthSymbol));
     registrar.RegisterShapeType(new ShapeType("Feeder", libraryName, libraryName,
                                               delegate(ShapeType shapeType, Template t) { return(new FeederSymbol(shapeType, t)); },
                                               FeederSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceEarthSymbol));
     registrar.RegisterShapeType(new ShapeType("Rectifier", libraryName, libraryName,
                                               delegate(ShapeType shapeType, Template t) { return(new RectifierSymbol(shapeType, t)); },
                                               RectifierSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceEarthSymbol));
     registrar.RegisterShapeType(new ShapeType("DisconnectingPoint", libraryName, libraryName,
                                               delegate(ShapeType shapeType, Template t) { return(new DisconnectingPoint(shapeType, t)); },
                                               DisconnectingPoint.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceEarthSymbol));
 }
 public override void Start(IRegistrar registrar)
 {
     foreach (var supervisor in configuration.Supervisors)
     {
         registrar.RegisterDefaultSupervisor(supervisor.StageName, supervisor.SupervisorName, supervisor.SupervisorClass);
     }
 }
        /**
         * Verify the correct getLocale() behavior for the given service.
         * @param requestedLocale the locale to request.  This MUST BE
         * FAKE.  In other words, it should be something like
         * en_US_FAKEVARIANT so this method can verify correct fallback
         * behavior.
         * @param svc a factory object that can create the object to be
         * tested.
         * @param sub an object that can be used to retrieve a subobject
         * which should also be tested.  May be null.
         * @param reg an object that supplies the registration and
         * unregistration functionality to be tested.  May be null.
         */
        internal void CheckService(String requestedLocale, IServiceFacade svc,
                                   ISubobject sub, IRegistrar reg)
        {
            UCultureInfo req = new UCultureInfo(requestedLocale);
            Object       obj = svc.Create(req);

            CheckObject(requestedLocale, obj, "gt", "ge");
            if (sub != null)
            {
                Object subobj = sub.Get(obj);
                CheckObject(requestedLocale, subobj, "gt", "ge");
            }
            if (reg != null)
            {
                Logln("Info: Registering service");
                Object key    = reg.Register(req, obj);
                Object objReg = svc.Create(req);
                CheckObject(requestedLocale, objReg, "eq", "eq");
                if (sub != null)
                {
                    Object subobj = sub.Get(obj);
                    // Assume subobjects don't come from services, so
                    // their metadata should be structured normally.
                    CheckObject(requestedLocale, subobj, "gt", "ge");
                }
                Logln("Info: Unregistering service");
                if (!reg.Unregister(key))
                {
                    Errln("FAIL: unregister failed");
                }
                Object objUnreg = svc.Create(req);
                CheckObject(requestedLocale, objUnreg, "gt", "ge");
            }
        }
 /// <summary>
 /// Registers dependencies in the component.
 /// </summary>
 /// <param name="registrar">The registration system to register with, typically a DI container.</param>
 public void Register(IRegistrar registrar)
 {
     registrar.RegisterConnector(typeof(LoggingAction <,>))
     .WithConfiguration(new LoggingActionConfiguration("log trace")
     {
         LogLevel = LogLevel.Trace
     })
     .WithConfiguration(new LoggingActionConfiguration("log debug")
     {
         LogLevel = LogLevel.Debug
     })
     .WithConfiguration(new LoggingActionConfiguration("log info")
     {
         LogLevel = LogLevel.Info
     })
     .WithConfiguration(new LoggingActionConfiguration("log warn")
     {
         LogLevel = LogLevel.Warn
     })
     .WithConfiguration(new LoggingActionConfiguration("log error")
     {
         LogLevel = LogLevel.Error
     })
     .WithConfiguration(new LoggingActionConfiguration("log fatal")
     {
         LogLevel = LogLevel.Fatal
     });
 }
Beispiel #14
0
        public static IRegistrar CreateRegistrar()
        {
            var        registrarType = ConfigurationManager.AppSettings["Registrar"];
            Type       type          = Type.GetType(registrarType);
            IRegistrar registrar     = Activator.CreateInstance(type) as IRegistrar;

            return(registrar);
        }
Beispiel #15
0
 public static void RegisterConnector <TConnector>(
     this IRegistrar registrar,
     IConnectorConfiguration configuration,
     string registrationName = null)
     where TConnector : IConnector
 {
     registrar.RegisterConnector <TConnector>(registrationName).WithConfiguration(configuration);
 }
        private void RegisterXamarinDependencies(IRegistrar registrar)
        {
            registrar.Register <LocationService, ILocationService>();
            registrar.Register <PageService, IPageService>();


            // registrar.Register<GpsService, IGpsSensor>();
        }
Beispiel #17
0
        public void Register(IRegistrar registrar)
        {
            var builder = new GrammarBuilder<DirectionsArgs>();
            builder.AddArgument(a => a.Source, "starting at", "from");
            builder.AddArgument(a => a.Destination, "ending at", "to");
            _grammar = builder.Grammar;

            registrar.Register<DirectionsArgs>("directions", _grammar, GetDirections);
        }
Beispiel #18
0
        public static IRegistrar <IRequestProcessorMiddleware> AddFilter(this IRegistrar <IRequestProcessorMiddleware> builder, Func <Request, bool> predicate)
        {
            if (predicate == null)
            {
                throw new ArgumentNullException(nameof(predicate));
            }

            return(builder.Add(ctx => new FilteringMiddleware(ctx.GetLogger(), predicate)));
        }
 public void SetUp()
 {
     _registrar = MockRepository.GenerateStub<IRegistrar>();
     _builder = ((registry, info) => ctx => ctx.PropertyValue);
     _matches = (info => info.Name == "SomeProperty");
     _property = typeof(PropertyHolder).GetProperty("SomeProperty");
     _registrar.Stub(r => r.Register(Arg<ConverterFamily>.Matches(f=>f.Matches(_property))));
     _expression = new ConverterExpression(_matches, _registrar.Register);
 }
Beispiel #20
0
 private static void Transports(IRegistrar <ITransport> services)
 {
     services
     .Add(new DemoTransport(new[] { new CompositeCommand() }))
     //throw
     .Add(new DemoTransport(new[]
     {
         new ThrowCommand(), new ThrowCommand {
             Type = nameof(TimeoutException)
         }
     }))
     // delays
     .Add(new DemoTransport(new[]
     {
         new DelayCommand(TimeSpan.FromSeconds(2)), new DelayCommand(TimeSpan.FromMinutes(2)),
         new DelayCommand(TimeSpan.FromSeconds(20))
         {
             WatchDogTimeout = TimeSpan.FromSeconds(30)
         }
     }))
     // combined
     .Add(new DemoTransport(new[]
     {
         new CompositeCommand {
             Delay = new DelayCommand(TimeSpan.FromSeconds(2))
         },
         new CompositeCommand {
             Delay = new DelayCommand(TimeSpan.FromMinutes(2))
         },
         new CompositeCommand
         {
             Delay = new DelayCommand(TimeSpan.FromSeconds(2)), Throw = new ThrowCommand()
         },
         new CompositeCommand
         {
             Delay = new DelayCommand(TimeSpan.FromMinutes(2)), Throw = new ThrowCommand()
         }
     }))
     // scheduled
     .Add(new ScheduledTransport(new InMemoryScheduledJobStore(new[]
     {
         ScheduledJobDefinition.Create("* * * * *", new HelloCommand {
             Message = "Hi (every min)"
         }),
         ScheduledJobDefinition.Create("*/2 * * * *", new ProduceInProcess()),
         new ScheduledJobDefinition
         {
             Cron        = "*/5 * * * *",
             Name        = typeof(HelloCommand).FullName,
             Content     = "{\"Message\":\"How are you (every 5 min)\"}",
             ContentType = "json"
         }
     })))
     // in process
     .Add(InProcess.Instance);
 }
        public static void Initialize(IRegistrar registrar)
        {
            // Register library
            registrar.RegisterLibrary(namespaceName, preferredRepositoryVersion);
            // Register model object types
            TerminalId maxTerminalId = 2;

            registrar.RegisterModelObjectType(new GenericModelObjectType("ValueDevice", namespaceName, categoryTitle,
                                                                         ValueDevice.CreateInstance, ValueDevice.GetPropertyDefinitions, maxTerminalId));
        }
Beispiel #22
0
 public Interpreter(IRegistrar registrar, bool usePosTagger = true)
 {
     var baseDir = AppDomain.CurrentDomain.BaseDirectory;
     _entries = registrar.Entries;
     if (usePosTagger)
     {
         PosTagger = new MaxentTagger(
             Path.Combine(baseDir, "data", "english-bidirectional-distsim.tagger"));
     }
 }
        internal static TService[] GetCombined <TService>(IList <TService> items, IRegistrar resolver = null) where TService : class
        {
            if (resolver == null)
            {
                resolver = new DefaultRegistrar();
            }
            IEnumerable <TService> services = resolver.ResolveMany <TService>();

            return(services.Concat(items).ToArray());
        }
Beispiel #24
0
        public void Register(IRegistrar registrar)
        {
            var builder = new GrammarBuilder <DirectionsArgs>();

            builder.AddArgument(a => a.Source, "starting at", "from");
            builder.AddArgument(a => a.Destination, "ending at", "to");
            _grammar = builder.Grammar;

            registrar.Register <DirectionsArgs>("directions", _grammar, GetDirections);
        }
Beispiel #25
0
        public Interpreter(IRegistrar registrar, bool usePosTagger = true)
        {
            var baseDir = AppDomain.CurrentDomain.BaseDirectory;

            _entries = registrar.Entries;
            if (usePosTagger)
            {
                PosTagger = new MaxentTagger(
                    Path.Combine(baseDir, "data", "english-bidirectional-distsim.tagger"));
            }
        }
Beispiel #26
0
 public static void Initialize(IRegistrar registrar)
 {
     registrar.RegisterLibrary(libraryName, repositoryVersion);
     registrar.RegisterShapeType(Bracket.GetShapeType());
     registrar.RegisterShapeType(Coax.GetShapeType());
     registrar.RegisterShapeType(Ethernet.GetShapeType());
     registrar.RegisterShapeType(Optic.GetShapeType());
     registrar.RegisterShapeType(Power.GetShapeType());
     registrar.RegisterShapeType(Undefined.GetShapeType());
     registrar.RegisterShapeType(Wire.GetShapeType());
 }
Beispiel #27
0
 public override void Start(IRegistrar registrar)
 {
     foreach (var supervisor in configuration.Supervisors)
     {
         registrar.RegisterCommonSupervisor(
             supervisor.StageName,
             supervisor.SupervisorName,
             supervisor.SupervisedProtocol,
             supervisor.SupervisorClass);
     }
 }
Beispiel #28
0
        /// <summary>
        /// Registers watch-dog middleware using <paramref name="builder"/>.
        /// </summary>
        /// <param name="builder">The builder to use for registration.</param>
        /// <param name="options">The watch-dog configuration.</param>
        /// <returns><paramref name="builder"/></returns>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="builder"/> or <paramref name="options"/> is null.
        /// </exception>
        public static IRegistrar <IRequestProcessorMiddleware> AddWatchDog(this IRegistrar <IRequestProcessorMiddleware> builder, Action <WatchDogOptions> configureOptions)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            var options = OptionsBuilder.ConfigureAndValidate(configureOptions);

            return(builder.Add(ctx => new WatchDogMiddleware(options, ctx.GetLogger())));
        }
Beispiel #29
0
        public static void Initialize(IRegistrar registrar)
        {
            if (registrar == null)
            {
                throw new ArgumentNullException("registrar");
            }
            if (registrar is Project)
            {
                foreach (ShapeType shapeType in ((Project)registrar).ShapeTypes)
                {
                    switch (shapeType.FullName)
                    {
                    case "FhisPrimitives.Круг":
                        Watch.CircleType       = shapeType;
                        Thermometer.CircleType = shapeType;
                        Barometer.CircleType   = shapeType;
                        break;

                    case "FhisPrimitives.Прямоугольник":
                        Calendar.BoxType    = shapeType;
                        Thermometer.BoxType = shapeType;
                        break;

                    case "FhisPrimitives.Полилиния":
                        Watch.PolylineType       = shapeType;
                        Windvane.PolylineType    = shapeType;
                        Thermometer.PolylineType = shapeType;
                        Barometer.PolylineType   = shapeType;
                        break;
                    }
                }
            }

            // Register library
            registrar.RegisterLibrary(namespaceName, preferredRepositoryVersion);

            registrar.RegisterShapeType(new ShapeType("Календарь", namespaceName, resourceString,
                                                      Calendar.CreateInstance, Calendar.GetPropertyDefinitions));

            registrar.RegisterShapeType(new ShapeType("Часы", namespaceName, resourceString,
                                                      Watch.CreateInstance, Watch.GetPropertyDefinitions));

            registrar.RegisterShapeType(new ShapeType("Флюгер", namespaceName, resourceString,
                                                      Windvane.CreateInstance, Windvane.GetPropertyDefinitions));

            registrar.RegisterShapeType(new ShapeType("Гигрометр", namespaceName, resourceString,
                                                      Hygrometer.CreateInstance, Hygrometer.GetPropertyDefinitions));

            registrar.RegisterShapeType(new ShapeType("Термометр", namespaceName, resourceString,
                                                      Thermometer.CreateInstance, Thermometer.GetPropertyDefinitions));

            registrar.RegisterShapeType(new ShapeType("Барометр", namespaceName, resourceString,
                                                      Barometer.CreateInstance, Barometer.GetPropertyDefinitions));
        }
    public void StartPlugins(IRegistrar registrar, int pass)
    {
        Load(pass);

        foreach (var plugin in _plugins)
        {
            if (plugin.Pass == pass)
            {
                plugin.Start(registrar);
            }
        }
    }
    public void LoadAndStartDynamicPlugins(IRegistrar registrar, IPluginTypeLoader pluginClassLoader, Properties pluginsProperties)
    {
        var dynamicPlugins = new PluginLoader()
                             .LoadEnabledPlugins(this, pluginsProperties, pluginClassLoader)
                             .ToList();

        dynamicPlugins.ForEach(plugin => plugin
                               .Configuration
                               .BuildWith(this, new PluginProperties(plugin.Name, pluginsProperties)));

        dynamicPlugins.ForEach(plugin => plugin.Start(registrar));
        _dynamicPlugins.AddRange(dynamicPlugins);
    }
        public static IRegistrar <IRequestProcessorMiddleware> AddRetry(this IRegistrar <IRequestProcessorMiddleware> builder, IRetryPolicy retryPolicy)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (retryPolicy == null)
            {
                throw new ArgumentNullException(nameof(retryPolicy));
            }

            return(builder.Add(ctx => new RetryingMiddleware(retryPolicy, ctx.GetLogger())));
        }
        public static ILoggerProvider RegisterStandardLogger(string name, IRegistrar registrar)
        {
            var plugin = new ConsoleLoggerPlugin();
            var pluginConfiguration = (ConsoleLoggerPluginConfiguration)plugin.Configuration;

            var properties = new Properties();

            properties.SetProperty($"plugin.{name}.defaultLogger", "true");

            pluginConfiguration.BuildWith(registrar.World.Configuration, new PluginProperties(name, properties));
            plugin.Start(registrar);

            return(plugin);
        }
        /// <summary>
        /// Register Debounce middleware with the specified <paramref name="lastRunStore"/>.
        /// </summary>
        /// <param name="builder">The builder to use for registration.</param>
        /// <param name="lastRunStore">The last run store to use.</param>
        /// <returns><paramref name="builder"/></returns>
        /// <exception cref="ArgumentNullException">
        ///     <paramref name="builder"/> or <paramref name="lastRunStore"/> is null.
        /// </exception>
        public static IRegistrar <IRequestProcessorMiddleware> AddDebounce(this IRegistrar <IRequestProcessorMiddleware> builder,
                                                                           ILastRunStore lastRunStore)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (lastRunStore == null)
            {
                throw new ArgumentNullException(nameof(lastRunStore));
            }

            return(builder.Add(ctx => new DebounceMiddleware(lastRunStore, ctx.GetLogger())));
        }
Beispiel #35
0
        /// <summary>
        /// Registers middleware.
        /// </summary>
        /// <param name="builder">The builder to use for middleware registration.</param>
        /// <param name="creator">The function that creates <see cref="IRequestProcessorMiddleware"/>.</param>
        /// <returns></returns>
        public static IRegistrar <IRequestProcessorMiddleware> Add(this IRegistrar <IRequestProcessorMiddleware> builder,
                                                                   Func <IServiceProvider, Func <Context, RequestProcessorCallback, Task> > creator)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (creator == null)
            {
                throw new ArgumentNullException(nameof(creator));
            }

            return(builder.Add(provider => new AdHocRequestProcessorMiddleware(creator(provider))));
        }
Beispiel #36
0
        /// <summary>
        /// Registers middleware.
        /// </summary>
        /// <param name="builder">The builder to use for middleware registration.</param>
        /// <param name="middleware">The <see cref="IRequestProcessor"/> middleware.</param>
        /// <returns></returns>
        public static IRegistrar <IRequestProcessorMiddleware> Add(this IRegistrar <IRequestProcessorMiddleware> builder,
                                                                   Func <Context, RequestProcessorCallback, Task> middleware)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (middleware == null)
            {
                throw new ArgumentNullException(nameof(middleware));
            }

            return(builder.Add(new AdHocRequestProcessorMiddleware(middleware)));
        }
Beispiel #37
0
        public static void Initialize(IRegistrar registrar)
        {
            if (registrar == null) throw new ArgumentNullException("registrar");
            registrar.RegisterLibrary(namespaceName, preferredRepositoryVersion);

            // Register linear shapes
            registrar.RegisterShapeType(new ShapeType("Polyline", namespaceName, namespaceName,
                Polyline.CreateInstance, Polyline.GetPropertyDefinitions));
            registrar.RegisterShapeType(new ShapeType("RectangularLine", namespaceName, namespaceName,
                RectangularLine.CreateInstance, RectangularLine.GetPropertyDefinitions));
            registrar.RegisterShapeType(new ShapeType("CircularArc", namespaceName, namespaceName,
                "With only two points, it behaves like a straight line, with all three points, it behaves like a circular arc.",
                CircularArc.CreateInstance, CircularArc.GetPropertyDefinitions));
            // new Type(typeof(BezierLine).Name, BezierLine.CreateInstance,
            // BezierLine.GetPropertyDefinitions(null)).Register(registrar);
            // Planar GeneralShapes

            // Register text shapes
            registrar.RegisterShapeType(new ShapeType("Text", namespaceName, namespaceName,
                "Supports automatic sizing to its text.",
                Text.CreateInstance, Text.GetPropertyDefinitions,
                Dataweb.NShape.GeneralShapes.Properties.Resources.ShaperReferenceQuadrangle));
            registrar.RegisterShapeType(new ShapeType("Label", namespaceName, namespaceName,
                "Supports autosizing to its text and connecting to other shapes. If the label's 'pin' is connected to a shape, the label will move with its partner shape.",
                Label.CreateInstance, Label.GetPropertyDefinitions,
                Dataweb.NShape.GeneralShapes.Properties.Resources.ShaperReferenceQuadrangle));

            registrar.RegisterShapeType(new ShapeType("RegularPolygone", namespaceName, namespaceName,
                RegularPolygone.CreateInstance, RegularPolygone.GetPropertyDefinitions));

            // Register triangle shapes
            registrar.RegisterShapeType(new ShapeType("FreeTriangle", namespaceName, namespaceName,
                FreeTriangle.CreateInstance, FreeTriangle.GetPropertyDefinitions,
                Dataweb.NShape.GeneralShapes.Properties.Resources.ShaperReferenceTriangle));
            registrar.RegisterShapeType(new ShapeType("IsoscelesTriangle", namespaceName, namespaceName,
                IsoscelesTriangle.CreateInstance, IsoscelesTriangle.GetPropertyDefinitions,
                Dataweb.NShape.GeneralShapes.Properties.Resources.ShaperReferenceTriangle));

            // Register round shapes
            registrar.RegisterShapeType(new ShapeType("Circle", namespaceName, namespaceName,
                Circle.CreateInstance, Circle.GetPropertyDefinitions,
                Dataweb.NShape.GeneralShapes.Properties.Resources.ShaperReferenceCircle));
            registrar.RegisterShapeType(new ShapeType("Ellipse", namespaceName, namespaceName,
                Ellipse.CreateInstance, Ellipse.GetPropertyDefinitions,
                Dataweb.NShape.GeneralShapes.Properties.Resources.ShaperReferenceCircle));

            // Register quadrangle shapes
            registrar.RegisterShapeType(new ShapeType("Square", namespaceName, namespaceName,
                Square.CreateInstance, Square.GetPropertyDefinitions,
                Dataweb.NShape.GeneralShapes.Properties.Resources.ShaperReferenceQuadrangle));
            registrar.RegisterShapeType(new ShapeType("Box", namespaceName, namespaceName,
                Box.CreateInstance, Box.GetPropertyDefinitions,
                Dataweb.NShape.GeneralShapes.Properties.Resources.ShaperReferenceQuadrangle));
            registrar.RegisterShapeType(new ShapeType("RoundedBox", namespaceName, namespaceName,
                RoundedBox.CreateInstance, RoundedBox.GetPropertyDefinitions,
                Dataweb.NShape.GeneralShapes.Properties.Resources.ShaperReferenceQuadrangle));
            registrar.RegisterShapeType(new ShapeType("Diamond", namespaceName, namespaceName,
                Diamond.CreateInstance, Diamond.GetPropertyDefinitions,
                Dataweb.NShape.GeneralShapes.Properties.Resources.ShaperReferenceDiamond));

            // Register other shapes
            registrar.RegisterShapeType(new ShapeType("ThickArrow", namespaceName, namespaceName,
                delegate(ShapeType shapeType, Template t) { return (Shape)new ThickArrow(shapeType, t); },
                ThickArrow.GetPropertyDefinitions));
            registrar.RegisterShapeType(new ShapeType("Picture", namespaceName, namespaceName,
                Picture.CreateInstance, Picture.GetPropertyDefinitions,
                Dataweb.NShape.GeneralShapes.Properties.Resources.ShaperReferenceQuadrangle));
        }
Beispiel #38
0
 public static void Initialize(IRegistrar registrar)
 {
     registrar.RegisterLibrary(namespaceName, preferredRepositoryVersion);
     registrar.RegisterShapeType(new ShapeType("Terminator", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new TerminatorSymbol(shapeType, t); },
         TerminatorSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Process", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new ProcessSymbol(shapeType, t); },
         ProcessSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Decision", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new DecisionSymbol(shapeType, t); },
         DecisionSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("InputOutput", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new InputOutputSymbol(shapeType, t); },
         InputOutputSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Document", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new DocumentSymbol(shapeType, t); },
         DocumentSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("OffpageConnector", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new OffpageConnectorSymbol(shapeType, t); },
         OffpageConnectorSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Connector", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new ConnectorSymbol(shapeType, t); },
         ConnectorSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("PredefinedProcess", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new PredefinedProcessSymbol(shapeType, t); },
         PredefinedProcessSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Extract", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new ExtractSymbol(shapeType, t); },
         ExtractSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Merge", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new MergeSymbol(shapeType, t); },
         MergeSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("OnlineStorage", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new OnlineStorageSymbol(shapeType, t); },
         OnlineStorageSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("OfflineStorage", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new OfflineStorageSymbol(shapeType, t); },
         OfflineStorageSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("DrumStorage", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new DrumStorageSymbol(shapeType, t); },
         DrumStorageSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("DiskStorage", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new DiskStorageSymbol(shapeType, t); },
         DiskStorageSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("TapeStorage", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new TapeStorageSymbol(shapeType, t); },
         TapeStorageSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Preparation", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new PreparationSymbol(shapeType, t); },
         PreparationSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("ManualInput", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new ManualInputSymbol(shapeType, t); },
         ManualInputSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Core", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new CoreSymbol(shapeType, t); },
         CoreSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Display", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new DisplaySymbol(shapeType, t); },
         DisplaySymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Tape", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new TapeSymbol(shapeType, t); },
         TapeSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("ManualOperation", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new ManualOperationSymbol(shapeType, t); },
         ManualOperationSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Sort", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new SortSymbol(shapeType, t); },
         SortSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Collate", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new CollateSymbol(shapeType, t); },
         CollateSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Card", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new CardSymbol(shapeType, t); },
         CardSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("CommLink", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new CommLinkSymbol(shapeType, t); },
         CommLinkSymbol.GetPropertyDefinitions));
 }
Beispiel #39
0
        /// <inheritdoc />
        public virtual void Terminate(IRegistrar registrar)
        {
            if (!this.IsInitialized)
            throw new InvalidOperationException();

             this.Locator = null;
             this.IsInitialized = false;
             this.IsPrepared = false;
             this.IsTerminated = true;
        }
Beispiel #40
0
 /// <summary>
 ///    Initializes a new instance of the <see cref="DataModule"/> class.
 /// </summary>
 /// <param name="registrar">The service registrar. Must not be <see langword="null" />.</param>
 public DataModule(IRegistrar registrar)
     : base(registrar)
 {
     registrar.Register<IConnection, Connection>();
 }
Beispiel #41
0
 public static void Initialize(IRegistrar registrar)
 {
     registrar.RegisterLibrary(libraryName, preferredRepositoryVersion);
     registrar.RegisterShapeType(new ShapeType("BusBar", libraryName, libraryName,
         delegate(ShapeType shapeType, Template t) { return new BusBarSymbol(shapeType, t); },
         BusBarSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceHorizontalBar));
     registrar.RegisterShapeType(new ShapeType("Disconnector", libraryName, libraryName,
         delegate(ShapeType shapeType, Template t) { return new DisconnectorSymbol(shapeType, t); },
         DisconnectorSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceCircleWithBar));
     registrar.RegisterShapeType(new ShapeType("AutoDisconnector", libraryName, libraryName,
         delegate(ShapeType shapeType, Template t) { return new AutoDisconnectorSymbol(shapeType, t); },
         AutoDisconnectorSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceCircleWithBar));
     registrar.RegisterShapeType(new ShapeType("AutoSwitch", libraryName, libraryName,
         delegate(ShapeType shapeType, Template t) { return new AutoSwitchSymbol(shapeType, t); },
         AutoSwitchSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceQuadrangle));
     registrar.RegisterShapeType(new ShapeType("Switch", libraryName, libraryName,
         delegate(ShapeType shapeType, Template t) { return new SwitchSymbol(shapeType, t); },
         SwitchSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceQuadrangle));
     registrar.RegisterShapeType(new ShapeType("Transformer", libraryName, libraryName,
         delegate(ShapeType shapeType, Template t) { return new TransformerSymbol(shapeType, t); },
         TransformerSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceDoubleCircle));
     registrar.RegisterShapeType(new ShapeType("Earth", libraryName, libraryName,
         delegate(ShapeType shapeType, Template t) { return new EarthSymbol(shapeType, t); },
         EarthSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceEarthSymbol));
     registrar.RegisterShapeType(new ShapeType("Feeder", libraryName, libraryName,
         delegate(ShapeType shapeType, Template t) { return new FeederSymbol(shapeType, t); },
         FeederSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceEarthSymbol));
     registrar.RegisterShapeType(new ShapeType("Rectifier", libraryName, libraryName,
         delegate(ShapeType shapeType, Template t) { return new RectifierSymbol(shapeType, t); },
         RectifierSymbol.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceEarthSymbol));
     registrar.RegisterShapeType(new ShapeType("DisconnectingPoint", libraryName, libraryName,
         delegate(ShapeType shapeType, Template t) { return new DisconnectingPoint(shapeType, t); },
         DisconnectingPoint.GetPropertyDefinitions, Dataweb.NShape.ElectricalShapes.Properties.Resources.ShaperReferenceEarthSymbol));
 }
 public static void Initialize(IRegistrar registrar)
 {
     registrar.RegisterLibrary(namespaceName, preferredRepositoryVersion);
     registrar.RegisterShapeType(new ShapeType("DataFlow", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new DataFlowArrow(shapeType, t); },
         DataFlowArrow.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Dependency", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new DependencyArrow(shapeType, t); },
         DependencyArrow.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Database", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new DatabaseSymbol(shapeType, t); },
         DatabaseSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Entity", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new EntitySymbol(shapeType, t); },
         EntitySymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Annotation", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new AnnotationSymbol(shapeType, t); },
         AnnotationSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Cloud", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new CloudSymbol(shapeType, t); },
         CloudSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Class", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new ClassSymbol(shapeType, t); },
         ClassSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Component", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new ComponentSymbol(shapeType, t); },
         ComponentSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Document", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new DocumentSymbol(shapeType, t); },
         DocumentSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Interface", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new InterfaceSymbol(shapeType, t); },
         InterfaceSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("InterfaceUsage", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) { return new InterfaceUsageSymbol(shapeType, t); },
         InterfaceUsageSymbol.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Server", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) {
         VectorImage result = VectorImage.CreateInstance(shapeType, t,
             "Dataweb.NShape.SoftwareArchitectureShapes.Resources.Tower.emf", Assembly.GetExecutingAssembly());
         result.Text = "Server";
         return result;
         }, VectorImage.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("RTU", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) {
         VectorImage result = VectorImage.CreateInstance(shapeType, t,
             "Dataweb.NShape.SoftwareArchitectureShapes.Resources.RTU.emf", Assembly.GetExecutingAssembly());
         result.Text = "RTU";
         return result;
     }, VectorImage.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Actor", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) {
         VectorImage result = VectorImage.CreateInstance(shapeType, t,
             "Dataweb.NShape.SoftwareArchitectureShapes.Resources.Actor.emf", Assembly.GetExecutingAssembly());
         result.Text = "Actor";
         return result;
     }, VectorImage.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Monitor", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) {
         VectorImage result = VectorImage.CreateInstance(shapeType, t,
             "Dataweb.NShape.SoftwareArchitectureShapes.Resources.Monitor.emf", Assembly.GetExecutingAssembly());
         result.Text = "Monitor";
         return result;
     }, VectorImage.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("PC", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) {
         VectorImage result = VectorImage.CreateInstance(shapeType, t,
             "Dataweb.NShape.SoftwareArchitectureShapes.Resources.Desktop.emf", Assembly.GetExecutingAssembly());
         result.Text = "PC";
         return result;
     }, VectorImage.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Tower", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) {
         VectorImage result = VectorImage.CreateInstance(shapeType, t,
             "Dataweb.NShape.SoftwareArchitectureShapes.Resources.Tower.emf", Assembly.GetExecutingAssembly());
         result.Text = "Tower";
         return result;
     }, VectorImage.GetPropertyDefinitions));
     registrar.RegisterShapeType(new ShapeType("Laptop", namespaceName, namespaceName,
         delegate(ShapeType shapeType, Template t) {
             VectorImage result = VectorImage.CreateInstance(shapeType, t,
                 "Dataweb.NShape.SoftwareArchitectureShapes.Resources.Laptop.emf", Assembly.GetExecutingAssembly());
             result.Text = "Notebook";
             return result;
         }, VectorImage.GetPropertyDefinitions));
 }
 /// <summary>
 /// Constructs the builder
 /// </summary>
 public LoggingConfigurationBuilder(IRegistrar registrar)
     : base(registrar)
 {
 }
 public RegistrationController(IRegistrar registrar)
 {
     _registrar = registrar;
 }
 public void Register(IRegistrar registrar)
 {
     registrar.Register("simple", Grammar.EmptyGrammar, DoThing);
 }
Beispiel #46
0
 public static void Initialize(IRegistrar registrar)
 {
     registrar.RegisterLibrary(namespaceName, preferredRepositoryVersion);
     registrar.RegisterModelObjectType(new GenericModelObjectType("MyBusinessObjectType", namespaceName, categoryTitle,
         (ModelObjectType type) => { return new MyBusinessObject(type); }, MyBusinessObject.GetPropertyDefinitions, 0));
 }
Beispiel #47
0
 public static void Initialize(IRegistrar registrar)
 {
     registrar.RegisterLibrary(namespaceName, preferredRepositoryVersion);
     registrar.RegisterModelObjectType(new GenericModelObjectType("ValueDevice", namespaceName, categoryTitle,
         ValueDevice.CreateInstance, ValueDevice.GetPropertyDefinitions, 2));
 }
 public static void Initialize(IRegistrar registrar)
 {
     registrar.RegisterLibrary(namespaceName, preferredRepositoryVersion);
     registrar.RegisterShapeType(
         new ShapeType("ElementNodeShape", namespaceName, namespaceName,
                       ElementNodeShape.CreateInstance, ElementNodeShape.GetPropertyDefinitions)
         );
     registrar.RegisterShapeType(
         new ShapeType("ControllerShape", namespaceName, namespaceName,
                       ControllerShape.CreateInstance, ControllerShape.GetPropertyDefinitions)
         );
     registrar.RegisterShapeType(
         new ShapeType("OutputShape", namespaceName, namespaceName,
                       OutputShape.CreateInstance, OutputShape.GetPropertyDefinitions)
         );
     registrar.RegisterShapeType(
         new ShapeType("FilterShape", namespaceName, namespaceName,
                       FilterShape.CreateInstance, FilterShape.GetPropertyDefinitions)
         );
     registrar.RegisterShapeType(
         new ShapeType("DataFlowConnectionLine", namespaceName, namespaceName,
                       DataFlowConnectionLine.CreateInstance, DataFlowConnectionLine.GetPropertyDefinitions)
         );
 }
		public static void Initialize(IRegistrar registrar) {
			registrar.RegisterLibrary(namespaceName, preferredRepositoryVersion);

			registrar.RegisterModelObjectType(new GenericModelObjectType("AutoDisconnector", namespaceName, categoryTitle,
				modelObjectType => new AutoDisconnector(modelObjectType),
				AutoDisconnector.GetPropertyDefinitions, 2));
			registrar.RegisterModelObjectType(new GenericModelObjectType("BusBar", namespaceName, categoryTitle,
				delegate(ModelObjectType modelObjectType) { return new BusBar(modelObjectType); },
				BusBar.GetPropertyDefinitions, 1));
			registrar.RegisterModelObjectType(new GenericModelObjectType("Disconnector", namespaceName, categoryTitle,
				delegate(ModelObjectType modelObjectType) { return new Disconnector(modelObjectType); },
				Disconnector.GetPropertyDefinitions, 2));
			registrar.RegisterModelObjectType(new GenericModelObjectType("Earth", namespaceName, categoryTitle,
				delegate(ModelObjectType modelObjectType) { return new Earth(modelObjectType); },
				Earth.GetPropertyDefinitions, 1));
			registrar.RegisterModelObjectType(new GenericModelObjectType("Feeder", namespaceName, categoryTitle,
				delegate(ModelObjectType modelObjectType) { return new Feeder(modelObjectType); },
				Feeder.GetPropertyDefinitions, 1));
			registrar.RegisterModelObjectType(new GenericModelObjectType("Title", namespaceName, categoryTitle,
				delegate(ModelObjectType modelObjectType) { return new Label(modelObjectType); },
				Label.GetPropertyDefinitions, 0));
			registrar.RegisterModelObjectType(new GenericModelObjectType("Line", namespaceName, categoryTitle,
				delegate(ModelObjectType modelObjectType) { return new Line(modelObjectType); },
				Line.GetPropertyDefinitions, 1));
			registrar.RegisterModelObjectType(new GenericModelObjectType("Measurement", namespaceName, categoryTitle,
				delegate(ModelObjectType modelObjectType) { return new Measurement(modelObjectType); },
				Measurement.GetPropertyDefinitions, 0));
			registrar.RegisterModelObjectType(new GenericModelObjectType("Picture", namespaceName, categoryTitle,
				delegate(ModelObjectType modelObjectType) { return new Picture(modelObjectType); },
				Picture.GetPropertyDefinitions, 0));
			registrar.RegisterModelObjectType(new GenericModelObjectType("Switch", namespaceName, categoryTitle,
				delegate(ModelObjectType modelObjectType) { return new Switch(modelObjectType); },
				Switch.GetPropertyDefinitions, 2));
			registrar.RegisterModelObjectType(new GenericModelObjectType("Transformer", namespaceName, categoryTitle,
				delegate(ModelObjectType modelObjectType) { return new Transformer(modelObjectType); },
				Transformer.GetPropertyDefinitions, 3));
		}