diff --git a/MediaPlayerWindow/MediaPlayerModels/PlayListClass.cs b/MediaPlayerWindow/MediaPlayerModels/PlayListClass.cs index ca11db8..9f9a6a3 100644 --- a/MediaPlayerWindow/MediaPlayerModels/PlayListClass.cs +++ b/MediaPlayerWindow/MediaPlayerModels/PlayListClass.cs @@ -4,13 +4,15 @@ using System.Text; using System.Threading.Tasks; using System.Runtime.Serialization; + namespace MediaPlayerModels -{ +{ [DataContract] public class PlayListClass { [DataMember] public string FileName { get; set; } + [DataMember] public string Filepath { get; set; } } diff --git a/MediaPlayerWindow/MediaPlayerModels/PlayListDirectory.cs b/MediaPlayerWindow/MediaPlayerModels/PlayListDirectory.cs index b36dc7d..f017023 100644 --- a/MediaPlayerWindow/MediaPlayerModels/PlayListDirectory.cs +++ b/MediaPlayerWindow/MediaPlayerModels/PlayListDirectory.cs @@ -9,10 +9,10 @@ namespace MediaPlayerModels { [DataContract] - public class PlayListDirectory + public class PlayListDirectory { - - private List playListCollection=new List(); + private List playListCollection = new List(); + [DataMember] public List PlayListCollection { diff --git a/MediaPlayerWindow/MediaPlayerViewModel/MediaPlayerMainWindowViewModel.cs b/MediaPlayerWindow/MediaPlayerViewModel/MediaPlayerMainWindowViewModel.cs index 5f96f7e..7140608 100644 --- a/MediaPlayerWindow/MediaPlayerViewModel/MediaPlayerMainWindowViewModel.cs +++ b/MediaPlayerWindow/MediaPlayerViewModel/MediaPlayerMainWindowViewModel.cs @@ -19,6 +19,7 @@ using System.Windows.Input; using Button = System.Windows.Controls.Button; using System.Runtime.Serialization; + namespace MediaPlayerViewModel { public class MediaPlayerMainWindowViewModel:INotifyPropertyChanged @@ -74,10 +75,11 @@ public ObservableCollection> AlbumsViewCollection public bool PlayRequested { get { return _playRequested; } - set { _playRequested = value; OnPropertyChanged("PlayRequested"); - + set + { + _playRequested = value; + OnPropertyChanged("PlayRequested"); } - } public bool MediaOpened @@ -93,17 +95,13 @@ public Uri MediaSource set { _mediaSource = value; - OnPropertyChanged("MediaSource"); - } } - public ICommand OpenFileCommand { get { return new DelegateCommand(OpenFileMethod, IsValid); } - } public ICommand ShowHidePlayListCommand @@ -288,7 +286,6 @@ protected virtual void OnMoveBackwardRequested() #region Methods private void OpenFileMethod(object obj) { - System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog(); dialog.Filter = "Audio Files (*.mp3,*.m4a,*.wav,*.aac)|*.mp3|Video Files(*.mp4,*.wmv,*.3gp,*.mkv)|*.mp4|All Files(*.*)|*.*"; @@ -308,10 +305,7 @@ private void OpenFileMethod(object obj) { } - - } - } private void VolumeUpMethod(object o) @@ -323,6 +317,7 @@ private void FullScreenMethod(object o) { OnFullScreeEvent(); } + private void VolumeDownMethod(Object o) { OnVolumeDownEvent(); @@ -332,14 +327,17 @@ private void SpeedRatioUpMethod(object o) { OnSpeedRatioUpEvent(); } + private void SpeedRatioDownMethod(object o) { OnSpeedRatioDownEvent(); } + private void MediaOpenedMethod(Object obj) { MediaOpened = true; } + private void SavePlaylist(Object obj) { @@ -354,7 +352,6 @@ private void SavePlaylist(Object obj) { PlayListDirectory playListDirectory=new PlayListDirectory(); - List _mediaList = new List(); foreach (Uri file in PlayListViewCollection ) { @@ -362,8 +359,8 @@ private void SavePlaylist(Object obj) temp.FileName = file.ToString(); temp.Filepath = playlistLookupDictionary[file.ToString()].ToString(); _mediaList.Add(temp); - } + playListDirectory.PlayListCollection = _mediaList; _xmlSerializer.Serialize(_textWriter, playListDirectory); } @@ -399,14 +396,7 @@ private void OpenPlayList(Object obj) } } - - - - - - } - } private void ChangeBackground(Object obj) @@ -446,14 +436,12 @@ private void ShowHidePlayListMethod(Object obj) } } - private void StopMediaFileMethod(Object Obj) { OnStopRequested(); playValue = !playValue; } - private void MoveForwardMediaFileMethod(Object Obj) { OnMoveForwardRequested(); @@ -490,14 +478,12 @@ private void PlayListMethod(Object obj) { } - } } } private void PlayMediaFileMethod(Object obj) { - ToggleButton PlayFileButtonObj = obj as ToggleButton; if (obj == null) { @@ -511,8 +497,6 @@ private void PlayMediaFileMethod(Object obj) OnPauseRequested(); playValue = true; } - - } else { @@ -521,13 +505,10 @@ private void PlayMediaFileMethod(Object obj) if (PlayFileButtonObj.IsChecked.Value) { OnPlayValueRequested(); - - } else { OnPauseRequested(); - } } } @@ -554,7 +535,6 @@ private void AlbumsCreateMethod() } } - private bool IsValid() { // if (obj == null) throw new ArgumentNullException("obj"); @@ -562,9 +542,5 @@ private bool IsValid() } #endregion - - - - } }