private static void FromFile(Stream stream)
        {
            List <int[]> values = new List <int[]>();

            using (TextReader streamReader = new StreamReader(stream))
            {
                using (var reader = new CsvHelper.CsvParser(streamReader))
                {
                    for (var record = reader.Read(); record != null; record = reader.Read())
                    {
                        values.Add(record.Select(int.Parse).ToArray());
                    }

                    int[,] matrix = new int[values.Count(), values.First().Count()];

                    for (var r = 0; r < matrix.GetLength(0); r++)
                    {
                        for (var c = 0; c < matrix.GetLength(1); c++)
                        {
                            matrix[r, c] = values[r][c];
                        }
                    }

                    OnImport?.Invoke(null, new CsvImport(matrix));
                }
            }
        }
Example #2
0
        private async void getMediaData(ISearchResult result)
        {
            Dispatcher.BeginInvoke(new Action(() =>
            {
                _grid_cover.Visibility = Visibility.Visible;
            })).Wait();


            AllMusicApiAgent agent = new AllMusicApiAgent();

            IGmtMedia mediaData;

            if (result.ResultType == SearchResultType.Album)
            {
                mediaData = await agent.GetAlbum(result.ID);
            }
            else
            {
                mediaData = await agent.GetArtist(result.ID);
            }

            Dispatcher.BeginInvoke(new Action(() =>
            {
                _grid_cover.Visibility = Visibility.Hidden;
                OnImport?.Invoke(this, mediaData);
            }));
        }
Example #3
0
        private IEnumerator InvokeOnImport()
        {
            //Wait until the pasted objects are rendered
            yield return(new WaitForEndOfFrame());

            //Notify listeners that the copied objects were pasted
            OnImport?.Invoke(ObjectSelection.Instance.GetSelectable());
        }