public UserController(TimelineContext timelineContext, IUserService userService, IMapper mapper, ILogger <UserController> logger)
 {
     _timelineContext = timelineContext;
     _userService     = userService;
     _mapper          = mapper;
     _log             = logger;
 }
示例#2
0
 public BoardController(TimelineContext timelineContext, ILogger <BoardController> log,
                        IAuditService auditService)
 {
     _timelineContext = timelineContext;
     _auditService    = auditService;
     _log             = log;
 }
示例#3
0
    public static Ray InterpolateRay(Timeline <Ray> timeline, TimelineContext <Ray> context)
    {
        float interpFactor = (float)(context.Time - context.Prev.Time) / (float)(context.Next.Time - context.Prev.Time);

        return(new Ray(
                   Vector3.Lerp(context.Prev.Value.origin, context.Next.Value.origin, interpFactor),
                   Vector3.Slerp(context.Prev.Value.direction, context.Next.Value.direction, interpFactor)));
    }
示例#4
0
 public static Ray ExtrapolateRay(Timeline <Ray> timeline, TimelineContext <Ray> context)
 {
     if (context.Prev.Prev != null && context.Prev.Prev.Time != context.Prev.Time)
     {
         return(context.Prev.Value);
     }
     else
     {
         return(context.Prev.Value);
     }
 }
示例#5
0
 public static Vector3 ExtrapolateVector3Slerp(Timeline <Vector3> timeline, TimelineContext <Vector3> context)
 {
     if (context.Prev.Prev != null && context.Prev.Prev.Time != context.Prev.Time)
     {
         return(ExtrapolateVector3Slerp(context.Prev.Prev.Value, context.Prev.Value,
                                        (float)(context.Prev.Time - context.Prev.Prev.Time), (float)(context.Time - context.Prev.Prev.Time)));
     }
     else
     {
         return(context.Prev.Value);
     }
 }
示例#6
0
 public static float ExtrapolateAngleSlerp(Timeline <float> timeline, TimelineContext <float> context)
 {
     if (context.Prev.Prev != null && context.Prev.Prev.Time != context.Prev.Time)
     {
         return(ExtrapolateAngleSlerp(
                    context.Prev.Prev.Value, context.Prev.Value,
                    (float)(context.Prev.Time - context.Prev.Prev.Time),
                    (float)(context.Time - context.Prev.Prev.Time)));
     }
     else
     {
         return(context.Prev.Value);
     }
 }
示例#7
0
        public PlacesRepositoryTestsFixture()
        {
            Hierarchy = new Hierarchy <string>();
            Hierarchy.AddTopNode("universe", "Universe");
            Hierarchy.GetNodeById("universe").AddSubNode("solar_system", "Solar system");
            Hierarchy.GetNodeById("solar_system").AddSubNode("earth", "Earth");
            Hierarchy.GetNodeById("solar_system").AddSubNode("mars", "Mars");

            Db = TimelineContextProvider.GetDbContext();

            Repo = new PlacesRepository(Db);

            EventsRepo = new EventsRepository(Db);
        }
        public IdsEventsSpecificationTestsFixture()
        {
            Db = TimelineContextProvider.GetDbContext();

            EventsRepo = new EventsRepository(Db);

            Events = new[]
            {
                new Event <string, string>("A", SpecificDate.BeforeChrist(10), SpecificDate.AnnoDomini(12)),
                new Event <string, string>("B", SpecificDate.BeforeChrist(20, 5)),
                new Event <string, string>("C", SpecificDate.AnnoDomini(2020, 1, 1), NowDate.Instance),
                new Event <string, string>("D", NowDate.Instance),
                new Event <string, string>("E", SpecificDate.BeforeChrist(100, 2, 3, 10), SpecificDate.BeforeChrist(100, 2, 3, 20)),
            };
        }
示例#9
0
 public static Quaternion ExtrapolateQuaternionSlerp(Timeline <Quaternion> timeline,
                                                     TimelineContext <Quaternion> context)
 {
     if (context.Prev.Prev != null && context.Prev.Prev.Time != context.Prev.Time)
     {
         return(ExtrapolateQuaternionSlerp(
                    context.Prev.Prev.Value, context.Prev.Value,
                    (float)(context.Prev.Time - context.Prev.Prev.Time),
                    (float)(context.Time - context.Prev.Prev.Time)));
     }
     else
     {
         return(context.Prev.Value);
     }
 }
示例#10
0
        /// <summary>
        /// Will check the specified <paramref name="animationContext"/> for conflicts with already
        /// scheduled animations and returns those conflicts.
        /// </summary>
        /// <param name="animationContext">The new animation context to check against the running
        /// animations.</param>
        /// <param name="conflictingAnimations">Returns all already running or sleeping animations with
        /// conflicting properties.</param>
        /// <param name="conflictingProperties">Conflicting data descriptors mapped to their original
        /// values. This returned value can be used to initialize the original values of the new animation.</param>
        protected void FindConflicts(
            AnimationContext animationContext,
            out ICollection <AnimationContext> conflictingAnimations,
            out IDictionary <IDataDescriptor, object> conflictingProperties)
        {
            Timeline        newTL   = animationContext.Timeline;
            TimelineContext context = animationContext.TimelineContext;
            IDictionary <IDataDescriptor, object> newProperties = new Dictionary <IDataDescriptor, object>();

            newTL.AddAllAnimatedProperties(context, newProperties);
            ICollection <IDataDescriptor> newPDs = newProperties.Keys;

            conflictingAnimations = new List <AnimationContext>();
            conflictingProperties = new Dictionary <IDataDescriptor, object>();
            lock (_syncObject)
            {
                // Find conflicting properties in the values to be set
                foreach (KeyValuePair <IDataDescriptor, object> property in new Dictionary <IDataDescriptor, object>(_valuesToSet))
                {
                    if (!newPDs.Contains(property.Key))
                    {
                        continue;
                    }
                    conflictingProperties[property.Key] = property.Value;
                    _valuesToSet.Remove(property.Key);
                }
                // Find conflicting animations and conflicting animated properties
                foreach (AnimationContext ac in _scheduledAnimations)
                {
                    IDictionary <IDataDescriptor, object> animProperties = new Dictionary <IDataDescriptor, object>();
                    ac.Timeline.AddAllAnimatedProperties(ac.TimelineContext, animProperties);
                    bool isConflict = false;
                    foreach (KeyValuePair <IDataDescriptor, object> animProperty in animProperties)
                    {
                        if (!newPDs.Contains(animProperty.Key))
                        {
                            continue;
                        }
                        isConflict = true;
                        conflictingProperties[animProperty.Key] = animProperty.Value;
                    }
                    if (isConflict)
                    {
                        conflictingAnimations.Add(ac);
                    }
                }
            }
        }
示例#11
0
        public static TimelineContext GetDbContext(Action <TimelineContext> initialize = null)
        {
            var optionsBuilder = new DbContextOptionsBuilder <TimelineContext>();

            optionsBuilder.ConfigureWarnings(builder => {
                builder.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning);
            });
            optionsBuilder.UseInMemoryDatabase("TimelineInMemory", new InMemoryDatabaseRoot());

            var options = optionsBuilder.Options;

            var dbContext = new TimelineContext(options);

            InitializeDbContext(dbContext, initialize);

            return(dbContext);
        }
示例#12
0
 public AuditController(TimelineContext timelineContext, IAuditService auditService)
 {
     _auditService    = auditService;
     _timelineContext = timelineContext;
 }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, TimelineContext context)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseApplicationInsightsRequestTelemetry();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseApplicationInsightsExceptionTelemetry();

            app.UseStaticFiles();

            app.UseIdentity();

            // Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            DbInitializer.Initialize(context);
        }
示例#14
0
        public static void Initialize(TimelineContext context)
        {
            context.Database.EnsureCreated();

            //  Look for any timelines.
            if (context.Focuses.Any())
            {
                return;       // DB has been seeded
            }

            var focuses = new Focus[]
            {
                new Focus {
                    Name = "The Internet", Description = "Focusing on the history of the Internet"
                },
                new Focus {
                    Name = "Me", Description = "This is for timelines looking back on my life"
                }
            };

            foreach (Focus f in focuses)
            {
                context.Focuses.Add(f);
            }
            context.SaveChanges();

            var timelines = new Timeline[]
            {
                new Timeline {
                    Title = "Childhood Memories", Description = "Looking back on my childhood", BeginDate = DateTime.Parse("1990-01-01"), EndDate = DateTime.Parse("2001-09-01"), FocusID = 2
                },
                new Timeline {
                    Title = "High School", Description = "My high school experience", BeginDate = DateTime.Parse("2001-09-01"), EndDate = DateTime.Parse("2005-06-15"), FocusID = 2
                },
                new Timeline {
                    Title = "The Dotcom Boom", Description = "The mainstream commercialization and impending bubble of eCommerce in the late 90's", BeginDate = DateTime.Parse("1995-01-01"), EndDate = DateTime.Parse("2001-09-01"), FocusID = 1
                },
                new Timeline {
                    Title = "The Beginnings", Description = "Early reseach and precursors to the Internet as we know it today", BeginDate = DateTime.Parse("1966-01-01"), EndDate = DateTime.Parse("1982-01-01"), FocusID = 1
                }
            };

            foreach (Timeline t in timelines)
            {
                context.Timelines.Add(t);
            }
            context.SaveChanges();

            var events = new Event[]
            {
                new Event {
                    TimelineID = 1, Title = "Watching the Matrix at in a hotel", Description = "I remember watching the Matrix on the TV in a hotel and I was so hyped about it that I chugged a bunch of water and threw up! Ha.", Date = DateTime.Parse("1999-08-01")
                },
                new Event {
                    TimelineID = 1, Title = "Getting my saxophone", Description = "I remember opening up my saxophone case for the first time and how cool I thought it was", Date = DateTime.Parse("1998-06-10")
                },
                new Event {
                    TimelineID = 2, Title = "Iraq War begins", Description = "I remember being at a track fundraiser when the bombings over Iraq started and feeling weird that nobody was talking about it.", Date = DateTime.Parse("2003-03-20")
                },
                new Event {
                    TimelineID = 3, Title = "Pets.com folds :(", Description = "A prime example of a Dot-com bubble failure.  I will never forget that stupid sock-puppet mascot!", Date = DateTime.Parse("2000-11-01")
                },
                new Event {
                    TimelineID = 3, Title = "GeoCities purchased by Yahoo!", Description = "An example of the sort of deals going on at the time, Yahoo! purchased GeoCities for 3.57 billion", Date = DateTime.Parse("1999-01-01")
                },
                new Event {
                    TimelineID = 4, Title = "ARPANET planning starts", Description = "Bob Taylor and others start planning the Advanced Research Projects Agency Network", Date = DateTime.Parse("1966-01-01")
                },
                new Event {
                    TimelineID = 4, Title = "Ethernet standar introduced", Description = "", Date = DateTime.Parse("1980-01-01")
                }
            };

            foreach (Event e in events)
            {
                context.Events.Add(e);
            }
            context.SaveChanges();
        }
示例#15
0
 private static void InitializeDbContext(TimelineContext dbContext, Action <TimelineContext> initialize)
 {
     initialize?.Invoke(dbContext);
 }
示例#16
0
 public UserService(TimelineContext timelineContext, IOptions <AppSettings> appSettings, IMapper mapper)
 {
     _timelineContext = timelineContext;
     _appSettings     = appSettings.Value;
     _mapper          = mapper;
 }
示例#17
0
 public UserController(TimelineContext timelineContext, IUserService userService, ILogger <UserController> log)
 {
     _log             = log;
     _timelineContext = timelineContext;
     _userService     = userService;
 }
 public CachingTeamResolver(TimelineContext timelineContext, IMemoryCache cache, ILoggerFactory loggerFactory) : base(cache, loggerFactory)
 {
     _timelineContext = timelineContext;
 }
示例#19
0
 public static float InterpolateAngleSlerp(Timeline <float> timeline, TimelineContext <float> context)
 {
     return(InterpolateAngleSlerp(context.Prev.Value, context.Next.Value,
                                  (float)(context.Time - context.Prev.Time) / (float)(context.Next.Time - context.Prev.Time)));
 }
 public EventsController(TimelineContext context)
 {
     _context = context;
 }
 public SyncController(TimelineContext context)
 {
     _context = context;
 }
示例#22
0
 public static Vector3 InterpolateVector3Slerp(Timeline <Vector3> timeline, TimelineContext <Vector3> context)
 {
     return(Vector3.Slerp(context.Prev.Value, context.Next.Value,
                          (float)(context.Time - context.Prev.Time) / (float)(context.Next.Time - context.Prev.Time)));
 }
        public NotEventsSpecificationTestsFixture()
        {
            Db = TimelineContextProvider.GetDbContext();

            EventsRepo = new EventsRepository(Db);
        }
示例#24
0
        public EventsRepositoryTests()
        {
            _db = TimelineContextProvider.GetDbContext();

            _repo = new EventsRepository(_db);
        }
示例#25
0
 public static Quaternion InterpolateQuaternionSlerp(Timeline <Quaternion> timeline,
                                                     TimelineContext <Quaternion> context)
 {
     return(Quaternion.Slerp(context.Prev.Value, context.Next.Value,
                             (float)(context.Time - context.Prev.Time) / (float)(context.Next.Time - context.Prev.Time)));
 }
示例#26
0
 public UserService(TimelineContext timelineContext, IOptions <AppSettings> appSettings)
 {
     _timelineContext = timelineContext;
     _appSettings     = appSettings.Value;
 }
 public BoardController(TimelineContext timelineContext, IMapper mapper)
 {
     _timelineContext = timelineContext;
     _mapper          = mapper;
 }
示例#28
0
 public TimelinesController(TimelineContext context)
 {
     _context = context;
 }