174 lines
4.3 KiB
C#
174 lines
4.3 KiB
C#
using Standard;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Collections.ObjectModel;
|
||
using System.Collections.Specialized;
|
||
using System.ComponentModel;
|
||
using System.Globalization;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using System.Runtime.CompilerServices;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using System.Windows.Data;
|
||
using System.Windows.Input;
|
||
using System.Windows.Threading;
|
||
using System.Xml.Linq;
|
||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Header;
|
||
using static VideoConcat.Models.VideoModel;
|
||
|
||
namespace VideoConcat.Models
|
||
{
|
||
|
||
|
||
public class ExtractWindowModel : INotifyPropertyChanged
|
||
{
|
||
|
||
private string _folderPath = "";
|
||
private string _helpInfo = "";
|
||
private bool _canExtractFrame = false;
|
||
private bool _canModify = false;
|
||
private bool _isCanOperate = false;
|
||
private bool _isStart = false;
|
||
private string[] _videos = [];
|
||
private int _extractCount = 1;
|
||
private Dispatcher _dispatcher;
|
||
|
||
public string[] videos
|
||
{
|
||
get => _videos;
|
||
set
|
||
{
|
||
_videos = value;
|
||
OnPropertyChanged();
|
||
}
|
||
}
|
||
|
||
public bool IsCanOperate
|
||
{
|
||
get => _isCanOperate;
|
||
set
|
||
{
|
||
_isCanOperate = value;
|
||
OnPropertyChanged();
|
||
}
|
||
}
|
||
|
||
public bool IsStart
|
||
{
|
||
get => _isStart;
|
||
set
|
||
{
|
||
_isStart = value;
|
||
OnPropertyChanged();
|
||
}
|
||
}
|
||
|
||
public Dispatcher Dispatcher
|
||
{
|
||
get => _dispatcher;
|
||
set
|
||
{
|
||
_dispatcher = value;
|
||
}
|
||
}
|
||
|
||
|
||
public class VideoStruct
|
||
{
|
||
public int Index { set; get; }
|
||
public string FileName { set; get; } = "";
|
||
public string Size { set; get; } = "";
|
||
public int Seconds { set; get; }
|
||
public string Status { set; get; } = "";
|
||
public string Progress { set; get; } = "";
|
||
}
|
||
|
||
public string FolderPath
|
||
{
|
||
get { return _folderPath; }
|
||
set
|
||
{
|
||
_folderPath = value;
|
||
OnPropertyChanged(nameof(FolderPath));
|
||
}
|
||
}
|
||
|
||
public string HelpInfo
|
||
{
|
||
get { return _helpInfo; }
|
||
set
|
||
{
|
||
_helpInfo = value;
|
||
OnPropertyChanged();
|
||
}
|
||
}
|
||
|
||
public bool CanExtractFrame
|
||
{
|
||
get { return _canExtractFrame; }
|
||
set
|
||
{
|
||
_canExtractFrame = value;
|
||
OnPropertyChanged(nameof(CanExtractFrame));
|
||
}
|
||
}
|
||
public bool CanModify
|
||
{
|
||
get { return _canModify; }
|
||
set
|
||
{
|
||
_canModify = value;
|
||
OnPropertyChanged(nameof(CanModify));
|
||
}
|
||
}
|
||
|
||
public ICommand? BtnOpenFolderCommand { get; set; }
|
||
public ICommand? BtnStartVideoConcatCommand { get; set; }
|
||
public ICommand? BtnStartVideoModifyCommand { get; set; }
|
||
public ICommand? BtnChooseAuditImageCommand { get; set; }
|
||
|
||
public event PropertyChangedEventHandler? PropertyChanged;
|
||
|
||
|
||
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
||
{
|
||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||
}
|
||
|
||
|
||
public ExtractWindowModel()
|
||
{
|
||
_dispatcher = Dispatcher.CurrentDispatcher;
|
||
}
|
||
|
||
public int ExtractCount
|
||
{
|
||
get => _extractCount;
|
||
set
|
||
{
|
||
_extractCount = value;
|
||
OnPropertyChanged();
|
||
SetCanStart();
|
||
}
|
||
}
|
||
|
||
public void SetCanStart()
|
||
{
|
||
// 有视频文件且生成个数大于0时,可以抽帧
|
||
CanExtractFrame = videos.Length > 0 && _extractCount > 0;
|
||
|
||
// 有视频文件时可以修改
|
||
if (videos.Length > 0)
|
||
{
|
||
CanModify = true;
|
||
}
|
||
else
|
||
{
|
||
CanModify = false;
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|