public DirectoryListItem(int width, int height, songInfo info)
        {
            itemInfo = info;

            _isPressed = false;
            _background = new System.Windows.Controls.Image();
            _background.Stretch = Stretch.Fill;
            _background.Width = width;
            _background.Height = height;
            this.Children.Add(_background);

            _artist = new System.Windows.Controls.Label();
            _artist.Content = info.artist;
            _artist.Margin = new Thickness(0, 0, 0, 0);
            _artist.FontFamily = new System.Windows.Media.FontFamily("Calibri");
            _artist.FontSize = 20.0;
            _artist.Foreground = System.Windows.Media.Brushes.White;
            this.Children.Add(_artist);

            _title = new System.Windows.Controls.Label();
            _title.Content = info.title;
            _title.FontFamily = new System.Windows.Media.FontFamily("Calibri");
            _title.FontSize = 16.0;
            _title.Foreground = System.Windows.Media.Brushes.White;
            _title.Margin = new Thickness(0, 30, 0, 0);
            this.Children.Add(_title);

            itemInfo = info;
        }
예제 #2
0
        private void DirectoryTouchMove(object sender, TouchEventArgs e)
        {
            if (directory.IsDragging() && !selectedItemExists)
            {
                //clear the last song info
                selectedItem = new songInfo();
                //get the song in the array that was selected
                selectedItem = directory.GetSelectedSong();

                selected = new DirectoryListItem(385, 100, selectedItem);
                selected.Margin = new Thickness((int)e.TouchDevice.GetTouchPoint(this).Position.X - (385 / 2), (int)e.TouchDevice.GetTouchPoint(this).Position.Y - (100 / 2), 0, 0);
                selected.SetBackgroundImage(@"png/inforthekill.png");
                selected.Width = 385;
                selected.Height = 100;
                if (!selectedItemExists)
                {
                    //_canvas.Children.Add(selected);
                    if (!dragDropInit)
                    {
                        // Initialize the drag & drop operation
                        DataObject dragData = new DataObject("songInfo", selectedItem);
                        DragDrop.DoDragDrop(selected, dragData, DragDropEffects.Move);
                    }
                    directory.ResetSelection();
                }
            }
        }
예제 #3
0
        static void MakeDataArray(string userFile)
        {
            DirectoryInfo di = new DirectoryInfo(userFile);
            FileInfo[] rgFiles = di.GetFiles("*.mp3");


            FILELISTLENGTH = rgFiles.Length;
            songList = new songInfo[rgFiles.Length];

            TagLib.File temp;

            int x = 0;
            foreach (FileInfo fi in rgFiles)
            {
                songList[x] = new songInfo();
                temp = TagLib.File.Create(fi.FullName);
                songList[x].artist = temp.Tag.FirstPerformer;
                songList[x].title = temp.Tag.Title;
                songList[x].year = Convert.ToString(temp.Tag.Year);
                songList[x].album = temp.Tag.Album;
                songList[x].bitRate = temp.Properties.AudioBitrate;
                songList[x].songLength = (long)temp.Properties.Duration.TotalSeconds;
                songList[x].size = fi.Length / 1024;
                songList[x].name = fi.Name;
                songList[x].path = fi.FullName;
                x++;
            }
        }
 public void UpdateLabel(songInfo info)
 {
     _titleLabel.Content = info.title;
     _artistLabel.Content = info.artist;
     this.InvalidateVisual();
 }