Beispiel #1
0
        /// <summary>
        /// Initializes the view with elements.
        /// If there is more elements then argument howMany then it skips some statistics at the beginning.
        /// </summary>
        /// <param name="view"></param>
        /// <param name="howMany">How many elements should be presented at once</param>
        public void InitializeViewStatistics(IViewInterface view, int howMany)
        {
            Initialize();
            view.ClearStatisticsBox();
            for (int i = Math.Max(0, solves.Count - howMany); i < solves.Count; ++i)
            {
                TimeSpan x = TimeSpan.FromMilliseconds(solves[i].SolveTime);

                int    length           = 5;
                string paddedId         = solves[i].Id.ToString();
                int    calculatePadLeft = (((length - paddedId.Length) / 2) + paddedId.Length);
                paddedId = paddedId.PadLeft(calculatePadLeft).PadRight(length);

                view.AddStatistics($"[{paddedId}] {x.ToString(@"hh\:mm\:ss\:ff")}");
            }
            UpdateLabels(view);
        }