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.
|
|
|
|
using KGIS.Framework.Utils;
|
|
|
|
|
using KGIS.Framework.Utils.Helper;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.Plugin.General.View
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// UCVideo.xaml 的交互逻辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class UCVideo : BaseWindow
|
|
|
|
|
{
|
|
|
|
|
public string VideoPath { get; set; }
|
|
|
|
|
private bool isPause = false;
|
|
|
|
|
public UCVideo()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PlayVideo()
|
|
|
|
|
{
|
|
|
|
|
if(string.IsNullOrEmpty(VideoPath))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("视频地址为空。", "错误提示", MessageBoxButton.OK);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
MediaPlayer.Source = new Uri(VideoPath);
|
|
|
|
|
MediaPlayer.Play();
|
|
|
|
|
isPause = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool? ShowInMainWindow(bool isModel = false)
|
|
|
|
|
{
|
|
|
|
|
return this.ShowInMainForm(isModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnPlay_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
PlayVideo();
|
|
|
|
|
isPause = false;
|
|
|
|
|
btnStop.Content = "暂停";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnStop_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if(isPause) //暂停
|
|
|
|
|
{
|
|
|
|
|
MediaPlayer.Play();
|
|
|
|
|
isPause = false;
|
|
|
|
|
btnStop.Content = "暂停";
|
|
|
|
|
}
|
|
|
|
|
else //播放
|
|
|
|
|
{
|
|
|
|
|
MediaPlayer.Pause();
|
|
|
|
|
isPause = true;
|
|
|
|
|
btnStop.Content = "继续";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|