public override void LoadData() { Model.LoadData(Parent.Frames.Values.Select(x => x.Model).ToArray()); CheckForErrors(); CreateFrames(); SelectedWhisker = Whiskers.First(); Initialise(); Loaded = true; }
private void CreateFrames() { ObservableCollection <SingleWhiskerFrequencyViewModel> whiskers = new ObservableCollection <SingleWhiskerFrequencyViewModel>(); foreach (ISingleWhiskerFrequency frequency in Model.Whiskers) { SingleWhiskerFrequencyViewModel frequencyViewModel = new SingleWhiskerFrequencyViewModel(frequency); //frequencyViewModel.EnabledChanged += PropagateWhiskerEnabledNotification; whiskers.Add(frequencyViewModel); } Whiskers = whiskers; SelectedWhisker = Whiskers.First(); ObservableCollection <WhiskersEnabledViewModel> displayWhiskers = new ObservableCollection <WhiskersEnabledViewModel>(); foreach (SingleWhiskerFrequencyViewModel whisker in Whiskers) { WhiskersEnabledViewModel displayWhisker = new WhiskersEnabledViewModel(this, whisker); displayWhiskers.Add(displayWhisker); } ObservableCollection <AngleTypeBase> angleOptions = new ObservableCollection <AngleTypeBase>(); IWhisker nosePoint = Parent.CurrentFrame.Whiskers.Select(x => x.Model).FirstOrDefault(x => x.WhiskerId == -1); IWhisker orientationPoint = Parent.CurrentFrame.Whiskers.Select(x => x.Model).FirstOrDefault(x => x.WhiskerId == 0); if (nosePoint != null && orientationPoint != null) { angleOptions.Add(new CenterLineViewModel()); } angleOptions.Add(new VerticalViewModel()); angleOptions.Add(new HorizontalViewModel()); AngleOptions = angleOptions; SelectedAngleOption = AngleOptions.First(); DisplayWhiskers = displayWhiskers; CreateGraphData(); }