Ejemplo n.º 1
0
        private async Task <DataGridLine[]> GetDataFromServer()
        {
            WebClient c = new WebClient();

            c.UseDefaultCredentials = true;
            var result = await c.OpenReadTaskAsync(LanguagesURL);

            string data = await new StreamReader(result).ReadToEndAsync();

            // Name    Desc   type    Link
            string[] lines = data.Split('\n');
            int      len   = lines.Length;

            DataGridLine[] l = new DataGridLine[len];


            for (int i = 0; i < len; i++)
            {
                string[] s = lines[i].Split(',');
                l[i] = new DataGridLine()
                {
                    Name = s[0], Description = s[1], Type = s[2], Link = s[3]
                };
            }

            return(l);
        }
Ejemplo n.º 2
0
        private async Task <DataGridLine[]> LoadThemes()
        {
            WebClient client = new WebClient();
            Stream    s      = await client.OpenReadTaskAsync(downloadURL);

            string text = await new StreamReader(s).ReadToEndAsync();

            string[] lines = text.Split('\n');
            int      len   = lines.Length;

            DataGridLine[] dgLines = new DataGridLine[len];

            for (int i = 0; i < len; i++)
            {
                string[] str = lines[i].Split(',');
                dgLines[i] = new DataGridLine()
                {
                    themeName = str[0], dwLink = str[2], themeCathegory = str[1]
                };
            }

            return(dgLines);
        }