using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Runtime.InteropServices;
using US.Browser.IE.BLL;
using System.Reflection;
namespace US.Browser.IE
{
[System.Runtime.InteropServices.ComVisible(true)]
public partial class ftp : Form
{
private WebBrowser WB;
private RespondWeb rwf;
public static ftp uft;
string json;
#region 初始化加载ftp
///
///
///
///
public static void snews(string json, WebBrowser WB, RespondWeb rf)
{
if (uft != null) { }
else { uft = new ftp(json, WB, rf); }
}
///
/// ftp加载
///
public ftp(string json, RespondWeb rf)
{
init(json); rwf = rf;
}
///
/// ftp加载
///
///
public ftp(string json, WebBrowser WB, RespondWeb rf)
{
this.WB = WB; init(json); rwf = rf;
}
///
/// 页面生成
///
public void init(string json)
{
InitializeComponent(); ftpBinit(); this.Hide(); this.json = json;
ftpB.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(ftpB_DocumentCompleted);
}
///
/// 加载完毕
///
///
///
void ftpB_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
completed(this.json); this.json = null;
}
///
/// 加载提示页面
///
public void ftpBinit()
{
ftpB.ObjectForScripting = this; ftpB.ScriptErrorsSuppressed = true;
this.ftpB.Url = new System.Uri(Application.StartupPath + "\\html\\ftp.html");
}
///
/// 加载成功
///
///
public void completed(string json)
{
this.ftpB.Document.InvokeScript("_setT", new object[] { json });
}
#endregion
#region 窗口显示和消失
///
/// 显示窗口
///
public void _fs()
{
Size s = Screen.PrimaryScreen.WorkingArea.Size; Point WZ = new Point((Int32)(s.Width) - 5, (Int32)(s.Height - this.Height - 20));
this.Show(); this.Location = WZ; animate(false, -this.Width - 20, this);
}
///
/// 窗口消失
///
public void _fh()
{
animate(true, this.Width, this);
}
///
/// 动画函数
///
///
public static void animate(bool tf, int c, Form uf)
{
System.Windows.Forms.Timer _tt = new System.Windows.Forms.Timer(); int u, k = c < 0 ? -30 : 30, i = c / k, m = uf.Location.X + c;
_tt.Tick += new EventHandler(delegate(object sender, EventArgs g)
{
u = i == 0 ? m : uf.Location.X + k; uf.Location = new Point(u, uf.Location.Y);
if (i-- == 0) { _tt.Stop(); _tt.Dispose(); _tt = null; if (tf) { uf.Hide(); uf.Dispose(); } };
});
_tt.Interval = 10; _tt.Start();
}
///
/// 释放窗体
///
public void dis()
{
this.Hide(); this.Dispose();
}
///
/// 窗口闪烁
///
///
public void xxs(string img, string tf, string ue)
{
try
{
StaticClass._twstart(img, tf, ue, WB, rwf);
this.Dispose(); BLL.WindowHWND.freem();
}
catch (Exception e) { }
}
///
/// 查看内容提示
///
public void cknr(string tf, string ue)
{
rwf.OpenLook(new object[] { tf, ue }, WB);
}
///
/// 设置id
///
///
public void setxx(string id)
{
USMain.id = id;
}
#endregion
}
}