Example #1
0
 /// <summary>
 /// 歌词定时刷新
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void timer_lrc_Tick(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(currLrcLink))
     {
         if (wmp_music.playState == WMPLib.WMPPlayState.wmppsPlaying)
         {
             lbl_LrcShow.BackColor = Color.Transparent;
             if (lrcInfo == null)
             {
                 lrcInfo = LrcInfo.InitLrc(currLrcLink);
             }
             double times = wmp_music.Ctlcontrols.currentPosition;
             if (lrcInfo == null || lrcInfo.LrcWord.Count <= 0)
             {
                 lbl_LrcShow.Text = "歌词加载失败";
                 timer_lrc.Stop();
                 return;
             }
             string lrcText = lrcInfo.LrcWord.Where(i => Math.Round(i.Key) == Math.Round(times)).Select(i => i.Value).FirstOrDefault();
             if (lrcText != null)
             {
                 lbl_LrcShow.Text = lrcText;
                 //歌词自动居中
                 lbl_LrcShow.Location = new Point((850 - lbl_LrcShow.Width) / 2, lbl_LrcShow.Location.Y);
             }
         }
     }
 }
Example #2
0
        private void listView_musicList_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            string listViewTag = this.listView_musicList.SelectedItems[0].Tag.ToString();

            currSongLink = listViewTag;
            string[] urls    = listViewTag.Split('|');
            string   songUrl = string.Empty;

            if (urls[1].Contains("http"))
            {
                songUrl = urls[1];
            }
            else
            {
                songUrl = Path.Combine(LrcInfo.BaseUrl, "song\\" + urls[1]);
            }
            currLrcLink        = urls[3].Contains("http") ? urls[3] : "song\\" + urls[3];
            this.wmp_music.URL = songUrl;
            this.wmp_music.Ctlcontrols.play();
            //开始播放时 触发歌词显示
            lbl_LrcShow.Text = "歌词加载中...";
            lrcInfo          = null;
            timer_lrc.Start();
            this.btn_lrc.Visible = this.btn_mv.Visible = !string.IsNullOrEmpty(urls[2]);
            SelectedIndex        = this.listView_musicList.SelectedItems[0].Index;
        }
Example #3
0
        public ActionResult Create([Bind(Include = "LrcInfoId,Name,Area,CompanyNumber,CharityNumber,Address1,Address2,Address3,PostCode,Phone,Email,Website,PaymentTerms,BankAccountName,BankAccountSortCode,BankAccountNumber,InformationRequested,Declaration")] LrcInfo lrcInfo)
        {
            if (ModelState.IsValid)
            {
                db.LrcInfoes.Add(lrcInfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(lrcInfo));
        }
Example #4
0
        // GET: LrcInfoes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LrcInfo lrcInfo = db.LrcInfoes.Find(id);

            if (lrcInfo == null)
            {
                return(HttpNotFound());
            }
            return(View(lrcInfo));
        }
Example #5
0
 public ActionResult DeleteConfirmed(int id)
 {
     try
     {
         LrcInfo lrcInfo = db.LrcInfoes.Find(id);
         db.LrcInfoes.Remove(lrcInfo);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch (DbUpdateConcurrencyException)
     {
         ViewBag.Message = "Sorry, couldn't delete due to a concurrency issue <br />Please try again";
         return(RedirectToAction("Delete"));
     }
 }
Example #6
0
 public ActionResult Edit([Bind(Include = "LrcInfoId,Name,Area,CompanyNumber,CharityNumber,Address1,Address2,Address3,PostCode,Phone,Email,Website,PaymentTerms,BankAccountName,BankAccountSortCode,BankAccountNumber,InformationRequested,Declaration, RowVersion")] LrcInfo lrcInfo)
 {
     if (!ModelState.IsValid)
     {
         return(View(lrcInfo));
     }
     try
     {
         db.Entry(lrcInfo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch (DbUpdateConcurrencyException)
     {
         ViewBag.Message = "Sorry, couldn't update due to a concurrency issue <br />Please try again";
         return(View(lrcInfo));
     }
 }
Example #7
0
 private static void ForeachRegexResult(Color TextColor, IList <LrcInfo> lrcList, MatchCollection collection, bool Is2time)
 {
     foreach (Match item in collection)
     {
         string newLine = item.Value.Replace("[", "");
         newLine = newLine.Replace("]", "@");
         string[] splitLrcData = newLine.Split('@');
         var      max          = splitLrcData.Length;
         for (int turn = 0; turn < max - 1; turn++)
         {
             LrcInfo mLrcContent = new LrcInfo();
             try {
                 mLrcContent.LrcString = splitLrcData[max - 1].Replace(@"\n", " ");
                 if (Is2time)
                 {
                     mLrcContent.LrcTime = Time2Str(splitLrcData[turn]);
                 }
                 else
                 {
                     mLrcContent.LrcTime = Time3Str(splitLrcData[turn]);
                 }
                 mLrcContent.Color = TextColor;
                 if (mLrcContent.LrcTime != 0 && !string.IsNullOrEmpty(mLrcContent.LrcString))
                 {
                     lrcList.Add(mLrcContent);
                 }
             } catch (IndexOutOfRangeException) {
                 Debug.WriteLine("索引超范围异常");
             } catch (NullReferenceException) {
                 Debug.WriteLine("错误  还未检测到歌词正文");
             } catch (ArgumentNullException) {
                 Debug.WriteLine("算数空值异常  内容错误");
             }
         }
     }
 }