示例#1
0
        private IList ExecuteOe <T, TResult>(LambdaExpression lambda)
        {
            Container  container = CreateContainer();
            IQueryable query     = GetQuerableOe <T>(container);
            var        visitor   = new TypeMapperVisitor(query)
            {
                TypeMap = t => Type.GetType("ODataClient." + t.FullName)
            };
            var call = visitor.Visit(lambda.Body);

            Type elementType;
            ExecuteQueryFunc <Object> func;

            if (call.Type.GetTypeInfo().IsGenericType)
            {
                elementType = call.Type.GetGenericArguments()[0];
                func        = ExecuteQuery <Object>;
            }
            else
            {
                elementType = typeof(Object);
                func        = ExecuteQueryScalar <Object>;
            }

            IList fromOe = CreateDelegate(elementType, func)(query, call);

            TestHelper.SetNullCollection(fromOe, GetIncludes(lambda));

            if (typeof(TResult) == typeof(Object))
            {
                fromOe = TestHelper.SortProperty(fromOe);
            }
            return(fromOe);
        }
示例#2
0
        private async Task <IList> ExecuteOe <T, TResult>(LambdaExpression lambda, int maxPageSize)
        {
            Container container = CreateContainer(maxPageSize);
            var       visitor   = new TypeMapperVisitor(container)
            {
                TypeMap = t => Type.GetType("ODataClient." + t.FullName)
            };
            var call = visitor.Visit(lambda.Body);

            IQueryable query = GetQuerableOe(container, typeof(T));
            Type       elementType;

            if (call.Type.GetTypeInfo().IsGenericType)
            {
                elementType = call.Type.GetGenericArguments()[0];
                ExecuteQueryFuncAsync <Object> func = ExecuteQueryAsync <Object>;
                return(await CreateDelegate(elementType, func)(query, call, visitor.NavigationPropertyAccessors));
            }
            else
            {
                elementType = typeof(Object);
                ExecuteQueryFunc <Object> func = ExecuteQueryScalar <Object>;
                return(CreateDelegate(elementType, func)(query, call));
            }
        }
示例#3
0
        /// <summary>
        /// Liest den Zeitbereich für diesen Speicherbereich aus.
        /// </summary>
        /// <param name="start">Die Anfangszeit.</param>
        /// <param name="end">Die Endzeit.</param>
        /// <exception cref="COMException">Leitet den unterliegenden COM Fehler durch.</exception>
        public void GetTime(out long start, out long end)
        {
            // Process
            var hResult = CreateDelegate <GetTimeSignature>(2)(ComInterface, out start, out end);

            if (hResult < 0)
            {
                throw new COMException("MediaSample.GetTime", hResult);
            }
        }
示例#4
0
        /// <summary>
        /// Legt den Zeitbereich für diesen Speicherbereich fest.
        /// </summary>
        /// <param name="start">Die Anfangszeit.</param>
        /// <param name="end">Die Endzeit.</param>
        /// <exception cref="COMException">Leitet den unterliegenden COM Fehler durch.</exception>
        public void SetTime(long start, long end)
        {
            // Process
            var hResult = CreateDelegate <SetTimeSignature>(3)(ComInterface, ref start, ref end);

            if (hResult < 0)
            {
                throw new COMException("MediaSample.SetTime", hResult);
            }
        }
示例#5
0
        public void StartCreateBot(int totalCount, string pre, CreateDelegate createDelegate, FinishDelegate finishDelegate)
        {
            for (int i = 0; i < totalCount; i++)
            {
                try
                {
                    string fullName = pre + i;

                    var response = ManagerCore.Instance.CreateManager(fullName);
                    if (response.Code == (int)MessageCode.Success)
                    {
                        Dispatcher.Invoke((Action) delegate { createDelegate(""); });
                    }
                    else
                    {
                        Dispatcher.Invoke((Action) delegate { createDelegate(EmulatorHelper.BuildErrorinfo(response.Code)); });
                        return;
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.Insert(ex);
                    Dispatcher.Invoke((Action) delegate { createDelegate(ex.Message); });
                    return;
                }
            }
            Dispatcher.Invoke((Action) delegate { finishDelegate(); });
        }
示例#6
0
 public void StartCreateBot2(int totalCount, string pre, CreateDelegate createDelegate,
                             FinishDelegate finishDelegate)
 {
     for (int i = 0; i < totalCount; i++)
     {
         try
         {
             string fullName = pre + i;
             ManagerCore.Instance.GetUserByAccount(fullName, "emulator", 1);
             int tempid   = RandomHelper.GetInt32(1, 8);
             var response = ManagerCore.Instance.RegisterManager(fullName, fullName, "1", tempid, true, "0:0:0:0");
             if (response.Code == (int)MessageCode.Success)
             {
                 //LadderCore.Instance.GetLadderManager(response.Data);
                 Dispatcher.Invoke((Action) delegate { createDelegate(""); });
             }
             else
             {
                 Dispatcher.Invoke((Action) delegate { createDelegate(EmulatorHelper.BuildErrorinfo(response.Code)); });
                 return;
             }
         }
         catch (Exception ex)
         {
             LogHelper.Insert(ex);
             Dispatcher.Invoke((Action) delegate { createDelegate(ex.Message); });
             return;
         }
     }
     Dispatcher.Invoke((Action) delegate { finishDelegate(); });
 }
示例#7
0
            protected internal override void VisitCreateDelegate(CreateDelegate node, object data)
            {
                StackTypes stack = data as StackTypes;

                Verifier.ProcessDelegateConstruction(stack, node.Method, node.DelegateCtor);
                AddTask(node.Next, stack);
            }
示例#8
0
    //TODO: internal_name.Contains("_slope")
    public Block(string name, string internal_name, string material, string model_name, bool passable, bool can_be_built_over, bool inactive, int hp, string ui_sprite, SpriteManager.SpriteType ui_sprite_type, float dismantle_speed,
                 float build_speed, Dictionary <string, int> dismantle_drops, Dictionary <string, int> building_materials, Dictionary <Skill.SkillId, int> dismantle_skills, Dictionary <Skill.SkillId, int> build_skills,
                 Verb dismantle_verb, Dictionary <Tool.ToolType, int> tools_required_to_dismantle, Dictionary <Tool.ToolType, int> tools_required_to_build, BuildMenuManager.TabType?build_menu_tab, float harvest_speed,
                 string after_harvest_prototype, Dictionary <string, int> harvest_drops, Dictionary <Skill.SkillId, int> skills_required_to_harvest, Dictionary <Tool.ToolType, int> tools_required_to_harvest, Verb harvest_verb,
                 CreateDelegate create_action, UpdateDelegate update_action, ConnectionData connections, bool base_support, bool destroy_group_when_removed) :
        base(name, string.IsNullOrEmpty(model_name) ? (internal_name.Contains("_slope") ? SLOPE_PREFAB_NAME : PREFAB_NAME) : null, string.IsNullOrEmpty(model_name) ? material : null, MaterialManager.MaterialType.Block, model_name)
    {
        Id                  = -1;
        Name                = name;
        Internal_Name       = internal_name;
        Material            = material;
        Passable            = passable;
        Can_Be_Built_Over   = can_be_built_over;
        Inactive_GameObject = inactive;
        MAX_HP              = hp;
        Indestructible      = hp <= 0.0f;
        HP                  = -1.0f;
        HP_Dismantled       = -1.0f;
        HP_Built            = -1.0f;
        UI_Sprite           = ui_sprite;
        UI_Sprite_Type      = ui_sprite_type;
        Dismantle_Speed     = dismantle_speed;
        Build_Speed         = build_speed;
        Dismantle_Drops     = dismantle_drops != null?Helper.Clone_Dictionary(dismantle_drops) : new Dictionary <string, int>();

        Materials_Required_To_Build = building_materials != null?Helper.Clone_Dictionary(building_materials) : new Dictionary <string, int>();

        Skills_Required_To_Dismantle = dismantle_skills != null?Helper.Clone_Dictionary(dismantle_skills) : new Dictionary <Skill.SkillId, int>();

        Skills_Required_To_Build = build_skills != null?Helper.Clone_Dictionary(build_skills) : new Dictionary <Skill.SkillId, int>();

        Dismantle_Verb = new Verb(dismantle_verb);
        Tools_Required_To_Dismantle = tools_required_to_dismantle != null?Helper.Clone_Dictionary(tools_required_to_dismantle) : new Dictionary <Tool.ToolType, int>();

        Tools_Required_To_Build = tools_required_to_build != null?Helper.Clone_Dictionary(tools_required_to_build) : new Dictionary <Tool.ToolType, int>();

        Completed               = true;
        Build_Menu_Tab          = build_menu_tab;
        Harvest_Speed           = harvest_speed;
        After_Harvest_Prototype = after_harvest_prototype;
        Harvest_Progress        = -1.0f;
        Harvest_Drops           = harvest_drops != null?Helper.Clone_Dictionary(harvest_drops) : new Dictionary <string, int>();

        Skills_Required_To_Harvest = skills_required_to_harvest != null?Helper.Clone_Dictionary(skills_required_to_harvest) : new Dictionary <Skill.SkillId, int>();

        Tools_Required_To_Harvest = tools_required_to_harvest != null?Helper.Clone_Dictionary(tools_required_to_harvest) : new Dictionary <Tool.ToolType, int>();

        Harvest_Verb               = new Verb(harvest_verb);
        Data                       = new Dictionary <string, object>();
        Persistent_Data            = new Dictionary <string, object>();
        Update_Action              = update_action;
        update_cooldown            = -1.0f;
        Create_Action              = create_action;
        Connections                = new ConnectionData(connections);
        last_connections           = new ConnectionData(connections);
        Base_Support               = base_support;
        Base_Pilar_Support         = false;
        Destroy_Group_When_Removed = destroy_group_when_removed;
        Groups                     = new List <BlockGroup>();
    }
示例#9
0
            static Native()
            {
                //RuntimeCil.Generate(typeof(MemoryMapped).Assembly);

                Create = Marshal.GetDelegateForFunctionPointer <CreateDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "Create"));

                CreateAndOpen = Marshal.GetDelegateForFunctionPointer <CreateAndOpenDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "CreateAndOpen"));

                Destory = Marshal.GetDelegateForFunctionPointer <DestoryDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "Destory"));

                Open = Marshal.GetDelegateForFunctionPointer <OpenDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "Open"));

                Close = Marshal.GetDelegateForFunctionPointer <CloseDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "Close"));

                At = Marshal.GetDelegateForFunctionPointer <AtDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "At"));

                GetData = Marshal.GetDelegateForFunctionPointer <GetDataDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "GetData"));

                IsValid = Marshal.GetDelegateForFunctionPointer <IsValidDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "IsValid"));

                Size = Marshal.GetDelegateForFunctionPointer <SizeDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "Size"));

                MappedSize = Marshal.GetDelegateForFunctionPointer <MappedSizeDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "MappedSize"));

                Remap = Marshal.GetDelegateForFunctionPointer <RemapDelegate>(PlatformApi.NativeLibrary.GetExport(KokkosLibrary.ModuleHandle, "Remap"));
            }
示例#10
0
 public static void Register(Type type, CreateDelegate del)
 {
     if (typeof(IBase).IsAssignableFrom(type))
     {
         _register[type.FullName] = del;
     }
 }
示例#11
0
        public override TV GetOrCreate(TK key, CreateDelegate del)
        {
            using (m_lock.AcquireExclusiveUsing())
            {
                TV res;
                if (TryGetUnsafe(key, out res))
                {
                    return(res);
                }
                if (cache.Count >= capacity)
                {
                    while (cache.Count >= capacity / 1.5)
                    {
                        cache.Remove(lruCache.First.Value.key);
                        lruCache.RemoveFirst();
                    }
                }

                var node = new LinkedListNode <CacheItem>(new CacheItem()
                {
                    key = key, value = del(key)
                });
                lruCache.AddLast(node);
                cache.Add(key, node);
                return(node.Value.value);
            }
        }
示例#12
0
        /// <summary>Creates a new solid color screen mask</summary>
        /// <param name="graphicsDevice">
        ///   Graphics device the screen mask will be draw with
        /// </param>
        /// <param name="createDelegate">
        ///   Factory method that will be used to instantiate the mask
        /// </param>
        /// <returns>The newly created solid color screen mask</returns>
        internal static ColorScreenMask Create(
            GraphicsDevice graphicsDevice, CreateDelegate createDelegate
            )
        {
            // Fake up a service provider with a graphics device service so we can
            // create a content manager without the huge rat-tail of references
            IServiceProvider serviceProvider;

            serviceProvider = GraphicsDeviceServiceHelper.MakePrivateServiceProvider(
                GraphicsDeviceServiceHelper.MakeDummyGraphicsDeviceService(graphicsDevice)
                );

            // Create a resource content manager to load the default effect and hand
            // everything to the new screen mask instance, which will then be responsible
            // for freeing those resources again.
            ResourceContentManager contentManager = new ResourceContentManager(
                serviceProvider, Resources.ScreenMaskResources.ResourceManager
                );

            try {
                Effect effect = contentManager.Load <Effect>("ScreenMaskEffect");
                try {
                    return(createDelegate(graphicsDevice, contentManager, effect));
                }
                catch (Exception) {
                    effect.Dispose();
                    throw;
                }
            }
            catch (Exception) {
                contentManager.Dispose();
                throw;
            }
        }
示例#13
0
 public UnitOnLineTest(string serverName, string serverUrl, string account, CreateDelegate createDelegate)
 {
     _serverName     = serverName;
     _serverUrl      = serverUrl;
     _account        = account;
     _createDelegate = createDelegate;
 }
示例#14
0
            public void Callback(Node node)
            {
                if (node is ITypedNode)
                {
                    ITypedNode theNode = node as ITypedNode;
                    theNode.Type = mapper.Map(theNode.Type);
                }
                if (node is ManageField)
                {
                    ManageField theNode = node as ManageField;
                    theNode.Field = mapper.Map(theNode.Field);
                }
                if (node is MethodBodyBlock)
                {
                    MethodBodyBlock body = node as MethodBodyBlock;
                    foreach (Variable var in body.Variables)
                    {
                        var.Type = mapper.Map(var.Type);
                    }
                    body.ReturnType = mapper.Map(body.ReturnType);
                }
                if (node is CallMethod)
                {
                    CallMethod     call = node as CallMethod;
                    ResidualMethod id   = Specialization.GetResidualMethod(call);
                    if (id != null)
                    {
                        MethodBodyBlock mbb = mapper.Holder[id];
                        node.Options["HasPseudoParameter"] = mapper.HasPseudoParameter(mbb);
                        call.MethodWithParams = new MethodInfoExtention(mapper.Map(mbb), call.IsVirtCall, mapper.Map(GetParamTypes(mbb, id.IsConstructor)));
                    }
                    else
                    {
                        call.MethodWithParams = mapper.Map(call.MethodWithParams);
                    }
                }
                if (node is NewObject)
                {
                    NewObject      newObj = node as NewObject;
                    ResidualMethod id     = Specialization.GetResidualMethod(node);
                    if (id != null)
                    {
                        MethodBodyBlock mbb = mapper.Holder[id];
                        newObj.CtorWithParams = new MethodInfoExtention(mapper.Map(mbb), false, mapper.Map(GetParamTypes(mbb, id.IsConstructor)));
                        node.Options["HasPseudoParameter"] = mapper.HasPseudoParameter(mbb);
                    }
                    else
                    {
                        newObj.CtorWithParams = mapper.Map(newObj.CtorWithParams);
                    }
                }
                if (node is CreateDelegate)
                {
                    CreateDelegate crDel = node as CreateDelegate;
                    //Andrew TODO: Map this node...
                }

                // Graph should be verified AFTER the metadata is resolved
            }
示例#15
0
            public kerneldata(CreateDelegate delfunc, int size = 3, double param = 0.0)
            {
                CreateDelegate del = delfunc;

                weights = delfunc(size, param);
                _size   = size;
                _param  = param;
            }
示例#16
0
 public FakeOrganzationService ExpectCreate(CreateDelegate action)
 {
     _operations.Add(new OrganizationServiceStep()
     {
         Create = action
     });
     return(this);
 }
示例#17
0
 public object CreateObject(DbDataReader dataReader)
 {
     if (CreateDelegate == null)
     {
         CreateDelegate = new FastCreate(Type, Mapper);
     }
     return(CreateDelegate.Create(dataReader));
 }
示例#18
0
        public void Inicializar(TablaBase objetoDTO, CreateDelegate create, ReadDelegate read, UpdateDelegate update, DeleteDelegate delete, params ABMControl[] controls)
        {
            ObjetoDTO = objetoDTO;

            this.create     = create;
            this.ReadMethod = read;
            this.update     = update;
            this.delete     = delete;

            BuildControls(controls);
        }
示例#19
0
        public Sales AddSales(int movieId, int domesticsales, int foreignsales)
        {
            if (string.IsNullOrWhiteSpace(movieId.ToString()))
            {
                throw new ArgumentException("The parameter cannot be null or empty.", nameof(movieId));
            }


            var d = new CreateDelegate(movieId, domesticsales, foreignsales);

            return(executor.ExecuteNonQuery(d));
        }
示例#20
0
 public MockDropClient(
     string dropUrl                = null,
     CreateDelegate createFunc     = null,
     AddFileDelegate addFileFunc   = null,
     FinalizeDelegate finalizeFunc = null)
 {
     AppDomain.CurrentDomain.AssemblyResolve += MockDropClient.CurrentDomain_AssemblyResolve;
     DropUrl        = dropUrl;
     m_createFunc   = createFunc ?? new CreateDelegate(() => Task.FromResult(new DropItem()));
     m_addFileFunc  = addFileFunc ?? new AddFileDelegate((item) => Task.FromResult(AddFileResult.Associated));
     m_finalizeFunc = finalizeFunc ?? new FinalizeDelegate(() => Task.FromResult(new FinalizeResult()));
 }
示例#21
0
        public IndividualAwardsWon CreateIndividualAwardsWon(int movieId)
        {
            if (string.IsNullOrWhiteSpace(movieId.ToString()))
            {
                throw new ArgumentException("The parameter cannot be null or empty.", nameof(movieId));
            }


            var d = new CreateDelegate(movieId);

            return(executor.ExecuteNonQuery(d));
        }
示例#22
0
        public static void InitializeDelegates()
        {
            delCreate  = Create;
            delReceive = Receive;
            delDestroy = Destroy;
            delStart   = Start;

            InitializeDelegatesOnNative(Marshal.GetFunctionPointerForDelegate(delCreate),
                                        Marshal.GetFunctionPointerForDelegate(delReceive),
                                        Marshal.GetFunctionPointerForDelegate(delDestroy),
                                        Marshal.GetFunctionPointerForDelegate(delStart));
        }
示例#23
0
        public TypeCloner(
            CreateDelegate creatorDelegate,
            CopyDelegate copierDelegate)
        {
            if (creatorDelegate == null)
            {
                throw new ArgumentNullException(nameof(creatorDelegate));
            }

            this.CreatorDelegate = creatorDelegate;
            this.CopierDelegate  = copierDelegate;
        }
示例#24
0
        public static List <TGene> Tournament(CreateDelegate fnGenerateParent, CrossoverDelegate fnCrossover,
                                              CompeteDelegate fnCompete, TournamentDisplayDelegate fnDisplay, SortKeyDelegate fnSortKey,
                                              int numParents = 10, int maxGenerations = 100)
        {
            var pool = Enumerable.Range(0, 1 + numParents * numParents)
                       .Select(x => new Tuple <List <TGene>, int[]>(fnGenerateParent(), new[] { 0, 0, 0 })).ToList();
            var best      = pool[0].Item1;
            var bestScore = pool[0].Item2;

            int GetSortKey(Tuple <List <TGene>, int[]> x) => fnSortKey(x.Item1, x.Item2[(int)CompetitionResult.Win],
                                                                       x.Item2[(int)CompetitionResult.Tie], x.Item2[(int)CompetitionResult.Loss]);

            for (var generation = 0; generation < maxGenerations; generation++)
            {
                for (var i = 0; i < pool.Count; i++)
                {
                    for (var j = 0; j < pool.Count; j++)
                    {
                        if (i == j)
                        {
                            continue;
                        }
                        var playerA = pool[i].Item1;
                        var scoreA  = pool[i].Item2;
                        var playerB = pool[j].Item1;
                        var scoreB  = pool[j].Item2;
                        var result  = (int)fnCompete(playerA, playerB);
                        scoreA[result]++;
                        scoreB[2 - result]++;
                    }
                }

                pool = pool.OrderByDescending(GetSortKey).ToList();
                if (GetSortKey(pool[0]) > GetSortKey(new Tuple <List <TGene>, int[]>(best, bestScore)))
                {
                    best      = pool[0].Item1;
                    bestScore = pool[0].Item2;
                    fnDisplay(best, bestScore[(int)CompetitionResult.Win], bestScore[(int)CompetitionResult.Tie],
                              bestScore[(int)CompetitionResult.Loss], generation);
                }

                var parents = Enumerable.Range(0, numParents).Select(i => pool[i].Item1).ToList();
                pool = (from i in Enumerable.Range(0, parents.Count)
                        from j in Enumerable.Range(0, parents.Count)
                        where i != j
                        select new Tuple <List <TGene>, int[]>(fnCrossover(parents[i], parents[j]), new[] { 0, 0, 0 }))
                       .ToList();
                pool.AddRange(parents.Select(parent => new Tuple <List <TGene>, int[]>(parent, new[] { 0, 0, 0 })));
                pool.Add(new Tuple <List <TGene>, int[]>(fnGenerateParent(), new[] { 0, 0, 0 }));
            }

            return(best);
        }
示例#25
0
 static NativeFile()
 {
     // Initialize all the DllImports at once, since we are going to use all of them anyway.
     ReadFile                     = (ReadFileDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.ReadFile()), typeof(ReadFileDelegate));
     FlushFileBuffers             = (FlushFileBuffersDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.FlushFileBuffers()), typeof(FlushFileBuffersDelegate));
     WriteFile                    = (WriteFileDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.WriteFile()), typeof(WriteFileDelegate));
     SetFilePointerEx             = (SetFilePointerExDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.SetFilePointerEx()), typeof(SetFilePointerExDelegate));
     SetEndOfFile                 = (SetEndOfFileDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.SetEndOfFile()), typeof(SetEndOfFileDelegate));
     Create                       = (CreateDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.CreateFile2()), typeof(CreateDelegate));
     GetFileInformationByHandleEx = (GetFileInformationByHandleExDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.GetFileInformationByHandleEx()), typeof(GetFileInformationByHandleExDelegate));
     GetFileAttributesEx          = (GetFileAttributesExDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.GetFileAttributesExW()), typeof(GetFileAttributesExDelegate));
 }
示例#26
0
        public RuleMetadata(CreateDelegate create, Tuple <ContentType?, int[]>[] options = null,
                            bool needsSpecificContent = true, bool needsSpecificCount = true)
        {
            if (needsSpecificCount && !needsSpecificContent)
            {
                throw new ArgumentException("needsSpecificCount is only valid if needsSpecificContent is true");
            }

            Create  = create;
            Options = options;
            NeedsSpecificContent = options != null && needsSpecificContent;
            NeedsSpecificCount   = options != null && needsSpecificCount;
        }
        public AddNetworkWindow(CreateDelegate createDele, List <string> usedNames)
        {
            InitializeComponent();
            CreateDele     = createDele;
            this.usedNames = usedNames;
            InputLayerDisplay.LayerLength  = 784;
            OutputLayerDisplay.LayerLength = 10;
            AddAddInternalLayerButton(0);

            AddInternalLayer(0);

            NetworkName.Text = $"Network {usedNames.Count + 1}";
        }
示例#28
0
        public BitObjectFactory(Type type)
        {
            baseType      = type;
            createFactory = BuildCreate(type);

            accessorFactories = new Dictionary <Type, Func <FieldInfo, IAccessor> >();
            CreateAccessorFactories();

            var fields = type.GetFields();

            accessors = new IAccessor[fields.Length];
            LoadFieldAccessors(fields);
        }
示例#29
0
        /// <summary>
        /// Register Class to be created when key is passed to CreateNew
        /// </summary>
        /// <typeparam name="TClass">Any Class Implementing Interface</typeparam>
        /// <param name="key">the string to identify Class by</param>
        public void Register <TClass>(string key) where TClass : TInterface, new()
        {
            if (_mapping == null)
            {
                _mapping = new Dictionary <string, CreateDelegate>();
            }

            CreateDelegate createme = CreateFunction <TClass>;

            if (!_mapping.ContainsKey(key))
            {
                _mapping.Add(key, createme);
            }
        }
示例#30
0
        public void Inicializar(BusinessMapper.eEntities entidad)
        {
            ObjetoDTO = DTOHelper.InstanciarObjetoPorNombreDeTabla(entidad.ToString());
            Entidad   = entidad;
            dao       = BusinessMapper.GetDaoByEntity(entidad);

            this.create     = Create;
            this.update     = Update;
            this.ReadMethod = Read;
            this.delete     = Delete;

            List <ABMControl> controls = GetControlsByEntity(entidad);

            BuildControls(controls.ToArray());
        }
示例#31
0
 static NativeFile()
 {
     // Initialize all the DllImports at once, since we are going to use all of them anyway.
     ReadFile = (ReadFileDelegate) Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.ReadFile()), typeof (ReadFileDelegate));
     FlushFileBuffers = (FlushFileBuffersDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.FlushFileBuffers()), typeof(FlushFileBuffersDelegate));
     WriteFile = (WriteFileDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.WriteFile()), typeof(WriteFileDelegate));
     SetFilePointerEx = (SetFilePointerExDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.SetFilePointerEx()), typeof(SetFilePointerExDelegate));
     SetEndOfFile = (SetEndOfFileDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.SetEndOfFile()), typeof(SetEndOfFileDelegate));
     Create = (CreateDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.CreateFile2()), typeof(CreateDelegate));
     GetFileInformationByHandleEx = (GetFileInformationByHandleExDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.GetFileInformationByHandleEx()), typeof(GetFileInformationByHandleExDelegate));
     GetFileAttributesEx = (GetFileAttributesExDelegate)Marshal.GetDelegateForFunctionPointer(new IntPtr(SharpDX.WP8.Interop.GetFileAttributesExW()), typeof(GetFileAttributesExDelegate));
 }
 /// <summary>
 /// Registers a new extension delegate.
 /// </summary>
 /// <param name="creator">The factory method that can create the extension.</param>
 internal void RegisterExtension(CreateDelegate creator)
 {
     this.registeredExtensions.Add(creator);
 }
示例#33
0
        public void Inicializar(BusinessMapper.eEntities entidad)
        {
            ObjetoDTO       = DTOHelper.InstanciarObjetoPorNombreDeTabla(entidad.ToString());
            Entidad         = entidad;
            dao             = BusinessMapper.GetDaoByEntity(entidad);

            this.create     = Create;
            this.update     = Update;
            this.ReadMethod = Read;
            this.delete     = Delete;

            List<ABMControl> controls = GetControlsByEntity(entidad);
            BuildControls(controls.ToArray());
        }
示例#34
0
文件: HardLink.cs 项目: udoliess/baco
 static HardLink()
 {
     Create = OS.Unix ? (CreateDelegate)CreateUnix : CreateWin;
 }
示例#35
0
        public void Inicializar(TablaBase objetoDTO, CreateDelegate create, ReadDelegate read, UpdateDelegate update, DeleteDelegate delete, params ABMControl[] controls)
        {
            ObjetoDTO = objetoDTO;

            this.create     = create;
            this.ReadMethod = read;
            this.update     = update;
            this.delete     = delete;

            BuildControls(controls);
        }
示例#36
0
 protected void Page_Load(object sender, EventArgs e)
 {
     RegisterResource();
     BuildToolBar();
     if(Edit != null)
        Edit += new EditDelegate(DoEdit);
     if(Minimize != null)
        Minimize += new MinimizeDelegate(DoMinimize);
     if(Maximize != null)
        Maximize += new MaximizeDelegate(DoMaximize);
     if(Load != null)
        Load += new LoadDelegate(DoLoad);
     if(Create != null)
        Create += new CreateDelegate(DoCreate);
     if(Close != null)
        Close += new CloseDelegate(DoClose);
 }
示例#37
0
 protected override void Page_Load(object sender, System.EventArgs e)
 {
     base.Page_Load(sender, e);
     RegisterResource();
     BuildToolBar();
     Edit += new EditDelegate(DoEdit);
     Minimize += new MinimizeDelegate(DoMinimize);
     Maximize += new MaximizeDelegate(DoMaximize);
     Load += new LoadDelegate(DoLoad);
     Create += new CreateDelegate(DoCreate);
     Close += new CloseDelegate(DoClose);
 }