示例#1
0
        /// <summary>
        /// give up maintenance
        /// </summary>
        private void CheckUpgrade()
        {
            string tempResponse = myHttp.SendData(string.Format(@"{0}freehttp/UpdateCheck/v1.1?user={1}", ConfigurationData.BaseUrl, UserComputerInfo.GetComputerMac()));
            string isNeedUpdata = FreeHttp.AutoTest.ParameterizationPick.ParameterPickHelper.PickStrParameter("\"isNeedUpdata\":", ",", tempResponse);
            string url          = FreeHttp.AutoTest.ParameterizationPick.ParameterPickHelper.PickStrParameter("\"url\":", ",", tempResponse);
            string message      = FreeHttp.AutoTest.ParameterizationPick.ParameterPickHelper.PickStrParameter("\"message\":", ",", tempResponse);

            if (string.IsNullOrEmpty(isNeedUpdata))
            {
                this.GetUpgradeMes(this, new UpgradeServiceEventArgs(false, null));
            }
            if (isNeedUpdata == "true")
            {
                this.GetUpgradeMes(this, new UpgradeServiceEventArgs(true, new UpdateInfo()
                {
                    url = url
                }));
            }
        }
示例#2
0
        public void StartCheckUpgrade()
        {
            //Task checkUpgradeCheckUpgrade = new Task(CheckUpgrade);
            //checkUpgradeCheckUpgrade.Start();
            //checkUpgradeCheckUpgrade.ContinueWith((task) => { StartCheckUpgrade(); });

            Task <UpgradeServiceEventArgs> checkUpgradeTask = new Task <UpgradeServiceEventArgs>(() =>
            {
                string tempResponse = myHttp.SendData(string.Format(@"https://api.lulianqi.com/UpdateCheck/v1.1?user={0}", UserComputerInfo.GetComputerMac()));
                string isNeedUpdata = FreeHttp.AutoTest.ParameterizationPick.ParameterPickHelper.PickStrParameter("\"isNeedUpdata\":", ",", tempResponse);
                string url          = FreeHttp.AutoTest.ParameterizationPick.ParameterPickHelper.PickStrParameter("\"url\":", ",", tempResponse);
                string message      = FreeHttp.AutoTest.ParameterizationPick.ParameterPickHelper.PickStrParameter("\"message\":", ",", tempResponse);
                if (string.IsNullOrEmpty(isNeedUpdata))
                {
                    return(new UpgradeServiceEventArgs(false, null));
                }
                if (isNeedUpdata == "true")
                {
                    return(new UpgradeServiceEventArgs(true, url));
                }
                return(null);
            });

            checkUpgradeTask.Start();
            checkUpgradeTask.ContinueWith((task) => { if (checkUpgradeTask.Result != null)
                                                      {
                                                          this.GetUpgradeMes(this, checkUpgradeTask.Result);
                                                      }
                                          });
        }
示例#3
0
        private void CheckUpgrade()
        {
            string tempResponse = myHttp.SendData(string.Format(@"http://api.lulianqi.com/UpdateCheck/v1?user={0}", UserComputerInfo.GetComputerMac()));
            string isNeedUpdata = FreeHttp.AutoTest.ParameterizationPick.ParameterPickHelper.PickStrParameter("\"isNeedUpdata\":", ",", tempResponse);
            string url          = FreeHttp.AutoTest.ParameterizationPick.ParameterPickHelper.PickStrParameter("\"url\":", ",", tempResponse);
            string message      = FreeHttp.AutoTest.ParameterizationPick.ParameterPickHelper.PickStrParameter("\"message\":", ",", tempResponse);

            if (string.IsNullOrEmpty(isNeedUpdata))
            {
                this.GetUpgradeMes(this, new UpgradeServiceEventArgs(false, null));
            }
            if (isNeedUpdata == "true")
            {
                this.GetUpgradeMes(this, new UpgradeServiceEventArgs(true, url));
            }
        }
示例#4
0
        public void StartCheckUpgrade()
        {
            //Task checkUpgradeCheckUpgrade = new Task(CheckUpgrade);
            //checkUpgradeCheckUpgrade.Start();
            //checkUpgradeCheckUpgrade.ContinueWith((task) => { StartCheckUpgrade(); });

            Task <UpgradeServiceEventArgs> checkUpgradeTask = new Task <UpgradeServiceEventArgs>(() =>
            {
                string tempResponse = myHttp.SendData(string.Format(@"{0}freehttp/UpdateCheck/v{1}?user={2}&dotnetrelease={3}", ConfigurationData.BaseUrl, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(), UserComputerInfo.GetComputerMac(), UserComputerInfo.GetDotNetRelease()));
                string isNeedUpdata = FreeHttp.AutoTest.ParameterizationPick.ParameterPickHelper.PickStrParameter("\"isNeedUpdata\":", ",", tempResponse);
                string url          = FreeHttp.AutoTest.ParameterizationPick.ParameterPickHelper.PickStrParameter("\"url\":", ",", tempResponse);
                string message      = FreeHttp.AutoTest.ParameterizationPick.ParameterPickHelper.PickStrParameter("\"message\":", ",", tempResponse);
                if (string.IsNullOrEmpty(isNeedUpdata))
                {
                    return(new UpgradeServiceEventArgs(false, null));
                }
                if (isNeedUpdata == "true")
                {
                    return(new UpgradeServiceEventArgs(true, url));
                }
                return(null);
            });

            checkUpgradeTask.Start();
            checkUpgradeTask.ContinueWith((task) => { if (checkUpgradeTask.Result != null)
                                                      {
                                                          this.GetUpgradeMes(this, checkUpgradeTask.Result);
                                                      }
                                          });
        }