示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RowerPage"/> class.
        /// </summary>
        /// <param name="id">The identifier.</param>
        public RowerPage(int id)
        {
            InitializeComponent();

            GlobalData.Instance.RowersPosition = RowersPosition.Left;

            _id = id;

            _vm = new RowerPageViewModel();
            this.DataContext = _vm;

            Refresh();

            // Timer zum Aktualisieren der grafischen verbleibenden Wiegedauer
            _refreshRemainingTimeTimer          = new Timer(2 * 60 * 1000); // 2 Minuten
            _refreshRemainingTimeTimer.Elapsed += RefreshRemainingTimeTimer_Elapsed;
            _refreshRemainingTimeTimer.Start();
        }
示例#2
0
        /// <summary>
        /// Refreshes this instance.
        /// </summary>
        private void Refresh()
        {
            try
            {
                RefreshCurrentTime(); // lokal gespeicherte Zeit aktualisieren, kann Fehler werfen!
            }
            catch (Exception ex)
            {
                Tools.ShowError(ex.Message);
                return;
            }

            var boatBuilder = new BoatBuilder(_currentTime);

            var rowersData = GlobalData.Instance.RowersData;
            var racesData  = GlobalData.Instance.RacesData;

            #region Infos zum Ruderer

            var dbRower = rowersData.SingleOrDefault(x => x.Id == _id);

            _vm.Name        = $"{dbRower.LastName}, {dbRower.FirstName}";
            _vm.Gender      = dbRower.Gender;
            _vm.YearOfBirth = dbRower.DateOfBirth.Year.ToString();
            _vm.Club        = dbRower.ClubTitleLong;

            #endregion

            #region bisherige Gewichtsmessungen

            // Deutsche Bezeichnung für die Wochentage
            var culture = new System.Globalization.CultureInfo("de-DE");

            // Alle bisherigen Gewichtsmessungen
            _vm.Weightings = GlobalData.Instance.Weightings.Where(x => x.Id == _id).OrderByDescending(x => x.Zeitstempel).Select(x => new RowerPageViewModel.Weighting()
            {
                Mass = x.Gewicht.ToString(),
                Date = culture.DateTimeFormat.GetDayName(x.Zeitstempel.DayOfWeek),
                Time = $"{x.Zeitstempel:HH:mm:ss}"
            }).ToObservableCollection();