|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using CPF;
|
|
|
|
using CPF.Drawing;
|
|
|
|
using CPF.Controls;
|
|
|
|
using CPF.Shapes;
|
|
|
|
using CPF.Styling;
|
|
|
|
using CPF.Animation;
|
|
|
|
using CPF.Svg;
|
|
|
|
using CPF.Input;
|
|
|
|
using static System.Net.Mime.MediaTypeNames;
|
|
|
|
|
|
|
|
namespace AKS.EnterpriseLibrary.WebBrowser
|
|
|
|
{
|
|
|
|
public class AksVideoPlayer : Control
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// apt-get install libvlc-dev
|
|
|
|
/// apt-get install vlc
|
|
|
|
/// </summary>
|
|
|
|
public string videoTitle = string.Empty;
|
|
|
|
public string url = string.Empty;
|
|
|
|
private VideoView vplayer = null;
|
|
|
|
public AksVideoPlayer(Window window, string _videoTitle,string _url)
|
|
|
|
{
|
|
|
|
vplayer = new VideoView
|
|
|
|
{
|
|
|
|
Name = "player",
|
|
|
|
PresenterFor = this,
|
|
|
|
MarginTop = 50,
|
|
|
|
Size = SizeField.Fill,
|
|
|
|
Background = Color.Silver
|
|
|
|
};
|
|
|
|
videoTitle = _videoTitle;
|
|
|
|
url = _url;
|
|
|
|
this.window = window;
|
|
|
|
window.Children.Add(mask);
|
|
|
|
window.Children.Add(this);
|
|
|
|
mask.TransitionValue(a => a.Background, "0,0,0,100", TimeSpan.FromSeconds(0.3), null, AnimateMode.Linear);
|
|
|
|
//this.TransitionValue(a => a.MarginTop, 100, TimeSpan.FromSeconds(0.3), new PowerEase { }, AnimateMode.EaseOut);
|
|
|
|
mask.MouseDown += Mask_MouseDown;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Mask_MouseDown(object sender, MouseButtonEventArgs e)
|
|
|
|
{
|
|
|
|
window.DragMove();
|
|
|
|
}
|
|
|
|
|
|
|
|
private Window window;
|
|
|
|
protected override void OnInitialized()
|
|
|
|
{
|
|
|
|
base.OnInitialized();
|
|
|
|
//@"http://192.168.0.34:92/CaseFile/card/2024-06-03/20240603120112952.mp4"
|
|
|
|
vplayer.Play(new Uri(url));//播放
|
|
|
|
}
|
|
|
|
protected override void InitializeComponent()
|
|
|
|
{
|
|
|
|
IsAntiAlias = true;
|
|
|
|
CornerRadius = "3,3,3,3";
|
|
|
|
Height = "600";
|
|
|
|
Width = "800";
|
|
|
|
Background = "#2c2c2c";
|
|
|
|
ZIndex = 100;
|
|
|
|
Children.Add(new TextBlock
|
|
|
|
{
|
|
|
|
MarginRight = 12f,
|
|
|
|
MarginTop = 10f,
|
|
|
|
Text = "关闭",
|
|
|
|
FontSize = 16,
|
|
|
|
Cursor = CPF.Cursors.Hand,
|
|
|
|
Foreground = Color.White,
|
|
|
|
ZIndex = 101,
|
|
|
|
Commands =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nameof(MouseDown),
|
|
|
|
(s,e)=>Close()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Triggers =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nameof(IsMouseOver),
|
|
|
|
Relation.Me,
|
|
|
|
null,
|
|
|
|
(nameof(Foreground),Color.White)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Children.Add(new TextBlock
|
|
|
|
{
|
|
|
|
FontSize = 16f,
|
|
|
|
MarginLeft = 12.6f,
|
|
|
|
MarginTop = 9.6f,
|
|
|
|
Foreground = Color.White,
|
|
|
|
Text = videoTitle,
|
|
|
|
});
|
|
|
|
|
|
|
|
Children.Add(vplayer);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Close()
|
|
|
|
{
|
|
|
|
vplayer.Stop();
|
|
|
|
mask.TransitionValue(a => a.Background, "0,0,0,0", TimeSpan.FromSeconds(0.3), null, AnimateMode.Linear, () =>
|
|
|
|
{
|
|
|
|
window.Children.Remove(mask);
|
|
|
|
});
|
|
|
|
|
|
|
|
this.TransitionValue(a => a.MarginTop, -100, TimeSpan.FromSeconds(0.3), new PowerEase { }, AnimateMode.EaseIn, () =>
|
|
|
|
{
|
|
|
|
window.Children.Remove(this);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Control mask = new Control { Size = SizeField.Fill, ZIndex = 100, Background = "#00000000" };
|
|
|
|
}
|
|
|
|
}
|