Пример #1
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);
        }
Пример #2
0
        private void PlayListForm_Load(object sender, EventArgs e)
        {
            PlaylistsModel playlistsModel = new PlaylistsModel($"{Environment.CurrentDirectory}\\Playlists.db");

            this.panelBox.Controls.Add(playListBox);
            playListBox.Dock      = DockStyle.Fill;
            playListBox.BackColor = Color.Red;
            this.StartPosition    = FormStartPosition.Manual;
            this.Location         = new Point(
                parentForm.Left + parentForm.Size.Width,
                parentForm.Top
                );


            foreach (var item in playlistsModel.PlayLists.Values)
            {
                ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem();
                toolStripMenuItem.Text = item.ToString();
                playlistsToolStripMenuItem.DropDownItems.Add(toolStripMenuItem);
                toolStripMenuItem.Click += ToolStripMenuItem_Click;
            }
            if (playlistsToolStripMenuItem.DropDownItems.Count > 0)
            {
                ((ToolStripMenuItem)playlistsToolStripMenuItem.DropDownItems[0]).Checked = true;
                int id_default = playlistsModel.PlayLists.Keys[0];
                //


                /* int index = 1;
                 * foreach (MediaTrackRecord item in mediaTrackModel.getRecordsFromPlayList(id_default))
                 * {
                 *   //playListBox.Items.Add($"{index}. {item.trackName}");
                 *   playListBox.Items.Add(item);
                 *   index++;
                 * }   */
                addRowToPlayList(id_default);
            }
            playListBox.MouseDoubleClick += PlayListBox_MouseDoubleClick;
        }