コード例 #1
0
        public void Run()
        {
            sprite = new Sprite(pixel);

            EntityConstructor entityConstructor = new EntityConstructor();

            EntityManager  = entityConstructor.Instantiate("1", () => window.Close());
            InputManager   = new MouseClick();
            IUpdateVisitor = new DefaultUpdateVisitor(InputManager, entityConstructor);


            IDrawingManager = new SFMLDrawingAdapter(window);
            IDrawVisitor    = new DefaultDrawVisitor(IDrawingManager);

            //Database.Set_connection();
            //Database.ExecuteData("create table if exists WinsLosses (ID INTEGER PRIMARY KEY, Wins INTEGER, Losses INTEGER)");
            //Database.ExecuteData("insert into WinsLosses (ID, Wins, Losses) values (1,0,0)");
            //Database.ReadData("select * from WinsLosses");

            window.SetActive();

            while (window.IsOpen)
            {
                window.Clear();
                window.DispatchEvents();
                Draw();
                Update();
                window.Display();
            }
        }
コード例 #2
0
        public Func <IDataReader, ReaderOrdinalEnumerator, ObjectActivatorEnumerator, object> GetInstanceCreator()
        {
            EntityConstructor entityConstructor = null;

            if (null == this._entityConstructor)
            {
                this._entityConstructor = EntityConstructor.GetInstance(this.ConstructorInfo);
            }

            entityConstructor = this._entityConstructor;
            return(entityConstructor.InstanceCreator);
        }
コード例 #3
0
        private void LoadFromAzureTableStorage <T>() where T : class
        {
            var context = GetTableContext <T>();
            var data    = context.All().ToArray();

            var results = AzureTableProvider.Convert <T>(data);

            EntityConstructor.Process(results.ToArray());

            //DataStore.Add(results.ToArray());
            Publish(new DataLoaded <T>(results));
        }
コード例 #4
0
        //Database DB;
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            base.Initialize();
            //DB = new Database();
            //DB.ExecuteData();
            EntityConstructor entityConstructor = new EntityConstructor();

            EntityManager = entityConstructor.Instantiate("1", () => Exit());
            if (device == "Windows")
            {
                InputManager = new MonogameMouseClick();
            }
            else if (device == "Android")
            {
                InputManager = new MonogameTouch();
            }
            IUpdateVisitor = new DefaultUpdateVisitor(InputManager, entityConstructor);
        }
コード例 #5
0
        /// <summary>
        /// Create a new Entity on a Report.
        /// </summary>
        protected TEntity CreateReportEntity <TEntity, TEntityDetails>(Guid reportId, TEntityDetails details, EntityConstructor <TEntity> constructor,
                                                                       Action <TReport, TEntity> add)
            where TEntityDetails : IPublicSafetyEntityDetails
            where TEntity : PublicSafetyEntity
        {
            // Load the Report
            var report = UnitOfWork.Find <TReport>(reportId);

            // Check Permissions
            RequireCreatePermissions(report.AgencyId, ReportModule);

            // Construct the Entity
            var entity = constructor(report.AgencyId, details.Id);

            // Map the Entity Details
            details.MapInto(entity);

            // Add the Entity to the Report
            add(report, entity);

            // Commit the Work
            UnitOfWork.Commit();

            // TODO: Hack until the Surrogate Keys are introduced in the Data layer.
            // TODO: Currently the Event messages will get the wrong Id unless they are raised AFTER the database commit
            // TODO: because the database may override the Guid the Domain is trying to use.
            UnitOfWork.PendingMessages.Add(DataEntryMessages.EntityCreated(entity, ReportModule, DataEntryAggregateType.Report));
            UnitOfWork.PublishPendingMessages();

            return(entity);
        }
コード例 #6
0
        protected TEntity CreateSummaryEntity <TEntity, TEntityDetails>(Guid summaryId, TEntityDetails details, EntityConstructor <TEntity> constructor,
                                                                        Action <TSummary, TEntity> add)
            where TEntityDetails : IPublicSafetyEntityDetails
            where TEntity : PublicSafetyEntity
        {
            var summary = UnitOfWork.Find <TSummary>(summaryId);

            RequireViewPermissions(summary.AgencyId, SummaryModule);

            var entity = constructor(summary.AgencyId, details.Id);

            details.MapInto(entity);
            add(summary, entity);
            _masterIndexService.ProcessMasterIndexes(entity);

            UnitOfWork.Commit();

            // TODO: Hack until the Surrogate Keys are introduced in the Data layer.
            // TODO: Currently the Event messages will get the wrong Id unless they are raised AFTER the database commit
            // TODO: because the database may override the Guid the Domain is trying to use.
            UnitOfWork.PendingMessages.Add(DataEntryMessages.EntityCreated(entity, SummaryModule, DataEntryAggregateType.Summary));
            UnitOfWork.PublishPendingMessages();

            return(entity);
        }