public CS_PlayListsModel getPlayListsModel() { if (_playlistsModel == null) { Hyena.Log.Information("Playlist model init"); CS_PlayListCollection col = new CS_PlayListCollection(this._track_info_db, this.getSheets()); _playlistsModel = new CS_PlayListsModel(col); } return(_playlistsModel); }
public CS_PlayListAdmin(CS_PlayListsView plsview, CS_PlayListsModel mdl, CS_PlayListCollection cl) { _col = cl; _model = mdl; Gtk.HBox hb = new Gtk.HBox(); Gtk.Button _add = new Gtk.Button(Gtk.Stock.Add); _add.Clicked += delegate(object sender, EventArgs args) { OnAddPls(); }; Gtk.Button _remove = new Gtk.Button(Gtk.Stock.Remove); _remove.Clicked += delegate(object sender, EventArgs args) { OnRemovePls(); }; hb.PackStart(_add); hb.PackStart(_remove); plsscroll = new Gtk.ScrolledWindow(); plsscroll.Add(plsview); _pls = null; _pls_name = new Gtk.Entry(); _pls_model = new CS_PlayListModel(); _pls_view = new CS_PlayListView(); _pls_view.SetModel(_pls_model); plscroll = new Gtk.ScrolledWindow(); plscroll.Add(_pls_view); _pls_view.DragEnd += delegate(object sender, DragEndArgs args) { Console.WriteLine(args); }; Gtk.VBox plsvbox = new Gtk.VBox(); plsvbox.PackStart(_pls_name, false, false, 2); plsvbox.PackEnd(plscroll); Gtk.VPaned vpn = new Gtk.VPaned(); vpn.Add1(plsscroll); vpn.Add2(plsvbox); base.PackStart(hb, false, false, 2); base.PackEnd(vpn); base.ShowAll(); mdl.SetListener(delegate(CS_PlayList pls) { _pls = pls; _pls_model.SetPlayList(_pls); _pls_name.Text = _pls.PlsName; }); }
public CS_PlayListsModel(CS_PlayListCollection pls) { _pla = pls; Selection = new Hyena.Collections.Selection(); Selection.Changed += delegate(object sender, EventArgs args) { try { int index = ((Selection)sender).FirstIndex; if (index >= 0) { CS_PlayList pl = (CS_PlayList)this[index]; Hyena.Log.Information("playlist=" + pl); OnPlayListSelect(pl); } } catch (System.Exception ex) { Hyena.Log.Error(ex.ToString()); } }; }