using Common.system;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using XHWK.Model;
using XHWK.WKTool.DAL;
namespace XHWK.WKTool
{
///
/// 文件目录
///
public partial class FileDirectoryWindow : Window
{
///
/// 视频模型
///
private List model_VideoList = null;
///
/// 数据列表
///
internal FileDirectoryData pageData = new FileDirectoryData();
///
/// 下标
///
private int Subscript = 0;
///
/// 是否是修改状态
///
private bool IsModify = false;
///
/// 文件目录
///
public FileDirectoryWindow()
{
InitializeComponent();
Initialize();
}
///
/// 初始化
///
public void Initialize()
{
APP.myloading.Show();
MouseNumber = 0;
IsModify = false;
//加载视频列表
LoadingVideoList();
int i = 1;
bool isColour = true;
pageData.menuList.Clear();
//显示视频
foreach (Model_Video videoinfo in model_VideoList)
{
//是否已上传
//videoinfo.IsUpload;
//录制时间
//videoinfo.RSTime;
//文件大小
//videoinfo.VideoSize;
//文件缩略图路径
//videoinfo.ThumbnailPath;
//文件唯一标示 上传事件筛选需要上传的视频
//videoinfo.FileGuid;
//文件存储路径
//videoinfo.VidePath;
string colour = "#FFFFFF";
if (isColour == true)
{
colour = "#FFFFFF";
isColour = false;
}
else
{
colour = "#E6F1FF";
isColour = true;
}
string vis = "Visible";
string cos = "Collapsed";
if (!videoinfo.IsUpload)
{
vis = "Collapsed";
cos = "Visible";
}
if (i <= 16)
{
pageData.menuList.Add(new FileDirectoryModel()
{
SerialNumber = i,
VideoName = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace(".AVI", "").Trim(),
Name = Common.system.FileToolsCommon.GetIOFileName(videoinfo.VideoPath).Replace(".MP4", "").Replace(".FLV", "").Replace(".AVI", "").Trim(),
FilePath = videoinfo.VideoPath.Replace(FileToolsCommon.GetIOFileName(videoinfo.VideoPath), "").Trim(),
VideoDuration = 0,
VideoSize = videoinfo.VideoSize,
VideoTime = videoinfo.RSTime,
IsEnabled = false,
Path = videoinfo.VideoPath,
Colour = colour,
Visi = vis,
Coll = cos,
FileGuid = videoinfo.FileGuid,
VideoType = videoinfo.VideoType.ToString()
}); ;
}
i++;
}
txbSum.Text = pageData.menuList.Count.ToString();
APP.myloading.Hide();
DataContext = pageData;
}
///
/// 加载视频列表
///
public void LoadingVideoList()
{
try
{
model_VideoList = new List();
foreach (Model_WKData Vdata in APP.WKDataList)
{
if (Vdata.VideoList == null)
{
continue;
}
foreach (Model_Video videoinfo in Vdata.VideoList)
{
try
{
if (string.IsNullOrWhiteSpace(videoinfo.VideoPath))
{
continue;
}
if (string.IsNullOrWhiteSpace(videoinfo.VideoSize) || videoinfo.VideoSize == "0 MB")
{
videoinfo.VideoSize = FileToolsCommon.GetFileSizeByMB(videoinfo.VideoPath).ToString() + " MB";
videoinfo.VideoSizebyte = FileToolsCommon.GetFileSize(videoinfo.VideoPath);
}
model_VideoList.Add(videoinfo);
}
catch (Exception ex)
{
LogHelper.WriteErrLog("【加载视频列表】(LoadingVideoList)" + ex.Message, ex);
}
}
}
}
catch (Exception ex)
{
LogHelper.WriteErrLog("【加载视频列表】(LoadingVideoList)" + ex.Message, ex);
}
}
///
/// 关闭
///
///
///
private void btnDown_Click(object sender, RoutedEventArgs e)
{
APP.SaveWkData();
Hide();
}
///
/// 窗口移动
///
///
///
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
DragMove();
}
///
/// 上传
///
///
///
private void BtnUpload_Click(object sender, RoutedEventArgs e)
{
pageData.menuList[Subscript].IsEnabled = false;
List