Пример #1
0
        //ТРЕКИ
        void Track()
        {
            DisposeViewControls();

              trackControl = new ViewGenreControl()
              {
            Width = ViewWidth,
            Height = ViewHeigth,
            AutoScroll = autoScroll,
            Location = location
              };

              trackControl.FindBtn.Click += delegate (object sender1, EventArgs e1)
              {
            tracklist = db.Tracks.Where(p => p.Name.Contains(trackControl.textBox1.Text)).ToList();
            Track();
              };

              int i = 0;
              int pos = startRowPosition;
              foreach(Track item in tracklist)
              {
            RowControl row = new RowControl
              (
              item.Name,
              item.Length.ToString(),
              item.Number.ToString(),
              item.Album.ToString()
              );

            row.Name = "r_" + i.ToString();
            row.Location = new Point(rowPaddingLeft, pos);
            row.DoubleClick += delegate (object sender2, EventArgs e2)
            {
              MessageBoxButtons buttons = MessageBoxButtons.YesNo;
              DialogResult result = MessageBox.Show("Открыть браузер для поиска песни Вконтакте?", "confirm", buttons);

              if(result == DialogResult.Yes)
              {
            string url = "https://vk.com/search?c[q]=" + item.Name + "&c%5Bsection%5D=audio";
            Process.Start(url);
              }

            };
            i++;
            pos += interval;

            trackControl.Controls.Add(row);
              }
              Controls.Add(trackControl);
        }
Пример #2
0
        //ЖАНРЫ
        void Genre()
        {
            DisposeViewControls();

              genreControl = new ViewGenreControl()
              {
            Width = ViewWidth,
            Height = ViewHeigth,
            AutoScroll = autoScroll,
            Location = location
              };

              genreControl.FindBtn.Click += delegate (object sender1, EventArgs e1)
              {
            genrelist = db.Genres.Where(p => p.Name.Contains(genreControl.textBox1.Text)).ToList();
            Genre();
              };

              int i = 0;
              int pos = startRowPosition;
              foreach(Genre item in genrelist)
              {
            RowControl row = new RowControl
              (
              item.Name,
              "", "", ""
              );
            row.Name = "r_" + i.ToString();
            row.Location = new Point(rowPaddingLeft, pos);
            row.DoubleClick += delegate (object sender2, EventArgs e2)
            {
              albumlist = db.Albums.Where(p => p.GenreId == item.Id).ToList();
              Albums();
            };
            i++;
            pos += interval;

            genreControl.Controls.Add(row);
              }
              Controls.Add(genreControl);
        }