Exemplo n.º 1
0
        private void fmAllProducts_Load(object sender, EventArgs e)
        {
            catalog = GetCatalog();

            var listCategory = catalog.Shop.Categories.Category;

            /*
             *
             * var list = new List<CategoryB>();
             * var listCategory = new CategoryB().GetListCategory();
             *
             *
             * foreach (var item in listCategory)
             * {
             *  var obList = new CategoryB().GetListcategoryToPrice(item.Id);
             *  foreach (var ob in obList)
             *  {
             *      if (!list.Any(x=>x.Id == ob.Id))
             *      {
             *          o
             *          list.Add(ob);
             *      }
             *  }
             * }
             *
             *
             *
             */
            GetListNodes(null, listCategory);
        }
Exemplo n.º 2
0
        public static Yml_catalog Parse(byte[] xml)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Yml_catalog));
            Yml_catalog   result     = (Yml_catalog)serializer.Deserialize(new MemoryStream(xml));

            return(result);
        }
Exemplo n.º 3
0
        private Yml_catalog GetCatalog()
        {
            XmlSerializer formatter = new XmlSerializer(typeof(Yml_catalog));

            //Yml_catalog ob;

            using (FileStream fs = new FileStream("price.xml", FileMode.Open))
            {
                catalog = (Yml_catalog)formatter.Deserialize(fs);
            }
            return(catalog);
        }
Exemplo n.º 4
0
            public void hhh()
            {
                var yml = new Yml_catalog()
                {
                    Date = DateTime.Now.ToString("yyyy-MM-dd mm:ss"),
                    Shop = new Shop().GetShops()
                };

                XmlSerializer formatter = new XmlSerializer(typeof(Yml_catalog));

                using (FileStream fs = new FileStream("price.xml", FileMode.Create))
                {
                    formatter.Serialize(fs, yml);
                }
            }
Exemplo n.º 5
0
        public static async Task <List <Offer> > GetOffers()
        {
            try {
                using (var client = new HttpClient()) {
                    var result = await client.GetAsync("https://yastatic.net/market-export/_/partner/help/YML.xml").ConfigureAwait(false);

                    if (result.IsSuccessStatusCode && result.StatusCode == System.Net.HttpStatusCode.OK)
                    {
                        StreamReader  reader     = new StreamReader(await result.Content.ReadAsStreamAsync(), System.Text.Encoding.GetEncoding(1251));
                        XmlSerializer serializer = new XmlSerializer(typeof(Yml_catalog));
                        Yml_catalog   offers     = (Yml_catalog)serializer.Deserialize(reader);
                        return(offers.Shop.Offers);
                    }
                }
            }
            catch (Exception e) {
                return(null);
            }
            return(null);
        }
Exemplo n.º 6
0
        public MainPage()
        {
            InitializeComponent();
            byte[]      xml = Data.GetAsync();
            Yml_catalog cat = Data.Parse(xml);

            off    = cat.Shop.Offers;
            result = new List <string>();
            foreach (var offer in off.Offer)
            {
                result.Add(offer.Id);
            }
            ListView listView = new ListView();

            listView.ItemsSource = result;
            listView.ItemTapped += this.ToCommonPage;
            this.Content         = new StackLayout {
                Children = { listView }
            };
        }