/* * Copyright (c) 2022 LG Electronics Inc. * SPDX-License-Identifier: LicenseRef-LGE-Proprietary */ using Aurora.View; using AuroraUIComponent.Sequence; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AuroraUIComponent.UserControls.SequenceDrawer { public class UCSequenceDiagramControlListViewModel : NotifyPropertyChangedBase { private List _ViewModels; public List ViewModels { get => _ViewModels; set => SetProperty(ref _ViewModels, value); } private UCSequenceDiagramControlViewModel _SelectedVM; public UCSequenceDiagramControlViewModel SelectedVM { get => _SelectedVM; set { if (SetProperty(ref _SelectedVM, value)) { /*NotifyPropertyChanged(nameof(SelectedSeqId));*/ } } } private List _SeqList; public List SeqList { get => _SeqList; set => SetProperty(ref _SeqList, value); } private bool _ShowList = false; public bool ShowList { get => _ShowList; set => SetProperty(ref _ShowList, value); } public void SetSeqList(List list, string seqId = null) { if (list == null) return; SeqList = list; var newList = new List(); SeqList.ForEach(x => newList.Add(new UCSequenceDiagramControlViewModel() { SelectedSeq = x, EnableZoomButton = true, })); ViewModels = newList; SelectedVM = ViewModels.FirstOrDefault(x => x.SelectedSeq.SeqId == seqId); } public void SelectSequence(string seqId) { if (!string.IsNullOrEmpty(seqId) && SeqList.Any(x => x.SeqId == seqId)) { SelectedVM = ViewModels.FirstOrDefault(x => x.SelectedSeq?.SeqId == seqId); } } } }