Beispiel #1
0
        /// <summary>
        /// Populate the results table with the latest information from the model
        /// </summary>
        private void PopulateResultsTable()
        {
            this.ResultsTable = new ObservableCollection <ResultsTableRowViewModel>();

            foreach (IResultsTableEntry entry in this.model.ResultsTable.Entries)
            {
                this.ResultsTable.Add(
                    new ResultsTableRowViewModel(
                        entry.Key,
                        entry.Position,
                        entry.Name,
                        entry.Club,
                        entry.Handicap.ToString(),
                        entry.ExtraInfo,
                        entry.Notes,
                        entry.FirstTimer,
                        entry.RunningOrder,
                        entry.PB,
                        entry.Points.TotalPoints,
                        entry.Points.FinishingPoints,
                        entry.Points.PositionPoints,
                        entry.Points.BestPoints,
                        entry.HarmonyPoints,
                        entry.RaceNumber,
                        entry.Time.ToString(),
                        entry.RunningTime.ToString(),
                        entry.Sex.ToString(),
                        entry.SB));
            }

            this.resultsOrder = ResultsOrder.Time;
        }
Beispiel #2
0
        /// <summary>
        /// Run the <see cref="ResultsOrderBySpeedCommand"/>.
        /// </summary>
        public void OrderResultsBySpeed()
        {
            this.SetResults(
                this.ResultsTable.OrderBy(
                    rs => rs.RunningOrder).ToList());

            this.resultsOrder = ResultsOrder.Speed;
        }
Beispiel #3
0
        /// <summary>
        /// Run the <see cref="ResultsOrderByTimeCommand"/>.
        /// </summary>
        public void OrderResultsByTime()
        {
            this.SetResults(
                this.ResultsTable.OrderBy(
                    rs => rs.TotalTime).ToList());

            this.resultsOrder = ResultsOrder.Time;
        }
Beispiel #4
0
        /// <summary>
        /// Initialises a new instance of the <see cref="ResultsTableViewModel"/> class.
        /// </summary>
        /// <param name="model">Junior handicap model</param>
        public ResultsTableViewModel(
            IHandicapEvent model)
        {
            this.model        = model;
            this.resultsOrder = ResultsOrder.Default;

            model.ResultsChangedEvent += this.ModelResultsChanged;
            //model.CurrentSeason.CurrentEvent.ResultsCallback = new ResultsDelegate(this.PopulateResultsTable);

            ExpandCommand =
                new SimpleCommand(
                    this.UpdateExpandedFlag);

            this.ResultsOrderBySpeedCommand =
                new SimpleCommand(
                    this.OrderResultsBySpeed,
                    this.CanOrderResultsBySpeed);
            this.ResultsOrderByTimeCommand =
                new SimpleCommand(
                    this.OrderResultsByTime,
                    this.CanOrderResultsByTime);

            this.PopulateResultsTable();
        }