Exemplo n.º 1
0
        public async void LoadVersionNotes()
        {
            StorageFile myFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///ReleaseNotes.csv"));

            string content = await Windows.Storage.FileIO.ReadTextAsync(myFile);

            CsvFile file = CsvFile.CreateFromCsvFileContent(content);
            int     t    = 0;

            for (t = file.Rows.Count - 1; t > 0; t--)
            {
                string version      = file.Rows[t].Values[0];
                string publish_date = file.Rows[t].Values[1];
                string notes        = file.Rows[t].Values[2];
                string full         = "v" + version + " (" + publish_date + ") " + notes;

                TextBlock tb = new TextBlock();
                tb.HorizontalAlignment = HorizontalAlignment.Center;
                tb.VerticalAlignment   = VerticalAlignment.Center;
                tb.Text         = full;
                tb.TextWrapping = TextWrapping.WrapWholeWords;
                tb.Margin       = new Thickness(5);
                StackPanel_WhatsNew.Children.Add(tb);
            }
        }
        public static DataSet CreateFromCsvFileContent(string content)
        {
            DataSet csvds = new DataSet();
            CsvFile csv   = CsvFile.CreateFromCsvFileContent(content);

            List <DataRecord> Records = new List <DataRecord>();
            int t = 0;

            for (t = 1; t <= csv.Rows.Count - 1; t++)
            {
                DataRecord dr = new DataRecord();

                List <DataAttribute> Attributes = new List <DataAttribute>();
                int r = 0;
                for (r = 0; r <= csv.Rows[0].Values.Count - 1; r++)
                {
                    DataAttribute da = new DataAttribute();
                    da.Name  = csv.Rows[0].Values[r];
                    da.Value = csv.Rows[t].Values[r];
                    Attributes.Add(da);
                }

                dr.Attributes = Attributes;
                Records.Add(dr);
            }


            csvds.Records = Records;
            return(csvds);
        }