Ejemplo n.º 1
0
        //-------------------------------------------------------------------------------------------------------------------
        public Fb2PlayerViewModel()
        {
            Traks = new ObservableCollection <TrackInfoViewModel>();
            if (File.Exists(PlayerDataFileName))
            {
                List <TrackInfo> data = Read();
                Traks = TrackInfoViewModel.CreateTrackInfoViewModel(data);
            }
            InstalledVoices = new ObservableCollection <InstalledVoice>();
            foreach (var iv in synthesizer.GetInstalledVoices())
            {
                InstalledVoices.Add(iv);
            }
            if (InstalledVoices.Count > 0)
            {
                SelectedInstalledVoice = InstalledVoices[0];
            }

            PropertyChanged += Settings_PropertyChanged;

            //PropertyChanged += PlayerViewModel_PropertyChanged;
            //MediaData.CurrentTrackChanged += MediaData_CurrentTrackChanged;
            //MediaData.CurrentListChanged += MediaDataOnCurrentListChanged;

            //if (MediaData.CurrentList != null)
            //{
            //    //                SelectedIndex = 0;
            //    MediaData.SyncCurrentPlayTrack();
            //    OnMainGridScrollIntoView(MediaData.CurrentList.SelectedTrack);
            //}
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------------------------------------------------
        public void Save()
        {
            List <TrackInfo> data      = TrackInfoViewModel.CreateTrackInfo(traks);
            IFormatter       formatter = new BinaryFormatter();
            Stream           stream    = new FileStream(PlayerDataFileName, FileMode.Create, FileAccess.Write, FileShare.None);

            formatter.Serialize(stream, data);
            stream.Close();
        }