56 lines
1.5 KiB
C#
56 lines
1.5 KiB
C#
using BeWo.ServiceProxy;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
using ChatController.Utilities.Extensions;
|
|
using DevExpress.Mvvm;
|
|
using DevExpress.XtraPrinting.Native;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Threading;
|
|
|
|
namespace BeWo.ViewModel.ListViewModel
|
|
{
|
|
public class AiConversationMessageListVM : AbstractDCListMapperVM<AiConversationMessageDC, AiConversationMessageVM>
|
|
{
|
|
public AiConversationMessageListVM() : this(null) { }
|
|
public AiConversationMessageListVM(List<AiConversationMessageDC> pDCs) : base(pDCs)
|
|
{
|
|
VMList.ListChanged += (s, e) =>
|
|
{
|
|
if (e.ListChangedType == ListChangedType.ItemChanged)
|
|
{
|
|
var changedItem = VMList[e.NewIndex];
|
|
Item_PropertyChanged(changedItem, new PropertyChangedEventArgs(nameof(AiConversationMessageVM.IsChecked)));
|
|
}
|
|
};
|
|
}
|
|
|
|
private void Item_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
{
|
|
if (e.PropertyName == nameof(AiConversationMessageVM.IsChecked))
|
|
{
|
|
var changedItem = (AiConversationMessageVM)sender;
|
|
int index = VMList.IndexOf(changedItem);
|
|
|
|
if (changedItem.IsChecked)
|
|
{
|
|
for (int i = 0; i <= index; i++)
|
|
if (!VMList[i].IsChecked)
|
|
VMList[i].IsChecked = true;
|
|
}
|
|
else
|
|
{
|
|
for (int i = index; i < VMList.Count; i++)
|
|
if (VMList[i].IsChecked)
|
|
VMList[i].IsChecked = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|