/// <summary>Initializes a new instance of the <see cref="HomeModule"/> class.</summary> /// <param name="options">The options.</param> /// <param name="redisStatistics">The redis statistics.</param> public HomeModule(IOptions options, IRedisStatistics redisStatistics) { this.options = options; this.redisStatistics = redisStatistics; this.Get["/"] = parameters => { var selected = this.Request.Form["host"]; var navigationViewModel = new NavigationViewModel { Hosts = from host in this.options.Hosts select new Tuple <string, string>(host, "/?host=" + WebUtility.HtmlEncode(host)), Selected = selected }; var viewModel = new IndexViewModel(this.options.Verbose, Constants.HistoryLength) { Measures = Constants.Measures[this.options.Verbose ? "verbose" : "default"], TabMeasures = Constants.Measures["static"], Interval = this.options.Interval, History = this.redisStatistics.GetAllStats().Take(Constants.HistoryLength), Navigation = navigationViewModel }; return(this.View["Index.cshtml", viewModel]); }; }
/// <summary>Initializes a new instance of the <see cref="RedisStatsHub"/> class.</summary> /// <param name="redisStats">The redis stats.</param> public RedisStatsHub(IRedisStatistics redisStats) { this.redisStats = redisStats; }
/// <summary>Initializes a new instance of the <see cref="HomeController"/> class.</summary> /// <param name="options">The options.</param> /// <param name="redisStatistics">The redis Stats.</param> public HomeController(IOptions options, IRedisStatistics redisStatistics) { this.options = options; this.redisStatistics = redisStatistics; }