public MainPage() { InitializeComponent(); players = new ComposerControlHelper(); jwSkinPackage = new JwSkinPackage(); jwSkinPackage.SkinReady += JwSkinPackageSkinPackageReady; Player.MouseLeftButtonUp += Player_MouseLeftButtonUp; Player.Cursor = Cursors.Hand; bridge = new HtmlInteraction(this); bridge.AddBinding(Player); if (!String.IsNullOrEmpty(srcPlaylist)) { Player.LoadPlaylist(srcPlaylist); } AddBinding(Player); ControlBarView.AddBinding(Player); DisplayView.AddBinding(Player); DockView.AddBinding(Player); PlaylistView.AddBinding(Player); CaptionView.AddBinding(Player); DockView.CaptionVisibilityChanged += DockView_CaptionVisibilityChanged; controlBarFader = new OpacityFader(ControlBarView); dockFader = new OpacityFader(DockView); SetFadeTimer(); CaptionView.Margin = new Thickness(0, 0, 0, 75); // we don't know the height until images are all loaded... take a guess for now! }
public ActionResult PlayPlist(int id) { HttpResponseMessage resPlist = APIService.client.GetAsync("Playlist/" + id).Result; PlaylistView model = resPlist.Content.ReadAsAsync <PlaylistView>().Result; //list music HttpResponseMessage resMusic = APIService.client.GetAsync("PlaylistMusic?idPlist=" + id).Result; ViewBag.music = resMusic.Content.ReadAsAsync <IEnumerable <MusicView> >().Result; //random playlist HttpResponseMessage resRandom = APIService.client.GetAsync("Playlist?idCate=" + model.CateID + "&number=" + 3).Result; ViewBag.random = resRandom.Content.ReadAsAsync <IEnumerable <PlaylistView> >().Result; //PlaylistUser if (Session["UserID"] != null) { HttpResponseMessage res = APIService.client.GetAsync("Playlist?idUser="******"UserID"])).Result; IEnumerable <PlaylistView> plist = res.Content.ReadAsAsync <IEnumerable <PlaylistView> >().Result; if (plist.Count() > 0) { ViewBag.plist = plist; } else { ViewBag.plist = null; } } return(View(model)); }
public ActionResult CreatePlaylistUser(PlaylistView p, HttpPostedFileBase imgMusic) { //img music if (imgMusic == null) { p.PlaylistImage = "default.png"; } else { string FileNameMusic = DateTime.Now.Ticks + Path.GetFileName(imgMusic.FileName); string pathMusic = Path.Combine(Server.MapPath("~/Resource/ImagesMusic"), FileNameMusic); imgMusic.SaveAs(pathMusic); p.PlaylistImage = FileNameMusic; } var res = APIService.client.PostAsJsonAsync("Playlist", p).Result; if (res.IsSuccessStatusCode) { TempData["success"] = "Tạo playlist thành công"; } else { TempData["error"] = "Tạo playlist xảy ra lỗi"; } return(RedirectToAction("PersonalUser", new { id = p.UserID })); }
private void PlaylistView_DragOver(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(List <ListViewItem>))) { e.Effect = DragDropEffects.Move; } int N = PlaylistView.Items.Count; if (N == 0) { DropIndex = 0; Application.DoEvents(); return; } Point mLoc = PlaylistView.PointToClient(Cursor.Position); Rectangle r0 = PlaylistView.Items[0].Bounds; Rectangle r1 = PlaylistView.Items[N - 1].Bounds; var hitt = PlaylistView.HitTest(mLoc); if (hitt.Item == null) { if (mLoc.Y < r0.Y) { PlaylistView.InsertionMark.AppearsAfterItem = false; PlaylistView.InsertionMark.Index = 0; DropIndex = 0; } else if (mLoc.Y > r1.Y) { PlaylistView.InsertionMark.AppearsAfterItem = true; PlaylistView.InsertionMark.Index = N - 1; DropIndex = N; } } else { int idx = hitt.Item.Index; PlaylistView.InsertionMark.Index = idx; if (mLoc.Y < r0.Y) { PlaylistView.InsertionMark.AppearsAfterItem = false; DropIndex = 0; } else { PlaylistView.InsertionMark.AppearsAfterItem = true; DropIndex = idx + 1; } if (idx == prevItem) { return; } } Application.DoEvents(); }
private async Task <StackLayout> GetPlaylist() { var Results = await GetPlaylistDetails.ById(PlaytlistId); var CoverImg = Results.Images.Where(size => size.Height > 300).Select(img => img.Url).FirstOrDefault(); var NumberOfSongs = Results.Number_Of_Songs; var Date = Convert.ToDateTime(Results.Date).Year.ToString(); var Name = Results.Playlist_Name; var Playlist = Results.Songs; var stack = new StackLayout(); await Task.Run(() => { var playlistView = new PlaylistView(); playlistView.Artist = "Variety"; playlistView.Title = Name; playlistView.ImageUrl = CoverImg; playlistView.Number_Of_Songs = $"{NumberOfSongs}"; playlistView.Year = Date; playlistView.SongList = Playlist; stack.Children.Add(playlistView); }); return(stack); }
public ActionResult CreatePlaylist(PlaylistView p, HttpPostedFileBase imgPlaylist) { if (imgPlaylist == null) { p.PlaylistImage = "default.png"; } else { string FileName = DateTime.Now.Ticks + Path.GetFileName(imgPlaylist.FileName); string path = Path.Combine(Server.MapPath("~/Resource/ImagesMusic"), FileName); imgPlaylist.SaveAs(path); p.PlaylistImage = FileName; } HttpResponseMessage res = APIService.client.PostAsJsonAsync("Playlist", p).Result; if (res.IsSuccessStatusCode) { TempData["success"] = "Create new playlist successfully!"; } else { TempData["error"] = "Create new playlist failed!"; } return(RedirectToAction("Playlist")); }
public void OnPlaylistView(Playlist p) { PlaylistView = new PlaylistView { DataContext = new PlaylistViewModel { Playlist = p } }; }
public ActionResult PlaylistDetailUser(int id) { HttpResponseMessage res = APIService.client.GetAsync("Playlist/" + id).Result; PlaylistView model = res.Content.ReadAsAsync <PlaylistView>().Result; HttpResponseMessage resPM = APIService.client.GetAsync("PlaylistMusic/" + id).Result; TempData["pm"] = resPM.Content.ReadAsAsync <IEnumerable <PlaylistMusicView> >().Result; return(View(model)); }
// GET api/<controller>/5 public IHttpActionResult GetID(int id) { var p = Repositories.GetPlaylistByID(id); var item = new PlaylistView { ID = p.ID, CateID = p.CateID, CateName = p.Category.CateName, PlaylistDescription = p.PlaylistDescription, PlaylistImage = p.PlaylistImage, PlaylistName = p.PlaylistName, UserID = p.UserID, UserName = Repositories.GetUserByID(p.UserID).UserName, UserImg = Repositories.GetUserByID(p.UserID).UserImage }; return(Ok(item)); }
public bool AdvanceNext(out string filename, out int track) { filename = string.Empty; track = 0; if (PlaylistView.RowCount == 0) { return(false); } if (PlaylistView.SelectedRows.Count == 0) { return(false); } int index = PlaylistView.SelectedRows[0].Index; PlaylistView.ClearSelection(); if (RandomMode) { Random rand = new Random(); int newRandomIndex = rand.Next(0, PlaylistView.RowCount); while (newRandomIndex == index) { newRandomIndex = rand.Next(0, PlaylistView.RowCount); } index = newRandomIndex; } else { index++; if (index == PlaylistView.RowCount) { if (LoopMode) { index = 0; } else { return(false); } } } DataGridViewRow row = PlaylistView.Rows[index]; if (row != null && row.DataBoundItem is BmpMidiEntry entry) { filename = entry.FilePath.FilePath; track = entry.Track.Track; row.Selected = true; } return(true); }
private void PlaylistView_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (PlaylistView.SelectedIndices.Count == 0) { return; } var Index = GetFocusedItem(); var track = Tracks[Index]; var Items = new Dictionary <string, ToolStripItem>(); foreach (var item in MenuItems) { DropDownMenu.Items.Remove(item); Items.Add(item.Text, item); } if (track.Status == Track.StatusType.Local) { DropDownMenu.Items.Insert(0, Items[Names.Play]); DropDownMenu.Items.Insert(1, Items[Names.Pause]); DropDownMenu.Items.Insert(2, Items[Names.Stop]); DropDownMenu.Items.Insert(3, Items[Names.Numbers]); if (track.IsM4a) { DropDownMenu.Items.Insert(4, Items[Names.ConvertMP3]); } } else if (track.Status == Track.StatusType.Offline) { DropDownMenu.Items.Insert(0, Items[Names.Play]); DropDownMenu.Items.Insert(1, Items[Names.Title]); DropDownMenu.Items.Insert(2, Items[Names.DAgain]); DropDownMenu.Items.Insert(3, Items[Names.Numbers]); DropDownMenu.Items.Insert(4, Items[Names.Dir]); if (track.IsM4a) { DropDownMenu.Items.Insert(2, Items[Names.ConvertMP3]); } } else if (track.Status == Track.StatusType.Online) { DropDownMenu.Items.Insert(0, Items[Names.DP]); DropDownMenu.Items.Insert(1, Items[Names.Title]); DropDownMenu.Items.Insert(2, Items[Names.JDownload]); DropDownMenu.Items.Insert(3, Items[Names.Numbers]); } var font = DropDownMenu.Items[0].Font; DropDownMenu.Items[0].Font = new Font(font.FontFamily, font.Size, FontStyle.Bold); DropDownMenu.Show(PlaylistView.PointToScreen(e.Location)); } }
public void OpenPlaylistPanel() { if (!_tabTracker.ContainsSideTab(_playlistView?.ViewModel)) { _playlistView = new PlaylistView(); _mainWindowViewModel.PlaylistViewModel = _playlistView.ViewModel; CreateSidePanel(_playlistView, _playlistView.ViewModel, "Playlists"); } _playlistView.ViewModel.IsActive = true; }
void NewNextWait() { var sources = Enumerable.Range(0, WorkerCount).Select(_ => new TaskCompletionSource <bool>()).ToArray(); var whenAll = Task.WhenAll(sources.Select(source => source.Task)).ContinueWith(_ => { WorkerAllDone.TryPop(out var done); NewNextWait(); return(PlaylistView.Next().Result); }); WorkerWaitSources.PushRange(sources); WorkerAllDone.Push(whenAll); }
public Overview() { InitializeComponent(); LoggedUser = ((App)Application.Current).LoggedUser; oUC = new OverviewUC(); pUC = new PlaylistView(); GD_Content.Children.Add(oUC); ((App)Application.Current).Overview = this; }
private void ResetSelectedPlaylist() { var lastSelected = PlaylistView.FirstOrDefault(p => p.Id == LastSelectedPlaylistId); if (lastSelected == null && PlaylistView.Any()) { lastSelected = PlaylistView.First(); } SelectedPlaylist = lastSelected; SelectedPlaylistItem = SelectedPlaylist?.Current; }
// POST api/<controller> public IHttpActionResult Post(PlaylistView p) { var item = new Playlist { ID = p.ID, CateID = p.CateID, PlaylistDescription = p.PlaylistDescription, PlaylistImage = p.PlaylistImage, PlaylistName = p.PlaylistName, UserID = p.UserID }; var res = Repositories.CreatePlaylist(item); if (res == true) { return(Ok()); } return(InternalServerError()); }
private void BmpMidiEntryList_MouseDown(object sender, MouseEventArgs e) { rowIndex = PlaylistView.HitTest(e.X, e.Y).RowIndex; if (rowIndex != -1) { Size dragSize = SystemInformation.DragSize; dragBox = new Rectangle(new Point(e.X - (dragSize.Width / 2), e.Y - (dragSize.Height / 2)), dragSize); } else { dragBox = Rectangle.Empty; } }
private void PlaylistView_ItemDrag(object sender, ItemDragEventArgs e) { var items = new List <ListViewItem>(); items.Add((ListViewItem)e.Item); foreach (ListViewItem lvi in PlaylistView.SelectedItems) { if (!items.Contains(lvi)) { items.Add(lvi); } } PlaylistView.DoDragDrop(items, DragDropEffects.Move); }
private void BmpMidiEntryList_DragDrop(object sender, DragEventArgs e) { Point clientPoint = this.PointToClient(new Point(e.X, e.Y)); DataGridView.HitTestInfo hit = PlaylistView.HitTest(clientPoint.X, clientPoint.Y); // for internal drag-and-drop if (actuallyMoving) { int targetRowIndex = hit.RowIndex - 1; if (hit.Type == DataGridViewHitTestType.None) { // user has dnd onto empty space, simply move midi to the end of the playlist targetRowIndex = PlaylistView.RowCount - 1; } BmpMidiEntry oldData = PlaylistView.Rows[initialRowIndexForMovement].DataBoundItem as BmpMidiEntry; RemovePlaylistEntry(initialRowIndexForMovement); AddPlaylistEntry(oldData.FilePath.FilePath, oldData.Track.Track, targetRowIndex); actuallyMoving = false; return; } int dropIndex = 0; if (hit.Type == DataGridViewHitTestType.Cell) { // user has dnd onto an existing cell, move above the hovered midi dropIndex = hit.RowIndex - 1; } else if (hit.Type == DataGridViewHitTestType.None) { // user has dnd onto empty space, simply add midi to the end of the playlist dropIndex = playlistEntries.Count; } if (e.Effect == DragDropEffects.Move) { // just in case the user gets fancy with it and dnd's multiple midis string[] midiList = (string[])e.Data.GetData(DataFormats.FileDrop, false); foreach (string midiFilePath in midiList) { string filename = Path.GetFileName(midiFilePath); BmpPlaylistRequestAddEvent addEvent = new BmpPlaylistRequestAddEvent(filename, 0, dropIndex); OnPlaylistManualRequestAdd?.Invoke(this, addEvent); } } }
public HttpResponseMessage IncreaseView([FromUri] int id) { using (var db = new OnlineMusicEntities()) { var playlist = (from a in db.Playlists where a.Id == id select a).FirstOrDefault(); if (playlist == null) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Không tìm thấy playlist id=" + id)); } else if (playlist.Songs.Count > 0) { var views = (from v in db.PlaylistViews where v.PlaylistId == id select v).FirstOrDefault(); // Create new if song hasn't view yet if (views == null) { views = new PlaylistView() { Ip = "", PlaylistId = id, Timestamp = DateTime.Now, Views = 0 }; db.PlaylistViews.Add(views); } else { // Reset view every hour if (views.Timestamp.Date.CompareTo(DateTime.Now.Date) != 0 || views.Timestamp.Hour != DateTime.Now.Hour) { views.Ip = ""; views.Timestamp = DateTime.Now; } } string ip = HttpContext.Current.Request.UserHostAddress.Trim(); // If IP hasn't view yet then increase view of song if (!views.Ip.Contains(ip)) { views.Ip += " " + ip; views.Views++; } db.SaveChanges(); } return(Request.CreateResponse(HttpStatusCode.OK)); } }
public ActionResult PlaylistDetail(int id) { HttpResponseMessage resCate = APIService.client.GetAsync("SubCate").Result; TempData["cate"] = resCate.Content.ReadAsAsync <IEnumerable <CategoryView> >().Result; HttpResponseMessage resSinger = APIService.client.GetAsync("User").Result; TempData["singer"] = resSinger.Content.ReadAsAsync <IEnumerable <UserView> >().Result; HttpResponseMessage res = APIService.client.GetAsync("Playlist/" + id).Result; PlaylistView model = res.Content.ReadAsAsync <PlaylistView>().Result; HttpResponseMessage resMV = APIService.client.GetAsync("Music?idSinger=" + model.UserID + "&music=" + true).Result; TempData["music"] = resMV.Content.ReadAsAsync <IEnumerable <MusicView> >().Result; HttpResponseMessage resPM = APIService.client.GetAsync("PlaylistMusic/" + id).Result; TempData["pm"] = resPM.Content.ReadAsAsync <IEnumerable <PlaylistMusicView> >().Result; return(View(model)); }
void JwSkinPackageSkinPackageReady(object sender, EventArgs e) { ControlBarView.SetSkin(jwSkinPackage); DisplayView.SetSkin(jwSkinPackage); DockView.SetSkin(jwSkinPackage); PlaylistView.SetSkin(jwSkinPackage); var color = ( jwSkinPackage.GetSettingValue("display", "backgroundcolor") ?? jwSkinPackage.GetSettingValue("screencolor") ?? jwSkinPackage.GetSettingValue("backcolor") ?? "0x000000" ).HexToColor(); LayoutRoot.Background = new SolidColorBrush(color); Player.BackgroundColor = color; UpdateCaptionsMargin(); }
static void Main(string[] args) { while (true) { if (AuthenticationService.LoggedUser == null) // the check for null is to prevent stepping into if logged in. You really don't want to touch it (or the ones below). ;) { LoginView loginView = new LoginView(); loginView.Show(); } if (AuthenticationService.LoggedUser != null && AuthenticationService.LoggedUser.IsAdministrator) // the check for null is to prevent stepping into if logged out. { AdminView adminView = new AdminView(); adminView.Show(); } else if (AuthenticationService.LoggedUser != null && AuthenticationService.LoggedUser.IsAdministrator == false) { PlaylistView playlistView = new PlaylistView(); playlistView.Show(); } } }
private void BmpMidiEntryList_DragDrop(object sender, DragEventArgs e) { Point clientPoint = this.PointToClient(new Point(e.X, e.Y)); dropIndex = PlaylistView.HitTest(clientPoint.X, clientPoint.Y).RowIndex; if (dropIndex >= playlistEntries.Count || dropIndex == -1) { dropIndex = playlistEntries.Count - 1; } if (e.Effect == DragDropEffects.Move) { //DataGridViewRow data = e.Data.GetData(typeof(DataGridViewRow)) as DataGridViewRow; var data = e.Data.GetData(typeof(BmpMidiEntry)) as BmpMidiEntry; playlistEntries.RemoveAt(rowIndex); playlistEntries.Insert(dropIndex, new BmpMidiEntry(data.FilePath.FilePath, data.Track.Track)); Select(dropIndex); } playlistBinding = new BindingList <BmpMidiEntry>(playlistEntries); PlaylistView.DataSource = playlistBinding; this.SaveSettings(); }
public ActionResult UpdatePlaylist(PlaylistView p, HttpPostedFileBase imgPlaylist) { HttpResponseMessage resP = APIService.client.GetAsync("Playlist/" + p.ID).Result; PlaylistView model = resP.Content.ReadAsAsync <PlaylistView>().Result; if (imgPlaylist == null) { p.PlaylistImage = model.PlaylistImage; } else { if (model.PlaylistImage != "default.png") { string fullPath = Request.MapPath("~/Resource/ImagesMusic/" + model.PlaylistImage); if (System.IO.File.Exists(fullPath)) { System.IO.File.Delete(fullPath); } } string FileName = DateTime.Now.Ticks + Path.GetFileName(imgPlaylist.FileName); string path = Path.Combine(Server.MapPath("~/Resource/ImagesMusic"), FileName); imgPlaylist.SaveAs(path); p.PlaylistImage = FileName; } HttpResponseMessage res = APIService.client.PutAsJsonAsync("Playlist/" + p.ID, p).Result; if (res.IsSuccessStatusCode) { TempData["success"] = "Update playlist successfully!"; } else { TempData["error"] = "Update playlist failed!"; } return(RedirectToAction("PlaylistDetail", new { id = p.ID })); }
public TabContainer(string header, PlaylistView view, PlaylistViewModel playlistViewModel) { Header = header; View = view; PlaylistViewModel = playlistViewModel; }
public void Deselect() { PlaylistView.ClearSelection(); }
private void PlayList_executed(object sender, ExecutedRoutedEventArgs e) { PlaylistView plv = IVideoElement.PlayListView as PlaylistView; plv.OnPlaylistCloseExecute(this); }
private async void PlaylistList_ItemClick(object sender, ItemClickEventArgs e) { PlaylistSongs.Items.Clear(); const ThumbnailMode thumbnailMode = ThumbnailMode.MusicView; Model.Playlist playlistToShow = (Model.Playlist)e.ClickedItem; var fileToShow = fileList.Where(f => f.Name == playlistToShow.Name).FirstOrDefault(); Playlist playlist = await Playlist.LoadAsync(fileToShow); foreach (var s in playlist.Files) { const uint size = 100; using (StorageItemThumbnail thumbnail = await s.GetThumbnailAsync(thumbnailMode, size)) { // Also verify the type is ThumbnailType.Image (album art) instead of ThumbnailType.Icon // (which may be returned as a fallback if the file does not provide album art) if (thumbnail != null && thumbnail.Type == ThumbnailType.Image) { BitmapImage bitmapImage = new BitmapImage(); bitmapImage.SetSource(thumbnail); Model.MediaFile o1 = new Model.AudioFile(); Image i = new Image(); MusicProperties musicProperties = await s.Properties.GetMusicPropertiesAsync(); i.Source = bitmapImage; o1.Thumb = i; o1.Title = s.Name; if (musicProperties.Title != "") { o1.Title = musicProperties.Title; } o1.Name = s.Name; o1.Path = "MusicLibrary"; PlaylistSongs.Items.Add(o1); } } } PlaylistView.Title = fileToShow.Name.Replace(".wpl", ""); ContentDialogResult contentDialogResult = await PlaylistView.ShowAsync(); if (contentDialogResult == ContentDialogResult.Primary) { playlist.Files.Clear(); StorageFolder sf = KnownFolders.MusicLibrary; NameCollisionOption collisionOption = NameCollisionOption.ReplaceExisting; PlaylistFormat format = PlaylistFormat.WindowsMedia; foreach (Model.MediaFile item in PlaylistSongs.Items) { StorageFile storageFile = await sf.GetFileAsync(item.Name); playlist.Files.Add(storageFile); Debug.WriteLine(item.Name); } StorageFile savedFile = await playlist.SaveAsAsync(sf, fileToShow.Name.Replace(".wpl", ""), collisionOption, format); } else if (contentDialogResult == ContentDialogResult.Secondary) { if (fileToShow != null) { Playlist playlistToPlay = await Playlist.LoadAsync(fileToShow); MediaPlaybackList mediaPlaybackList = new MediaPlaybackList(); foreach (var f in playlist.Files) { mediaPlaybackList.Items.Add(new MediaPlaybackItem(MediaSource.CreateFromStorageFile(f))); } if (mediaPlaybackList.Items.Count != 0) { mediaElement.Source = mediaPlaybackList; mediaElement.MediaPlayer.Play(); } } } }