You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

49 lines
1.3 KiB

using EC.Entity.Video;
using EC.UsingEventAggregator;
using Prism.Events;
using Prism.Regions;
using System.Windows.Controls;
using System.Windows.Input;
namespace ECMonitor.Page.CameraMonitor
{
/// <summary>
/// UCMainLeft.xaml 的交互逻辑
/// </summary>
public partial class CameraTreeView : UserControl
{
public IRegionManager _regionManager { get; set; }
public IEventAggregator _ea { get; set; }
public CameraTreeView(IRegionManager regionManager, IEventAggregator ea)
{
_regionManager = regionManager;
_ea = ea;
InitializeComponent();
}
/// <summary>
/// TreesView's SelectedItem is read-only. Hence we can't bind it. There is a way to obtain a selected item.
/// </summary>
/// <param name="sender"></param>
/// <param name="mouseButtonEventArgs"></param>
private void TreeView_MouseDoubleClick(object sender, MouseButtonEventArgs mouseButtonEventArgs)
{
var node = (TreeView)sender;
var item = node.SelectedItem;
var type = item?.GetType();
if (type == null)
return;
if (type == typeof(MsVideoRecorder))
{
var recoder = (MsVideoRecorder)item;
}
else if (type == typeof(MonitorCamera))
{
var camera = (MonitorCamera)item;
_ea.GetEvent<ShowVoideInMainEvent>().Publish(camera.Ip);
}
}
}
}