private Color getStatusColor(MyTrainingLightDTO value) { if (value.TrainingEnd == TrainingEnd.Complete) { if (value.PercentageCompleted == 100) { return(Colors.Green); } return(Colors.Red); } return(Colors.Blue); }
public void Fill(MyTrainingLightDTO myTraining) { this.myTraining = myTraining; lblTrainingState.Text = EnumLocalizer.Default.Translate(myTraining.TrainingEnd); lblTrainingState.Foreground = new SolidColorBrush(getStatusColor(myTraining)); lblPercentageResult.Text = string.Format(Strings.CompletePercentageResult, myTraining.PercentageCompleted); tbStart.Text = myTraining.StartDate.ToShortDateString(); if (myTraining.EndDate.HasValue) { lblEndDate.Visibility = System.Windows.Visibility.Visible; tbEnd.Visibility = System.Windows.Visibility.Visible; btnAbortMyTraining.Visibility = System.Windows.Visibility.Collapsed; tbEnd.Text = myTraining.EndDate.Value.ToShortDateString(); } else { lblEndDate.Visibility = System.Windows.Visibility.Collapsed; tbEnd.Visibility = System.Windows.Visibility.Collapsed; btnAbortMyTraining.Visibility = System.Windows.Visibility.Visible; } }