Exemplo n.º 1
0
        public void Init(ITimelineContext timelineContext)
        {
            this.timelineContext = timelineContext;
            this.timeline = timelineContext.GetTimeline();

            if (timeline == null || timeline.PropertyItem == null)
            {
                return;
            }

            string unit = (string)timeline.GetPropertyValue(Constants.TIME_UNIT_KEY);
            if (Constants.TIME_UNIT_MS.Equals(unit))
            {
                period = 1;
            }
            else if (Constants.TIME_UNIT_S.Equals(unit))
            {
                period = 1000;
            }
            else if (Constants.TIME_UNIT_M.Equals(unit))
            {
                period = 60000;
            }
            max = long.Parse(timeline.GetPropertyValue(Constants.TIME_MAX_KEY));

            // Init Timer
            timer.Interval = period;
            timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
            timer.AutoReset = true;
        }
Exemplo n.º 2
0
        public TimelineService(ITimelineContext context, IMapper mapper)
        {
            _mapper = mapper;

            var client   = new MongoClient(context.ConnectionString);
            var database = client.GetDatabase(context.DatabaseName);

            _tweets  = database.GetCollection <Tweet>("Tweets");
            _users   = database.GetCollection <User>("Users");
            _follows = database.GetCollection <Follow>("Followings");
        }
Exemplo n.º 3
0
 public CommandContext(ITimelineContext timelineContext)
 {
     timelineContextField = timelineContext;
 }