12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- 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();
- }
- /// <summary>
- /// 本窗口是否打开,已打开返回true;
- /// </summary>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 获取对话框句柄对象(窗口已打开返回对象,否则返回null);
- /// </summary>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 设置窗口要显示的视频地址;
- /// </summary>
- /// <param name="video_url">视频地址</param>
- 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);
- }
- }
- }
- }
|