示例#1
0
        private void contentBrowser1_ItemAfterSelect(ContentBrowser sender, IList <ContentBrowser.Item> items, bool selectedByUser, ref bool handled)
        {
            if (items.Count != 0)
            {
                selectedPackage = (PackageManager.PackageInfo)items[0].Tag;
            }
            else
            {
                selectedPackage = null;
            }

            UpdatePackageControls();
        }
示例#2
0
        void ThreadGetStoreItems()
        {
            try
            {
                string xml = "";
                string url = @"https://www.neoaxis.com/api/get_store_items";

                var request = (HttpWebRequest)WebRequest.Create(url);

                using (var response = (HttpWebResponse)request.GetResponse())
                    using (var stream = response.GetResponseStream())
                        using (var reader = new StreamReader(stream))
                            xml = reader.ReadToEnd();

                XmlDocument xDoc = new XmlDocument();
                xDoc.LoadXml(xml);

                var packages = new List <PackageManager.PackageInfo>();

                foreach (XmlNode itemNode in xDoc.GetElementsByTagName("item"))
                {
                    var info = new PackageManager.PackageInfo();
                    //info.Name = "None";
                    //info.Version = "1.0.0.0";

                    foreach (XmlNode child in itemNode.ChildNodes)
                    {
                        if (child.Name == "name")
                        {
                            info.Name = child.InnerText;
                        }
                        if (child.Name == "author")
                        {
                            info.Author = child.InnerText;
                        }
                        if (child.Name == "version")
                        {
                            info.Version = child.InnerText;
                        }
                        //if( child.Name == "only_pro" && !string.IsNullOrEmpty( child.InnerText ) )
                        //	info.OnlyPro = (bool)SimpleTypes.ParseValue( typeof( bool ), child.InnerText );
                        if (child.Name == "size")
                        {
                            double.TryParse(child.InnerText, out var size);
                            info.Size = (long)size;
                        }
                        if (child.Name == "download")
                        {
                            info.Download = child.InnerText;
                        }
                        if (child.Name == "secure_download" && !string.IsNullOrEmpty(child.InnerText))
                        {
                            info.SecureDownload = (bool)SimpleTypes.ParseValue(typeof(bool), child.InnerText);
                        }
                        if (child.Name == "description")
                        {
                            info.Description = child.InnerText;
                        }
                        if (child.Name == "date")
                        {
                            info.Date = child.InnerText;
                        }
                        if (child.Name == "files")
                        {
                            info.Files = child.InnerText;
                        }
                    }

                    packages.Add(info);
                }

                //sort by date
                CollectionUtility.MergeSort(packages, delegate(PackageManager.PackageInfo p1, PackageManager.PackageInfo p2)
                {
                    if (p1.Date != p2.Date)
                    {
                        return(-string.Compare(p1.Date, p2.Date));
                    }
                    return(0);
                });

                downloadedListOfPackages = packages;

                needUpdateList = true;
            }
            catch { }
        }