849 lines
26 KiB
C#
849 lines
26 KiB
C#
/******************************
|
||
* 说明:系统全局类
|
||
* 创建人:龚宇超
|
||
* 创建日期:2017-08-09
|
||
* 修改人:
|
||
* 修改日期:
|
||
* 修改备注:
|
||
* 版本:1.0.0.0
|
||
******************************/
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Net;
|
||
using System.Management;
|
||
using DevExpress.XtraTab;
|
||
using System.Windows.Forms;
|
||
using System.Runtime.InteropServices;
|
||
using System.Net.NetworkInformation;
|
||
using System.Net.Sockets;
|
||
|
||
namespace Lskj.Model
|
||
{
|
||
/// <summary>
|
||
/// 系统全局类
|
||
/// </summary>
|
||
public sealed class ERPInfo
|
||
{
|
||
private static ERPInfo _instance = null;
|
||
/// <summary>
|
||
/// ERPInfo静态单例对象
|
||
/// </summary>
|
||
/// <value>The instance.</value>
|
||
public static ERPInfo Instance
|
||
{
|
||
get
|
||
{
|
||
if (_instance == null)
|
||
{
|
||
_instance = new ERPInfo();
|
||
}
|
||
return _instance;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 是否为超级管理员
|
||
/// </summary>
|
||
/// <value><c>true</c> if this instance is user manager; otherwise, <c>false</c>.</value>
|
||
public bool IsUserManager { get { return UserManager.Equals(UserName); } }
|
||
/// <summary>
|
||
/// 登录帐套
|
||
/// </summary>
|
||
public string AccountBook;
|
||
/// <summary>
|
||
/// 输入的密码
|
||
/// </summary>
|
||
public string InPassWord;
|
||
/// <summary>
|
||
/// 员工ID
|
||
/// </summary>
|
||
public string UserId;
|
||
/// <summary>
|
||
/// 员工编号
|
||
/// </summary>
|
||
public string LoginAccount;
|
||
/// <summary>
|
||
/// 员工姓名
|
||
/// </summary>
|
||
public string UserName;
|
||
/// <summary>
|
||
/// 密码
|
||
/// </summary>
|
||
public string Password;
|
||
/// <summary>
|
||
/// 菜单GroupId
|
||
/// </summary>
|
||
public string GroupId;
|
||
/// <summary>
|
||
/// 子系统
|
||
/// </summary>
|
||
public string SubSysId;
|
||
/// <summary>
|
||
/// 子系统名称
|
||
/// </summary>
|
||
public string SubSysName;
|
||
/// <summary>
|
||
/// 主界面page界面
|
||
/// </summary>
|
||
public XtraTabControl PageControl;
|
||
|
||
private readonly object _modulePageCallbackSync = new object();
|
||
private readonly List<Action<string>> _modulePageSelectedCallbacks =
|
||
new List<Action<string>>();
|
||
|
||
/// <summary>
|
||
/// 顶层页面生命周期服务。旧 WinForms 主程序保持为空并继续使用
|
||
/// PageControl;WPF 主程序注入自己的页面宿主实现。
|
||
/// </summary>
|
||
public IModulePageHost ModulePageHost;
|
||
|
||
public XtraTabPage CurrentModulePage
|
||
{
|
||
get
|
||
{
|
||
if (ModulePageHost != null)
|
||
return ModulePageHost.SelectedPage;
|
||
return PageControl == null ? null : PageControl.SelectedTabPage;
|
||
}
|
||
set
|
||
{
|
||
// Keep the original assignment-based API working for legacy
|
||
// modules. In the classic WinForms shell this forwards to
|
||
// the real PageControl; when WPF injects ModulePageHost it
|
||
// selects the page through that host instead of creating a
|
||
// second XtraTabControl.
|
||
SelectModulePage(value);
|
||
}
|
||
}
|
||
|
||
public IEnumerable<XtraTabPage> ModulePages
|
||
{
|
||
get
|
||
{
|
||
if (ModulePageHost != null)
|
||
return ModulePageHost.Pages;
|
||
if (PageControl == null)
|
||
return new XtraTabPage[0];
|
||
return PageControl.TabPages.Cast<XtraTabPage>();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Indicates whether a top-level module page surface has been
|
||
/// initialized. The classic shell exposes its XtraTabControl while
|
||
/// WPF exposes IModulePageHost; callers can use this without reaching
|
||
/// into either visual implementation.
|
||
/// </summary>
|
||
public bool HasModulePageSurface
|
||
{
|
||
get { return ModulePageHost != null || PageControl != null; }
|
||
}
|
||
|
||
public void AddModulePage(XtraTabPage page)
|
||
{
|
||
if (page == null)
|
||
return;
|
||
if (ModulePageHost != null)
|
||
{
|
||
ModulePageHost.AddPage(page);
|
||
return;
|
||
}
|
||
if (PageControl != null && !PageControl.TabPages.Contains(page))
|
||
PageControl.TabPages.Add(page);
|
||
}
|
||
|
||
public bool RemoveModulePage(XtraTabPage page)
|
||
{
|
||
if (page == null)
|
||
return false;
|
||
if (ModulePageHost != null)
|
||
return ModulePageHost.RemovePage(page);
|
||
if (PageControl == null || !PageControl.TabPages.Contains(page))
|
||
return false;
|
||
PageControl.TabPages.Remove(page);
|
||
return true;
|
||
}
|
||
|
||
public bool SelectModulePage(XtraTabPage page)
|
||
{
|
||
if (page == null)
|
||
return false;
|
||
if (ModulePageHost != null)
|
||
return ModulePageHost.SelectPage(page);
|
||
if (PageControl == null || !PageControl.TabPages.Contains(page))
|
||
return false;
|
||
PageControl.SelectedTabPage = page;
|
||
return true;
|
||
}
|
||
|
||
public bool ContainsModulePage(XtraTabPage page)
|
||
{
|
||
if (page == null)
|
||
return false;
|
||
if (ModulePageHost != null)
|
||
return ModulePageHost.ContainsPage(page);
|
||
return PageControl != null && PageControl.TabPages.Contains(page);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Returns the stable logical identifier used to bind a legacy page to
|
||
/// its WPF tab. The existing Tag value is retained whenever the old
|
||
/// module already assigned one; a generated value is written only for
|
||
/// an otherwise unidentified page.
|
||
/// </summary>
|
||
public string GetModulePageId(XtraTabPage page)
|
||
{
|
||
if (page == null)
|
||
return string.Empty;
|
||
|
||
string pageId = Convert.ToString(page.Tag);
|
||
if (string.IsNullOrWhiteSpace(pageId))
|
||
{
|
||
pageId = "legacy-module-" + Guid.NewGuid().ToString("N");
|
||
page.Tag = pageId;
|
||
}
|
||
return pageId;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Gets the logical identifier of the selected top-level page without
|
||
/// exposing the shell's visual tab-control implementation.
|
||
/// </summary>
|
||
public string CurrentModulePageId
|
||
{
|
||
get { return GetModulePageId(CurrentModulePage); }
|
||
}
|
||
|
||
/// <summary>
|
||
/// Enumerates top-level page identifiers for modules that only need to
|
||
/// compare or select pages and should not reach PageControl.TabPages.
|
||
/// </summary>
|
||
public IEnumerable<string> GetModulePageIds()
|
||
{
|
||
return ModulePages.Select(GetModulePageId).ToArray();
|
||
}
|
||
|
||
/// <summary>
|
||
/// Selects a top-level page by its logical identifier. Both the WPF
|
||
/// host and the classic WinForms PageControl use the same fallback
|
||
/// path as the original XtraTabPage-based API.
|
||
/// </summary>
|
||
public bool SelectModulePage(string pageId)
|
||
{
|
||
XtraTabPage page = FindModulePage(pageId);
|
||
return page != null && SelectModulePage(page);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Removes a top-level page by its logical identifier.
|
||
/// </summary>
|
||
public bool RemoveModulePage(string pageId)
|
||
{
|
||
XtraTabPage page = FindModulePage(pageId);
|
||
return page != null && RemoveModulePage(page);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Indicates whether the supplied logical identifier belongs to a
|
||
/// top-level module page. This replaces checks based on
|
||
/// page.Parent as XtraTabControl in migrated module code.
|
||
/// </summary>
|
||
public bool IsTopLevelModulePage(string pageId)
|
||
{
|
||
return FindModulePage(pageId) != null;
|
||
}
|
||
|
||
/// <summary>
|
||
/// Registers a logical page-selection callback. This is intentionally
|
||
/// a page-service callback rather than a subscription to a concrete
|
||
/// WinForms or WPF tab-control event. Dispose the returned token when
|
||
/// the module closes so the callback cannot retain the module.
|
||
/// </summary>
|
||
public IDisposable RegisterModulePageSelected(Action<string> callback)
|
||
{
|
||
if (callback == null)
|
||
throw new ArgumentNullException("callback");
|
||
|
||
lock (_modulePageCallbackSync)
|
||
{
|
||
_modulePageSelectedCallbacks.Add(callback);
|
||
}
|
||
return new ModulePageCallbackRegistration(this, callback);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Registers a callback for one logical module page. This overload is
|
||
/// the source-compatible replacement for code that used to subscribe
|
||
/// to the top-level PageControl.SelectedPageChanged event and then
|
||
/// filter by the selected page. The callback receives no WinForms
|
||
/// event arguments, so the same module code works when the WPF shell
|
||
/// owns the visible tab while the direct WinForms shell still uses its
|
||
/// original XtraTabControl.
|
||
/// </summary>
|
||
public IDisposable RegisterModulePageSelected(
|
||
string modulePageId,
|
||
Action callback)
|
||
{
|
||
if (callback == null)
|
||
throw new ArgumentNullException("callback");
|
||
|
||
string expectedPageId = (modulePageId ?? string.Empty).Trim();
|
||
if (string.IsNullOrWhiteSpace(expectedPageId))
|
||
throw new ArgumentException(
|
||
"模块页面标识不能为空。",
|
||
"modulePageId");
|
||
|
||
return RegisterModulePageSelected(
|
||
selectedPageId =>
|
||
{
|
||
if (string.Equals(
|
||
selectedPageId,
|
||
expectedPageId,
|
||
StringComparison.Ordinal))
|
||
{
|
||
callback();
|
||
}
|
||
});
|
||
}
|
||
|
||
/// <summary>
|
||
/// Notifies logical page-selection subscribers. The WPF page host
|
||
/// calls this after its own selection state is updated; the classic
|
||
/// MainPanelControlEx calls it from its existing SelectedPageChanged
|
||
/// handler. No visual control event is introduced in the WPF path.
|
||
/// </summary>
|
||
public void NotifyModulePageSelected(XtraTabPage page)
|
||
{
|
||
if (page == null)
|
||
return;
|
||
|
||
string pageId = GetModulePageId(page);
|
||
Action<string>[] callbacks;
|
||
lock (_modulePageCallbackSync)
|
||
{
|
||
callbacks = _modulePageSelectedCallbacks.ToArray();
|
||
}
|
||
|
||
foreach (Action<string> callback in callbacks)
|
||
{
|
||
try
|
||
{
|
||
callback(pageId);
|
||
}
|
||
catch (Exception exception)
|
||
{
|
||
System.Diagnostics.Trace.WriteLine(
|
||
"旧模块页面回调执行失败:" + exception);
|
||
}
|
||
}
|
||
}
|
||
|
||
private XtraTabPage FindModulePage(string pageId)
|
||
{
|
||
if (string.IsNullOrWhiteSpace(pageId))
|
||
return null;
|
||
|
||
foreach (XtraTabPage page in ModulePages)
|
||
{
|
||
if (string.Equals(
|
||
GetModulePageId(page),
|
||
pageId,
|
||
StringComparison.Ordinal))
|
||
{
|
||
return page;
|
||
}
|
||
}
|
||
return null;
|
||
}
|
||
|
||
private void UnregisterModulePageSelected(Action<string> callback)
|
||
{
|
||
if (callback == null)
|
||
return;
|
||
|
||
lock (_modulePageCallbackSync)
|
||
{
|
||
_modulePageSelectedCallbacks.Remove(callback);
|
||
}
|
||
}
|
||
|
||
private sealed class ModulePageCallbackRegistration : IDisposable
|
||
{
|
||
private ERPInfo _owner;
|
||
private readonly Action<string> _callback;
|
||
|
||
public ModulePageCallbackRegistration(
|
||
ERPInfo owner,
|
||
Action<string> callback)
|
||
{
|
||
_owner = owner;
|
||
_callback = callback;
|
||
}
|
||
|
||
public void Dispose()
|
||
{
|
||
ERPInfo owner = _owner;
|
||
if (owner == null)
|
||
return;
|
||
|
||
_owner = null;
|
||
owner.UnregisterModulePageSelected(_callback);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 主界面page界面字典
|
||
/// </summary>
|
||
public Dictionary<string, DllModule> ModuleForms;
|
||
/// <summary>
|
||
/// 登录人联系电话
|
||
/// </summary>
|
||
public string UserLinkPhone;
|
||
/// <summary>
|
||
/// 主界面page界面
|
||
/// </summary>
|
||
public Form MainControl;
|
||
/// <summary>
|
||
/// 主页面焦点
|
||
/// </summary>
|
||
public PictureBox pic_search;
|
||
/// <summary>
|
||
/// 是否阻止回车事件
|
||
/// </summary>
|
||
public bool IsExecute = false;
|
||
/// <summary>
|
||
/// 是否根据模块id判断是否设置不能同时打开多个相同模块
|
||
/// </summary>
|
||
public bool SingleOpenMode = false;
|
||
|
||
|
||
/// <summary>
|
||
/// 登录IP
|
||
/// </summary>
|
||
public string LoginIP
|
||
{
|
||
get
|
||
{
|
||
try
|
||
{
|
||
return Dns.GetHostAddresses(WindowName)[0] + "";
|
||
}
|
||
catch (Exception)
|
||
{
|
||
}
|
||
return string.Empty;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 登录IP
|
||
/// </summary>
|
||
public string LoginIPV4
|
||
{
|
||
get
|
||
{
|
||
try
|
||
{
|
||
string text = string.Empty;
|
||
IPAddress[] ip = Dns.GetHostAddresses(WindowName);
|
||
foreach (IPAddress address in ip)
|
||
{
|
||
if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||
{
|
||
text = address + "";
|
||
}
|
||
|
||
}
|
||
|
||
|
||
return text;
|
||
}
|
||
catch (Exception)
|
||
{
|
||
}
|
||
return "";
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 用户电脑名
|
||
/// </summary>
|
||
public string WindowName
|
||
{
|
||
get { return Dns.GetHostName(); }
|
||
}
|
||
/// <summary>
|
||
/// 子系统数量
|
||
/// </summary>
|
||
public int SubMenuCount;
|
||
/// <summary>
|
||
/// 超级管理员
|
||
/// </summary>
|
||
public string UserManager = "管理员";
|
||
/// <summary>
|
||
/// 用户皮肤字段
|
||
/// </summary>
|
||
/// <value>The name of the skin.</value>
|
||
public string SkinFieldName = "SkinName";
|
||
/// <summary>
|
||
/// 默认新增判断行
|
||
/// </summary>
|
||
public string isAddRows = "xxxxx_isAddRows";
|
||
/// <summary>
|
||
/// 用户皮肤
|
||
/// </summary>
|
||
public string SkinName;
|
||
/// <summary>
|
||
/// 模块编号
|
||
/// </summary>
|
||
public string WorkModid;
|
||
/// <summary>
|
||
/// 当前选中的方案id
|
||
/// </summary>
|
||
/// <value>The mac address.</value>
|
||
public string SeriesId;
|
||
/// <summary>
|
||
/// 车间
|
||
/// </summary>
|
||
public string WorkCJ;
|
||
/// <summary>
|
||
/// 车间ID
|
||
/// </summary>
|
||
public string WorkCJId;
|
||
/// <summary>
|
||
/// 机台
|
||
/// </summary>
|
||
public string WorkJT;
|
||
/// <summary>
|
||
/// 机台ID
|
||
/// </summary>
|
||
public string WorkJTId;
|
||
/// <summary>
|
||
/// 班次
|
||
/// </summary>
|
||
public string WorkBZ;
|
||
/// <summary>
|
||
/// 班次ID
|
||
/// </summary>
|
||
public string WorkBZId;
|
||
/// <summary>
|
||
/// 班组
|
||
/// </summary>
|
||
public string ClassName;
|
||
/// <summary>
|
||
/// The work no
|
||
/// </summary>
|
||
public string WorkNo;
|
||
/// <summary>
|
||
/// 是否显示
|
||
/// </summary>
|
||
public static bool ShowMsg = true;
|
||
/// <summary>
|
||
/// 当前登录Mac地址
|
||
/// </summary>
|
||
/// <value>The mac address.</value>
|
||
public string MacAddress
|
||
{
|
||
get {
|
||
if (!string.IsNullOrWhiteSpace(RecordMAC)) return RecordMAC;
|
||
return GetMacAddress();
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 客户名称
|
||
/// </summary>
|
||
public string ClientName = "";
|
||
/// <summary>
|
||
/// 如果无法连接则后面不在继续连接了
|
||
/// </summary>
|
||
public bool bSmartClientIsOK = true;
|
||
/// <summary>
|
||
/// 文件升级ip
|
||
/// </summary>
|
||
public string UpdateIP = "";
|
||
/// <summary>
|
||
/// 登录结果
|
||
/// </summary>
|
||
public bool LoginResult = false;
|
||
/// <summary>
|
||
/// Mrp当前切换状态
|
||
/// </summary>
|
||
public string MrpTag = "";
|
||
/// <summary>
|
||
/// 记录本机MAC地址(只记录初始获取的,每次获取导致速度很慢)
|
||
/// </summary>
|
||
public string RecordMAC = "";
|
||
|
||
|
||
/// <summary>
|
||
/// 获取本机MAC地址
|
||
/// </summary>
|
||
/// <returns>本机MAC地址</returns>
|
||
private string GetMacAddress()
|
||
{
|
||
try
|
||
{
|
||
string fallbackMac = string.Empty;
|
||
|
||
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
|
||
|
||
foreach (NetworkInterface ni in interfaces)
|
||
{
|
||
if (ni == null)
|
||
{
|
||
continue;
|
||
}
|
||
|
||
if (ni.OperationalStatus != OperationalStatus.Up)
|
||
{
|
||
continue;
|
||
}
|
||
|
||
if (ni.NetworkInterfaceType == NetworkInterfaceType.Loopback ||
|
||
ni.NetworkInterfaceType == NetworkInterfaceType.Tunnel)
|
||
{
|
||
continue;
|
||
}
|
||
|
||
PhysicalAddress physicalAddress = ni.GetPhysicalAddress();
|
||
if (physicalAddress == null || physicalAddress.GetAddressBytes().Length == 0)
|
||
{
|
||
continue;
|
||
}
|
||
|
||
string mac = FormatMacAddress(physicalAddress);
|
||
if (string.IsNullOrEmpty(fallbackMac))
|
||
{
|
||
fallbackMac = mac;
|
||
}
|
||
|
||
IPInterfaceProperties properties = ni.GetIPProperties();
|
||
foreach (UnicastIPAddressInformation ipInfo in properties.UnicastAddresses)
|
||
{
|
||
if (ipInfo.Address.AddressFamily != AddressFamily.InterNetwork)
|
||
{
|
||
continue;
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(LoginIPV4) &&
|
||
ipInfo.Address.ToString() == LoginIPV4)
|
||
{
|
||
RecordMAC = mac;
|
||
return mac;
|
||
}
|
||
}
|
||
}
|
||
|
||
RecordMAC = fallbackMac;
|
||
return fallbackMac;
|
||
}
|
||
catch
|
||
{
|
||
return "";
|
||
}
|
||
}
|
||
|
||
private string FormatMacAddress(PhysicalAddress physicalAddress)
|
||
{
|
||
byte[] bytes = physicalAddress.GetAddressBytes();
|
||
StringBuilder sb = new StringBuilder();
|
||
|
||
for (int i = 0; i < bytes.Length; i++)
|
||
{
|
||
if (i > 0)
|
||
{
|
||
sb.Append("-");
|
||
}
|
||
|
||
sb.Append(bytes[i].ToString("X2"));
|
||
}
|
||
|
||
return sb.ToString();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 加密狗id
|
||
/// </summary>
|
||
public int[] keyHandles = new int[8];
|
||
/// <summary>
|
||
/// 加密狗编号
|
||
/// </summary>
|
||
public int[] keyNumber = new int[8];
|
||
/// <summary>
|
||
/// 是否需要U盾密码验证
|
||
/// </summary>
|
||
public bool isDogVerifyPassword = true;
|
||
/// <summary>
|
||
/// U盾密码默认值
|
||
/// </summary>
|
||
public string dogVerifyPasswordDefault
|
||
{
|
||
get
|
||
{
|
||
byte[] bytes = new byte[256];
|
||
for (int i = 0; i < bytes.Length; i++)
|
||
{
|
||
bytes[i] = 255;
|
||
}
|
||
return Encoding.Default.GetString(bytes);
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 当前选中页签模块编号
|
||
/// </summary>
|
||
public string selectFormModleId;
|
||
|
||
#region 判断windows版本
|
||
[StructLayout(LayoutKind.Sequential)]
|
||
private struct OSVERSIONINFOEX
|
||
{
|
||
public int dwOSVersionInfoSize;
|
||
public int dwMajorVersion;
|
||
public int dwMinorVersion;
|
||
public int dwBuildNumber;
|
||
public int dwPlatformId;
|
||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
||
public string szCSDVersion;
|
||
}
|
||
[DllImport("ntdll.dll", SetLastError = true)]
|
||
private static extern int RtlGetVersion(ref OSVERSIONINFOEX versionInfo);
|
||
private static OSVERSIONINFOEX GetOSVersion()
|
||
{
|
||
OSVERSIONINFOEX versionInfo = new OSVERSIONINFOEX();
|
||
versionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
|
||
int result = RtlGetVersion(ref versionInfo);
|
||
if (result != 0)
|
||
{
|
||
throw new Exception("Failed to get OS version");
|
||
}
|
||
return versionInfo;
|
||
}
|
||
public string SystemVersion
|
||
{
|
||
get
|
||
{
|
||
string systemVersion = "";
|
||
OSVERSIONINFOEX osVersionInfo = GetOSVersion();
|
||
// 判断具体的Windows版本
|
||
if (osVersionInfo.dwPlatformId == 2) // 2 is VER_PLATFORM_WIN32_NT
|
||
{
|
||
if (osVersionInfo.dwMajorVersion == 10)
|
||
{
|
||
systemVersion = "Windows 10 或 Windows 11";
|
||
}
|
||
else
|
||
{
|
||
switch (osVersionInfo.dwMajorVersion)
|
||
{
|
||
case 6:
|
||
switch (osVersionInfo.dwMinorVersion)
|
||
{
|
||
case 3:
|
||
systemVersion = "Windows 8.1";
|
||
break;
|
||
case 2:
|
||
systemVersion = "Windows 8";
|
||
break;
|
||
case 1:
|
||
systemVersion = "Windows 7";
|
||
break;
|
||
case 0:
|
||
systemVersion = "Windows Vista";
|
||
break;
|
||
}
|
||
break;
|
||
case 5:
|
||
switch (osVersionInfo.dwMinorVersion)
|
||
{
|
||
case 2:
|
||
systemVersion = "Windows Server 2003; Windows XP x64 Edition";
|
||
break;
|
||
case 1:
|
||
systemVersion = "Windows XP";
|
||
break;
|
||
case 0:
|
||
systemVersion = "Windows 2000";
|
||
break;
|
||
}
|
||
break;
|
||
default:
|
||
systemVersion = "未知版本";
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
systemVersion = "非Windows NT系列操作系统";
|
||
}
|
||
return systemVersion;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 使用winfrom自带浏览器
|
||
/// </summary>
|
||
public bool PrimitiveBrowser;
|
||
|
||
/// <summary>
|
||
/// 当前程序使用的语言
|
||
/// </summary>
|
||
public string LanguageName;
|
||
|
||
/// <summary>
|
||
/// 是否改变存储过程参数类型(越南语要用Nvarchar)
|
||
/// </summary>
|
||
public bool ChangeParameterType
|
||
{
|
||
get
|
||
{
|
||
if (!string.IsNullOrWhiteSpace(this.LanguageName))
|
||
{
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 页面水印层
|
||
/// </summary>
|
||
public Form WatermarkForm;
|
||
|
||
/// <summary>
|
||
/// 单据水印 草稿替换值
|
||
/// </summary>
|
||
public string DraftReplacementValue="";
|
||
|
||
/// <summary>
|
||
/// 是否有可翻译的文本
|
||
/// </summary>
|
||
public bool Translatable;
|
||
/// <summary>
|
||
/// 翻译文本存放字典
|
||
/// </summary>
|
||
public Dictionary<string, string> ContrastiveLanguage;
|
||
|
||
/// <summary>
|
||
/// 传入文本,获取对应语言的翻译文本
|
||
/// </summary>
|
||
/// <param name="text"></param>
|
||
/// <returns></returns>
|
||
public string GetTranslatedText(string text)
|
||
{
|
||
string value = text;
|
||
if (this.ContrastiveLanguage.ContainsKey(text))
|
||
{
|
||
value = this.ContrastiveLanguage[text];
|
||
}
|
||
return value;
|
||
}
|
||
}
|
||
}
|