public static HalanVersionInfo GetVersionInfo(string productName, Version currentVersion)
        {
            BasicHttpBinding_IProductManager p = new BasicHttpBinding_IProductManager();

              LatestVersionRequest req = new LatestVersionRequest();
              req.ProductName = productName;
              req.CurrentProductVersion = currentVersion.ToString(4);

              LatestVersionResponse resp = p.GetLatestVersion(req);

              if( resp.ProductVersion.IsValid() ) {
            HalanVersionInfo r = new HalanVersionInfo();

            Version larestVer = new Version(resp.ProductVersion);
            r.Product = productName;
            r.ReleaseDate = resp.ReleaseDate;
            r.Status = ( larestVer <= currentVersion ) ? VersionStatus.Latest : VersionStatus.Old;
            r.LatestVersion = larestVer;
            r.Features = resp.Features;
            r.Url = resp.Url.Default("http://blog.halan.se/page/Service-Bus-MQ-Manager.aspx?update=true&v=" + currentVersion.ToString());
            return r;
              }

              return null;
        }
Ejemplo n.º 2
0
        public static HalanVersionInfo GetVersionInfo(string productName, Version currentVersion)
        {
            LatestVersionRequest req = new LatestVersionRequest();

            req.ProductName           = productName;
            req.CurrentProductVersion = currentVersion.ToString(4);

            LatestVersionResponse resp = null;
            var client = HalanServices.CreateProductManager();

            try {
                resp = client.GetLatestVersion(req);
            } finally {
                client.Close();
            }

            if (resp.ProductVersion.IsValid())
            {
                HalanVersionInfo r = new HalanVersionInfo();

                Version larestVer = new Version(resp.ProductVersion);
                r.Product       = productName;
                r.ReleaseDate   = resp.ReleaseDate;
                r.Status        = (larestVer <= currentVersion) ? VersionStatus.Latest : VersionStatus.Old;
                r.LatestVersion = larestVer;
                r.Features      = resp.Features;
                r.Url           = resp.Url.Default("http://blog.halan.se/page/Service-Bus-MQ-Manager.aspx?update=true&v=" + currentVersion.ToString());
                return(r);
            }

            return(null);

            /*
             * BasicHttpBinding_IProductManager p = new BasicHttpBinding_IProductManager();
             *
             *
             * LatestVersionRequest req = new LatestVersionRequest();
             * req.ProductName = productName;
             * req.CurrentProductVersion = currentVersion.ToString(4);
             *
             *
             *
             * LatestVersionResponse resp = p.GetLatestVersion(req);
             *
             * if( resp.ProductVersion.IsValid() ) {
             * HalanVersionInfo r = new HalanVersionInfo();
             *
             * Version larestVer = new Version(resp.ProductVersion);
             * r.Product = productName;
             * r.ReleaseDate = resp.ReleaseDate;
             * r.Status = ( larestVer <= currentVersion ) ? VersionStatus.Latest : VersionStatus.Old;
             * r.LatestVersion = larestVer;
             * r.Features = resp.Features;
             * r.Url = resp.Url.Default("http://blog.halan.se/page/Service-Bus-MQ-Manager.aspx?update=true&v=" + currentVersion.ToString());
             * return r;
             * }
             *
             * return null;
             */
        }
        protected override void OnDoWork(DoWorkEventArgs e)
        {
            List <HalanVersionInfo> r = new List <HalanVersionInfo>();

            List <CheckVersionObject> check = e.Argument as List <CheckVersionObject>;

            foreach (CheckVersionObject c in check)
            {
                HalanVersionInfo inf = HalanServices.GetVersionInfo(c.ProductName, c.CurrentVersion);
                if (inf != null)
                {
                    r.Add(inf);
                }
            }

            e.Result = r;
        }