using DeviceRepair.Utils;
using TsSFCDevice.Client.Biz.Base.Service;

namespace TsSFCDevice.Client.Biz.Base.Utils
{
    public class Utility
    {
        /// <summary>
        /// 默认的WebService超时时间（默认5分钟）
        /// </summary>
        public const int DEFAULT_SERVICE_TIMEOUT = 300000;

        #region WebServiceSOAP验证头用户信息
        /// <summary>
        /// WebServiceSOAP验证头用户
        /// </summary>
        private const string SOPHeadUserName = "TECHSCAN_Myl";
        /// <summary>
        /// WebServiceSOAP验证头用户密码
        /// </summary>
        private const string SOPHeadUserPass = "^____^#####*****^____^";
        #endregion

        /// <summary>
        /// 获取当前WebService服务对象
        /// </summary>
        private static TsSFCMainSvc @m_DevMainService;
        /// <summary>   
        /// 获取当前WebService服务对象
        /// </summary>
        public static TsSFCMainSvc @SfcBizService
        {
            get
            {
                if (@m_DevMainService == null)
                {
                    @m_DevMainService = new TsSFCMainSvc(
                        SOPHeadUserName,
                        SOPHeadUserPass,
                        "",
                        $"http://{DeviceRepair.Utils.Config.Configurations.Properties.ServiceIP}/{DeviceRepair.Utils.Config.Configurations.Properties.ServiceName}/MainService.asmx");
                }
                return @m_DevMainService;
            }
        }

        private static SysRuntimeInfo m_SystemRuntimeInfo;

        /// <summary>
        /// 当前系统运行时信息对象
        /// </summary>
        public static SysRuntimeInfo SystemRuntimeInfo
        {
            get
            {
                if (m_SystemRuntimeInfo == null)
                {
                    m_SystemRuntimeInfo = new SysRuntimeInfo()
                    {
                        ComputerName = ComputerHelper.GetComputerName
                    };
                }
                return m_SystemRuntimeInfo;
            }
            set
            {
                m_SystemRuntimeInfo = value;
            }
        }
    }
}
