using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace LYFZ.Software.UI
{
public partial class frmOfficalWebsiteVideo : Form
{
public frmOfficalWebsiteVideo()
{
InitializeComponent();
}
///
/// 本窗口是否打开,已打开返回true;
///
///
public static bool IsDialogOpen()
{
bool bResult = false;
foreach (System.Windows.Forms.Form frm in System.Windows.Forms.Application.OpenForms)
{
if (frm.Name == typeof(frmOfficalWebsiteVideo).Name)
{
bResult = true;
break;
}
}
return bResult;
}
///
/// 获取对话框句柄对象(窗口已打开返回对象,否则返回null);
///
///
public static frmOfficalWebsiteVideo GetDialogHandler()
{
frmOfficalWebsiteVideo handler = null;
foreach (System.Windows.Forms.Form frm in System.Windows.Forms.Application.OpenForms)
{
if (frm.Name == typeof(frmOfficalWebsiteVideo).Name)
{
handler = (frmOfficalWebsiteVideo)frm;
break;
}
}
return handler;
}
///
/// 设置窗口要显示的视频地址;
///
/// 视频地址
public static void SetVideo(string video_url)
{
try
{
frmOfficalWebsiteVideo handler = GetDialogHandler();
if (handler == null)
{
handler = new frmOfficalWebsiteVideo();
handler.webBrowser1.Url = new Uri(video_url);
handler.Show();
}
else
{
handler.Activate();
handler.webBrowser1.Url = new Uri(video_url);
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
}
}
}