2026-06-05 13:44:39 +09:00

56 lines
1.9 KiB
C#

/*
* 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<UCSequenceDiagramControlViewModel> _ViewModels;
public List<UCSequenceDiagramControlViewModel> 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<SeqInfo> _SeqList;
public List<SeqInfo> 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<SeqInfo> list, string seqId = null)
{
if (list == null) return;
SeqList = list;
var newList = new List<UCSequenceDiagramControlViewModel>();
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);
}
}
}
}