//#region Основные свойства //private IMusicContainer _selectedMusicContainer; //public IMusicContainer SelectedMusicContainer { get => _selectedMusicContainer; set => SetProperty(ref _selectedMusicContainer, value); } //#endregion //#region ListBox Локальных файлов //public ObservableCollection<BaseMusicObject> LocalFiles { get; set; } //private BaseMusicObject _selectedBMO; //public BaseMusicObject SelectedBMO //{ // get => _selectedBMO; // set // { // if (value is Song) // { // _selectedBMO = value; // SelectedSong = value.ToSong(); // } // else // { // _selectedBMO = value; // SelectedMusicContainer = value.ToMC(); // Navigation.PushAsync(new ListSongsV() { BindingContext = new ListSongsVM(this.SelectedMusicContainer) { model = this.model } }); // } // } //} //private List<Song> GetLocalFilesAsMC() => (from temp in LocalFiles where temp is Song select temp) as List<Song>; //#endregion //#region События //public override void Model_PropertyChanged(object sender, PropertyChangedEventArgs e) //{ // base.Model_PropertyChanged(sender, e); // if (!string.IsNullOrEmpty(e.PropertyName)) // { // switch (e.PropertyName) // { // case "UpdateInfoFromPC": // foreach (var item in model.LocalFiles) // { // try // { // LocalFiles.Add(item); // } // catch (Exception) // { // } // } // break; // } // } //} //#endregion #region Конструкторы и методы инициализации public MusicPlayerVM() { model = new MusicPlayerM(); model.PropertyChanged += Model_PropertyChanged; //LocalFiles = new ObservableCollection<BaseMusicObject>(model.GetListLocalFiles()); //Songs = new ObservableCollection<Song>(); }
public PlayerPage(MusicPlayerM model) { InitializeComponent(); BindingContext = new PlayerPageVM(model); }