public ActionResult DeleteConfirmed(int id) { Vocal vocal = db.Vocal.Find(id); db.Vocal.Remove(vocal); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id_vocal,ced_vocal,nom_vocal,apell_vocal,telf_vocal,correo_vocal")] Vocal vocal) { if (ModelState.IsValid) { db.Entry(vocal).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vocal)); }
public ActionResult Create([Bind(Include = "Id_vocal,ced_vocal,nom_vocal,apell_vocal,telf_vocal,correo_vocal")] Vocal vocal) { if (ModelState.IsValid) { db.Vocal.Add(vocal); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vocal)); }
public Vocals(Sng2014File sngData) { Vocal = new Vocal[sngData.Vocals.Count]; for (var i = 0; i < sngData.Vocals.Count; i++) { var v = new Vocal(); v.Time = sngData.Vocals.Vocals[i].Time; v.Note = sngData.Vocals.Vocals[i].Note; v.Length = sngData.Vocals.Vocals[i].Length; v.Lyric = sngData.Vocals.Vocals[i].Lyric.ToNullTerminatedUTF8(); Vocal[i] = v; } Count = Vocal.Length; }
public void VocalsInOrder(SngFile song) { Vocal lastVocal = null; foreach (var vocal in song._vocals) { if (lastVocal != null) { Assert.Less(lastVocal.Time, vocal.Time); } lastVocal = vocal; } }
// GET: Vocal/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Vocal vocal = db.Vocal.Find(id); if (vocal == null) { return(HttpNotFound()); } return(View(vocal)); }
// GET: Vocal/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } try { Vocal vocal = db.Vocal.Find(id); db.Vocal.Remove(vocal); db.SaveChanges(); TempData["smsok"] = "El dato se elimino correctamente"; ViewBag.smsok = TempData["smsok"]; return(RedirectToAction("Index")); } catch { TempData["sms"] = "No se puede eliminar porque está relacionado con otros registros"; ViewBag.sms = TempData["sms"]; return(RedirectToAction("Index")); } }
private static void parseVocals(Vocals xml, Sng2014File sng) { sng.Vocals = new VocalSection(); sng.Vocals.Count = xml.Vocal.Length; sng.Vocals.Vocals = new Vocal[sng.Vocals.Count]; for (int i = 0; i < sng.Vocals.Count; i++) { var vcl = xml.Vocal[i]; var v = new Vocal(); v.Time = vcl.Time; v.Note = vcl.Note; v.Length = vcl.Length; readString(vcl.Lyric, v.Lyric); sng.Vocals.Vocals[i] = v; } }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); vocalId = (string)e.Parameter; LoadingRing.IsActive = true; loadThread = new Thread(a => { try { vocal = Vocal.GetVocalObject(vocalId); } catch (Exception ex) { Invoke(new Action(delegate { LoadingRing.IsActive = false; Frame.Navigate(typeof(Fail), new Error { ErrorCode = ex.Message, CanBackHome = true, ReTryPage = typeof(VTuber), ReTryArgs = vocalId }); })); } if (vocal != null) { Invoke(new Action(delegate { // 显示数据 OriginalName.Text = vocal.OriginalName; ChineseName.Text = vocal.ChineseName; VocalGroup.Text = string.Format(Lang.ReadLangText("VTuberGroup"), vocal.GroupsId); })); // 判断 Youtube 推特 Bilibili 是否为空 null if (!string.IsNullOrEmpty(vocal.Bilibili) && vocal.Bilibili != "") { Invoke(new Action(delegate { BiliBili.Visibility = Visibility.Visible; })); } if (!string.IsNullOrEmpty(vocal.YouTube) && vocal.YouTube != "") { Invoke(new Action(delegate { Youtube.Visibility = Visibility.Visible; })); } if (!string.IsNullOrEmpty(vocal.Twitter) && vocal.Twitter != "") { Invoke(new Action(delegate { Twitter.Visibility = Visibility.Visible; })); } Invoke(new Action(delegate { var vocalAvatarImg = new BitmapImage(); BackgroundImage.Source = vocalAvatarImg; VocalImage.ProfilePicture = vocalAvatarImg; vocalAvatarImg.UriSource = new Uri(vocal.AvatarImg); })); // 获取歌曲 Song[] songsArray = Song.GetMusicList("VocalId", vocalId, 1, 5000, "CreateTime", "desc"); // 输出歌曲 //songs = Collection.ArrayToObservableCollection(songsArray); foreach (Song songTemp in songsArray) { Invoke(new Action(delegate { songs.Add(songTemp); })); } // 释放内存 songsArray = null; GC.Collect(); Invoke(new Action(delegate { LoadingRing.IsActive = false; })); } }); loadThread.Start(); }
public Home() { InitializeComponent(); #region 获取歌曲 new Thread(a => { Song[] getSongs = new Song[0]; try { getSongs = Song.GetHotMusic(1, 20); } catch (Exception ex) { var reslut = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { Frame.Navigate(typeof(Fail), new Error { ErrorCode = ex.Message, ReTryPage = typeof(Home) }); }); while (true) { if (reslut.Status == AsyncStatus.Completed) { return; } } } foreach (Song songTemp in getSongs) { Invoke(new Action(delegate { songs.Add(songTemp); })); } getSongs = null; }) { IsBackground = true }.Start(); #endregion #region 获取 Banners new Thread(a => { Banner[] getBanners = new Banner[0]; try { getBanners = Banner.GetBanners(); } catch (Exception ex) { var reslut = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { Frame.Navigate(typeof(Fail), new Error { ErrorCode = ex.Message, ReTryPage = typeof(Home) }); }); while (true) { if (reslut.Status == AsyncStatus.Completed) { return; } } } foreach (Banner bannerTemp in getBanners) { Invoke(new Action(delegate { banners.Add(bannerTemp); })); } getBanners = null; }) { IsBackground = true }.Start(); #endregion #region 获取歌手 new Thread(a => { Vocal[] getVocals = new Vocal[0]; try { getVocals = Vocal.GetVocalList("Id", "", 1, 20, "Watch", "desc"); } catch (Exception ex) { var reslut = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { Frame.Navigate(typeof(Fail), new Error { ErrorCode = ex.Message, ReTryPage = typeof(Home) }); }); while (true) { if (reslut.Status == AsyncStatus.Completed) { return; } } } foreach (Vocal vocalTemp in getVocals) { Invoke(new Action(delegate { vocals.Add(vocalTemp); })); } }) { IsBackground = true }.Start(); #endregion #region 获取歌单 new Thread(a => { SongListList[] getSongLists = new SongListList[0]; try { getSongLists = SongListList.GetSongListList("Id", "", 1, 20, "CreateTime", "desc"); } catch (Exception ex) { var reslut = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { Frame.Navigate(typeof(Fail), new Error { ErrorCode = ex.Message, ReTryPage = typeof(Home) }); }); while (true) { if (reslut.Status == AsyncStatus.Completed) { return; } } } foreach (SongListList songListTemp in getSongLists) { Invoke(new Action(delegate { songLists.Add(songListTemp); })); } }) { IsBackground = true }.Start(); #endregion }
private void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e) { pivot = (Pivot)sender; switch (pivot.SelectedIndex) { #region 歌曲搜索 case 0: Log.WriteLine("[UI]搜索音乐: " + searchText, Level.Info); SongProgressRing.IsActive = true; new Thread(a => { Song[] songsArray = new Song[0]; try { songsArray = Song.GetMusicList("OriginName", searchText, 1, 200, "OriginName", "dasc"); } catch (Exception ex) { Invoke(new Action(delegate { SongProgressRing.IsActive = false; Frame.Navigate(typeof(Fail), new Error { ErrorCode = ex.Message, CanBackHome = true, ReTryPage = typeof(Search), ReTryArgs = searchText }); })); } Invoke(new Action(delegate { SongProgressRing.IsActive = false; })); if (songsArray.Length != 0) { Invoke(new Action(delegate { songs.Clear(); for (int i = 0; i != songsArray.Length; i++) { songs.Add(songsArray[i]); } })); } else { Invoke(new Action(delegate { SongFailText.Text = "找不到内容"; })); Log.WriteLine("[UI]搜索音乐: " + searchText + " 失败", Level.Error); } }).Start(); break; #endregion #region VTuber 搜索 case 1: Log.WriteLine("[UI]搜索 VTuber: " + searchText, Level.Info); VTuberProgressRing.IsActive = true; new Thread(a => { Vocal[] vocalsArray = new Vocal[0]; try { vocalsArray = Vocal.GetVocalList("OriginalName", searchText, 1, 200, "OriginalName", "desc"); } catch (Exception ex) { Invoke(new Action(delegate { Frame.Navigate(typeof(Fail), new Error { ErrorCode = ex.Message, CanBackHome = true, ReTryPage = typeof(Search), ReTryArgs = searchText }); VTuberProgressRing.IsActive = false; })); } Invoke(new Action(delegate { VTuberProgressRing.IsActive = false; })); if (vocalsArray.Length != 0) { Invoke(new Action(delegate { vocals.Clear(); for (int i = 0; i != vocalsArray.Length; i++) { vocals.Add(vocalsArray[i]); } })); } else { Invoke(new Action(delegate { VTuberFailText.Text = "找不到内容"; })); Log.WriteLine("[UI]搜索 VTuber: " + searchText + " 失败", Level.Error); } }).Start(); break; #endregion #region 歌单搜索 case 2: Log.WriteLine("[UI]搜索歌单: " + searchText, Level.Info); SongListProgressRing.IsActive = true; new Thread(a => { SongListList[] songListArray = new SongListList[0]; try { songListArray = SongListList.GetSongListList("Name", searchText, 1, 50, "Name", "desc"); } catch (Exception ex) { Invoke(new Action(delegate { Frame.Navigate(typeof(Fail), new Error { ErrorCode = ex.Message, CanBackHome = true, ReTryPage = typeof(Search), ReTryArgs = searchText }); SongListProgressRing.IsActive = false; })); } Invoke(new Action(delegate { SongListProgressRing.IsActive = false; })); if (songListArray.Length != 0) { Invoke(new Action(delegate { songLists.Clear(); for (int i = 0; i != songListArray.Length; i++) { songLists.Add(songListArray[i]); } })); } else { Invoke(new Action(delegate { SongListFailText.Text = "找不到内容"; })); Log.WriteLine("[UI]搜索歌单: " + searchText + " 失败", Level.Error); } }).Start(); break; #endregion } }