コード例 #1
0
        public DownloadUpdateFile()
        {
            InitializeComponent();

            this.updateSystem = ServiceManager.ServiceManagerInstance.GetRemotingService <IUpdateSystem>("updateSystem");
            this.serverConfig = this.updateSystem.GetVersionConfig();
            this.clientConfig = new ClientUpdateConfig();

            this.clientConfig.ClientUpdateInfo = new ClientUpdateInfo
            {
                PreviousVersion = this.clientConfig.ClientUpdateInfo == null ? this.serverConfig.ConfigInfo.CurrentVersion : this.clientConfig.ClientUpdateInfo.CurrentVersion,
                CurrentVersion  = this.serverConfig.ConfigInfo.CurrentVersion,
                UpdateDate      = DateTime.Now
            };
        }
コード例 #2
0
        /// <summary>
        /// 更新系统
        /// </summary>
        /// <param name="startForm">启动窗体界面</param>
        /// <param name="clientType">客户端类型</param>
        public static void Update(Form startForm, ClientType clientType)
        {
            string             updateConfigPath = System.AppDomain.CurrentDomain.BaseDirectory + "UpdateLog.xml";
            UpdateConfig       serverConfig     = ServiceManager.ServiceManagerInstance.GetRemotingService <IUpdateSystem>("updateSystem").GetVersionConfig();
            ClientUpdateConfig clientConfig     = SerializeHelper.LoadXmlSerializeFile <ClientUpdateConfig>(updateConfigPath);

            if (serverConfig != null)
            {
                if (clientConfig == null || clientConfig.ClientUpdateInfo == null || serverConfig.ConfigInfo.CurrentVersion != clientConfig.ClientUpdateInfo.CurrentVersion)
                {
                    StratUpdateExe(serverConfig.ConfigInfo.ForceUpdate, startForm);
                }
                else
                {
                    Application.Run(startForm);
                }
            }
            else
            {
                Application.Run(startForm);
            }
        }