private void SavePlaylist(object sender, MouseButtonEventArgs e) { if (string.IsNullOrEmpty(this.UIFullnameEdit.Text)) { MessageBox.Show("Tên playlist không được để trống!"); return; } Code.Playlist.Playlist tmp = new Code.Playlist.Playlist(); tmp.Name = this.UIFullnameEdit.Text; tmp.Comment = this.UICommentEdit.Text; tmp.user_id = App.curUser.ID; int retult = -1; if (this._playlist == null) { retult = Code.Playlist.Playlist.Insert(tmp); } else { tmp.ID = this._playlist.ID; retult = tmp.save(); } if (retult == 1) { if (this.CloseEvent != null) { this.CloseEvent(this, tmp); } } else { MessageBox.Show("Lỗi không thể thêm Playlist"); } }
private void LoadUI(Code.Playlist.Playlist playlist) { this.StackMedia.Children.Clear(); if (playlist != null) { this.UITitle.Text = playlist.Name; List <MediaEvent> Medias = playlist.LoadMediaEvent(); if (Medias != null) { foreach (MediaEvent e in Medias) { UIMediaEvent UIE = new UIMediaEvent(); UIE.Height = 50; UIE.Width = 395; UIE.Event = e; UIE.DeleteEvent += UIE_DeleteEvent; UIE.ViewMediaEvent += UIE_ViewMediaEvent; this.StackMedia.Children.Add(UIE); } } } else { this.UITitle.Text = string.Empty; } }
private void Item_ChangeDefaultEvent(object sender, Code.Playlist.Playlist e) { if (e != null && e.Default) { this.Datas = App.curUser.LoadPlaylist(from, to, out totalUser); LoadGUI(); } }
private void UIPlaylist_UnLinkScheduleEvent(object sender, Code.Playlist.Playlist e) { if (App.curUser.ID == this.Event.user_id && this.Event.playlist_id != 0) { this.Event.setPlaylist(0); this.Playlist = this.Event.Playlist; this.showPlaylist(); } }
void item_ViewMediaEvent(object sender, Code.Playlist.Playlist e) { if (e != null) { Playlist_Media view = new Playlist_Media(); view.Width = 1366; view.Height = 668; view.Playlist = e; view.setLeft(0); view.setTop(0); view.CloseEvent += view_CloseEvent; this.UIRoot.Children.Add(view); } }
public void LoadUI(Code.Playlist.Playlist p) { if (p == null) { this.UICommentEdit.empty(); this.UIName.Text = "Thêm Playlist"; this.UIFullnameEdit.empty(); } else { this.UIFullnameEdit.Text = p.Name; this.UICommentEdit.Text = p.Comment; this.UIName.Text = "Chỉnh sửa Playlist"; } }
private void Item_ViewInfoPlaylistEvent(object sender, Code.Playlist.Playlist e) { if (e != null) { PlaylistEdit item = new PlaylistEdit(); item.setLeft(0); item.setTop(90); item.Width = 1366; item.Height = 578; item.Playlist = e; item.CloseEvent += Form_CloseEvent; item.DeletePlaylistEvent += Item_DeleteUserEvent1; this.UIRoot.Children.Add(item); } }
private void Item_DeletePlaylistEvent(object sender, Code.Playlist.Playlist e) { if (e != null) { UI.UIPlaylist uiU = this.list_Box_Item.SelectedItem as UI.UIPlaylist; this.list_Box_Item.SelectedIndex = -1; uiU.Animation_Opacity_View_Frame(false, () => { this.list_Box_Item.Items.Remove(uiU); this.Datas.Remove(uiU.Playlist); if (this.to < this.totalUser) { this.Datas = App.curUser.LoadPlaylist(from, to, out totalUser); LoadGUI(); } }); } }
private void Form_CloseEvent(object sender, Code.Playlist.Playlist e) { PlaylistEdit form = sender as PlaylistEdit; if (e != null) { bool isEditUser = false; foreach (UI.UIPlaylist item in this.list_Box_Item.Items) { if (item.Playlist.ID == e.ID) { item.Playlist = e; isEditUser = true; break; } } if (!isEditUser) { this.Datas = App.curUser.LoadPlaylist(this.from, this.to, out this.totalUser); LoadGUI(); } } this.UIRoot.Children.Remove(form); }
private void SavePlaylist(object sender, MouseButtonEventArgs e) { if (string.IsNullOrEmpty(this.UIFullnameEdit.Text)) { MessageBox.Show("Tên playlist không được để trống!"); return; } Code.Playlist.Playlist tmp = new Code.Playlist.Playlist(); tmp.Name = this.UIFullnameEdit.Text; tmp.Comment = this.UICommentEdit.Text; tmp.user_id = App.curUser.ID; int retult = -1; if (this._playlist == null) { retult= Code.Playlist.Playlist.Insert(tmp); } else { tmp.ID = this._playlist.ID; retult= tmp.save(); } if (retult == 1) { if (this.CloseEvent != null) { this.CloseEvent(this, tmp); } } else { MessageBox.Show("Lỗi không thể thêm Playlist"); } }