public Step3ViewModel(ObservableCollection <WizardViewModel.Step> steps) { _steps = steps; Governance = InitializeGovernance.Create(); IndicatorChoices = new List <GovernanceIndicatorViewModel>(); foreach (var majorIndicator in Governance.Children) { foreach (var subIndicator in majorIndicator.Children) { IndicatorChoices.Add(new GovernanceIndicatorViewModel { Indicator = subIndicator as GovernanceIndicator, MajorIndicator = majorIndicator.Name }); } } }
private void OnDeserialized(StreamingContext context = default(StreamingContext)) { Attributes = Attributes ?? new Attributes(); Assets = Assets ?? new ModelAssets(); Governance = Governance ?? InitializeGovernance.Create(); EcosystemServices = EcosystemServices ?? InitializeEcosystemServices.Create(); EcosystemVitality = EcosystemVitality ?? InitializeEcosystemVitality.Create(); #region Backward Compatibility #pragma warning disable 612 var bc = EcosystemVitality.FetchIndicator <Indicator>("Basin Condition"); PotadromousIndicator p = null; DiadromousIndicator d = null; foreach (var indicator in bc.Children) { switch (indicator) { case PotadromousIndicator potadromousIndicator: p = potadromousIndicator; break; case DiadromousIndicator diadromousIndicator: d = diadromousIndicator; break; } } #pragma warning restore 612 if (p != null || d != null) { bc.Children.Remove(p); bc.Children.Remove(d); var ci = new ConnectivityIndicator { Reaches = p?.Reaches }; bc.Children.Add(ci); foreach (var child in bc.Children) { child.Weight = 1.0 / bc.Children.Count; } } // bank modification and land cover indicators var cm = bc.FetchIndicator <BankModificationIndicator>(); if (cm == null) { bc.Children.Add(new BankModificationIndicator()); } var lc = bc.FetchIndicator <LandCoverIndicator>(); if (lc == null) { bc.Children.Add(new LandCoverIndicator()); } // old conservation areas manual indicator var mca = EcosystemServices.FetchIndicator <ManualIndicator>("Conservation Areas"); if (mca != null) { var cai = new ConservationAreaIndicator(); // preserve old data if (mca.Value != null || mca.UserOverride != null) { cai.UserOverride = mca.Value ?? mca.UserOverride; cai.OverrideComment = mca.OverrideComment ?? "User's manual input."; } cai.Weight = mca.Weight ?? 0.5; var culture = EcosystemServices.FetchIndicator <Indicator>("Cultural"); culture.Children.Remove(mca); culture.Children.Add(cai); } #endregion Backward Compatibility }