You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
201 lines
5.4 KiB
C#
201 lines
5.4 KiB
C#
using POSV.Cef.Client.ClientComm;
|
|
using POSV.Proxy.Stock;
|
|
using POSV.Utils;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace POSV.Cef
|
|
{
|
|
public partial class CostControlListCef : BusinessForm
|
|
{
|
|
//===========================构造方法========================
|
|
public CostControlListCef()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public CostControlListCef(string name = null) : this()
|
|
{
|
|
DownloadCefDependentFile file = new DownloadCefDependentFile();
|
|
if (!file.Needtodownload())
|
|
{
|
|
file.ShowDialog();
|
|
if (!file.IsAccomplish)
|
|
{
|
|
MessageBox.Show("运行环境安装时出现了问题,请与管理员联系!");
|
|
this.Close();
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
file.Dispose();
|
|
file.Close();
|
|
}
|
|
m_costControlList = new CostControlList();
|
|
m_costControlList.m_LoadPageEvent += this.LoadModule;
|
|
m_costControlList.m_BackFormEvent += this.BackForm;
|
|
m_costControlList.m_CloseFormEvent += this.CloseForm;
|
|
m_costControlList.m_ReloadFormEvent += this.Reload;
|
|
m_costControlList.LoadModule("经营会计报表");
|
|
}
|
|
|
|
|
|
|
|
//===========================全局参数========================
|
|
private CefUnifyBrowser m_CefClient = null;
|
|
private CostControlList m_costControlList = null;
|
|
|
|
|
|
|
|
//===========================共有参数========================
|
|
/// <summary>
|
|
/// 经营成本报表
|
|
/// </summary>
|
|
public CostControlList CostControlList { get => m_costControlList; }
|
|
|
|
|
|
|
|
//===========================共有方法========================
|
|
public void Init()
|
|
{
|
|
#if DEBUG
|
|
this.m_CefClient.ShowDevTools();
|
|
#endif
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关闭winfrom
|
|
/// </summary>
|
|
public void CloseForm()
|
|
{
|
|
m_CefClient.CloseBrowser();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 后退
|
|
/// </summary>
|
|
public void BackForm()
|
|
{
|
|
this.m_CefClient.BackForm();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 后退
|
|
/// </summary>
|
|
public void ForwardForm()
|
|
{
|
|
this.m_CefClient.ForwardForm();
|
|
}
|
|
|
|
public void Reload()
|
|
{
|
|
this.m_CefClient.Reload();
|
|
}
|
|
|
|
public void OnControlBoxKeyboardClick()
|
|
{
|
|
try
|
|
{
|
|
this.Invoke((EventHandler)delegate
|
|
{
|
|
KeyboardType keyboardType = KeyboardType.数字;
|
|
Type type = this.ActiveControl.GetType();
|
|
PropertyInfo pinfo = type.GetProperty("Keyboard");
|
|
if (pinfo != null)
|
|
{
|
|
keyboardType = (KeyboardType)pinfo.GetValue(this.ActiveControl, null);
|
|
}
|
|
|
|
var keyboard = Application.OpenForms["VirtualKeyboard"];
|
|
if (keyboard == null)
|
|
{
|
|
keyboard = new VirtualKeyboard(keyboardType);
|
|
}
|
|
else
|
|
{
|
|
return;
|
|
}
|
|
|
|
((VirtualKeyboard)keyboard).ShowVirtualKeyboard(this, keyboardType);
|
|
});
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LOGGER.Error(ex, "打开屏幕键盘异常");
|
|
}
|
|
|
|
}
|
|
|
|
//===========================私有方法========================
|
|
/// <summary>
|
|
/// winfrom 关闭窗口监听
|
|
/// </summary>
|
|
private void CostControlListCef_FormClosed(object sender, FormClosedEventArgs e)
|
|
{
|
|
this.m_CefClient.CloseBrowser();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 跳转界面
|
|
/// </summary>
|
|
/// <param name="url"></param>
|
|
private void LoadModule(string url)
|
|
{
|
|
if (string.IsNullOrEmpty(url))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (this.m_CefClient == null)
|
|
{
|
|
this.m_CefClient = new CefUnifyBrowser(this);
|
|
this.m_CefClient.LoadingStateEvent += this.LoadingStateEvent;
|
|
this.WindowState = FormWindowState.Maximized;
|
|
}
|
|
this.m_CefClient.LoadCef(url);
|
|
}
|
|
|
|
|
|
Loading loading = null;
|
|
|
|
private void LoadingStateEvent(bool IsLoadStatus, string Message)
|
|
{
|
|
this.Invoke((EventHandler)delegate
|
|
{
|
|
try
|
|
{
|
|
if (loading == null)
|
|
{
|
|
loading = new Loading();
|
|
}
|
|
|
|
|
|
if (IsLoadStatus)
|
|
{
|
|
loading.BringToFront();
|
|
loading.Show(this);
|
|
}
|
|
else
|
|
{
|
|
loading.Dispose();
|
|
loading.Close();
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
|
|
}
|
|
|
|
});
|
|
}
|
|
}
|
|
}
|