private void PlayListForm_Shown(object sender, EventArgs e)
 {
     if (ini.Read("PlayList", "AutoLoad").Equals(true.ToString()) && New)
     {
         AutoLoadBox.Checked = true;
         Check(ini.Read("PlayList", "List"));
     }
     else
     {
         if (lyricsForm.AlbumList == null)
         {
             lyricsForm.GetAlbumList();
         }
         if (ini.Read("PlayList", "AutoLoad").Length > 0)
         {
             AutoLoadBox.Checked = bool.Parse(ini.Read("PlayList", "AutoLoad"));
         }
         foreach (string album in lyricsForm.AlbumList)
         {
             PlayListBox.Items.Add(album);
         }
         foreach (string album in ini.Read("PlayList", "List").Split(','))
         {
             for (int i = 0; i < PlayListBox.Items.Count; i++)
             {
                 if (PlayListBox.GetItemText(PlayListBox.Items[i]).Equals(album))
                 {
                     PlayListBox.SetItemChecked(i, true);
                     break;
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
        void List_MouseDown(object sender, MouseEventArgs e)
        {
            mDownPos = e.Location;
            int index = PlayListBox.IndexFromPoint(new Point(PlayListBox.PointToClient(Cursor.Position).X, PlayListBox.PointToClient(Cursor.Position).Y));

            if (index >= 0 && index < PlayListBox.Items.Count)
            {
                PlayListBox.SelectedIndex = index;
            }
            ContextMenuHelper();
        }
Exemplo n.º 3
0
        public PlayListForm(ApplicationForm applicationForm)
        {
            InitializeComponent();
            playListBox     = new PlayListBox();
            this.parentForm = applicationForm;
            //MessageBox.Show($"{Environment.CurrentDirectory}\\Playlists.db");
            //MessageBox.Show($"{System.IO.Directory.GetParent(System.IO.Directory.GetParent(Environment.CurrentDirectory).FullName)}\\");


            this.pathDB          = $"{Environment.CurrentDirectory}\\Playlists.db";
            this.playlistsModel  = new PlaylistsModel(pathDB);
            this.mediaTrackModel = new MediaTrackModel(pathDB);
        }
Exemplo n.º 4
0
        void List_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            int index = PlayListBox.IndexFromPoint(e.Location);

            if (index < 0)
            {
                return;
            }
            if (Math.Abs(e.X - mDownPos.X) >= SystemInformation.DragSize.Width ||
                Math.Abs(e.Y - mDownPos.Y) >= SystemInformation.DragSize.Height)
            {
                DoDragDrop(new DragObject(PlayListBox, PlayListBox.Items[index]), DragDropEffects.Move);
            }
        }
Exemplo n.º 5
0
        void List_DragDrop(object sender, DragEventArgs e)
        {
            DragObject   obj      = e.Data.GetData(typeof(DragObject)) as DragObject;
            int          index    = PlayListBox.IndexFromPoint(new Point(PlayListBox.PointToClient(Cursor.Position).X, PlayListBox.PointToClient(Cursor.Position).Y));
            int          oldIndex = obj.source.Items.IndexOf(obj.item);
            PlayListItem tempItem = (PlayListItem)obj.item;

            obj.source.Items.Remove(obj.item);
            playListManager.Remove(tempItem);
            if (index < 0 || index >= PlayListBox.Items.Count)
            {
                PlayListBox.Items.Add(obj.item);
                playListManager.AddTrack(tempItem);
            }
            else
            {
                PlayListBox.Items.Insert(index, obj.item);
                playListManager.InsertTrack(index, tempItem);
            }
        }
Exemplo n.º 6
0
        private void DirectoryBox_TextChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(DirectoryBox.Text))
            {
                DirectoryBox.Text = @".\";
            }

            var collector = new Collector(DirectoryBox.Text);

            if (!collector.DirectoryInfo.Exists)
            {
                return;
            }

            collector.Collect();
            var list = collector.GetPlayList();

            list.Randomize();

            if (list.Count < 1)
            {
                return;
            }

            player.PlayList = list;

            Task.Run(() =>
            {
                foreach (var item in player.PlayList.ToList())
                {
                    PlayListBox.Invoke(new MethodInvoker(() =>
                    {
                        PlayListBox.Items.Add($"{item.Key}. {item.Value.Name}");
                    }));
                }

                PlayListBox.Invoke(new MethodInvoker(() => {
                    PlayListBox.SelectedItem = PlayListBox.Items[0];
                }));
            });
        }