public MainWindowViewModel() { AllTransformers = Transformers.GetTransformers(); SelectedTransformer = AllTransformers.First(); RollcallOptions = SetupRollcallOptions(); ActionOptions = SetupActionOptions(); SelectedRollcallOption = RollcallOptions.First(); CallRollCommand = new RelayCommand <object>(CallRollCommandExecute); TakeActionCommand = new RelayCommand <object>(TakeActionCommandExecute); }
public MainWindowViewModel() { AllTransformers = Transformers.GetTransformers(); SelectedTransformer = AllTransformers.First(); RollcallOptions = new List <RollcallOption>() { new RollcallOption() { Name = "Name", RollCallResponse = t => t.Name }, new RollcallOption() { Name = "Affiliation", RollCallResponse = t => $"{t.Name} is a {t.Affiliation.ToString()}" }, new RollcallOption() { Name = "Alternate Form", RollCallResponse = t => t.AlternateForm }, new RollcallOption() { Name = "Rating", RollCallResponse = t => $"{t.Rating.ToString()} - {t.Name}" }, }; ActionOptions = new List <ActionOption>() { new ActionOption() { Name = "Transform", Action = t => { foreach (var transformer in t) { transformer.Transform(); } } }, new ActionOption() { Name = "Top Rated", Action = t => { MessageBox.Show($"Top rated transformer: {t.OrderByDescending(t1 => t1.Rating).First().Name}"); } }, new ActionOption() { Name = "Average Rating", Action = t => { Results.Add($"Average Rating: {t.Average(t1 => t1.Rating).ToString()}"); } }, new ActionOption() { Name = "First By Name", Action = t => { Results.Add(t.OrderBy(t1 => t1.Name).First().Name); } } }; SelectedRollcallOption = RollcallOptions.First(); CallRollCommand = new RelayCommand <object>(CallRollCommandExecute); TakeActionCommand = new RelayCommand <object>(TakeActionCommandExecute); }