예제 #1
0
        /// <summary>
        /// Just Load A Media
        /// </summary>
        private void                            LoadMedia(string Path)
        {
            if (File.Exists(Path))
            {
                CMD_Stop_Executed(null);
                Video.Media.Source = new Uri(Path);
                Video.Media.Play();

                IsPlaying = true;
                IsLoaded  = true;
                NotifyPropertyChanged("VideoName");
                NotifyPropertyChanged("PlaylistPos");
                NotifyPropertyChanged("BtnPlayPauseImg");
                CMD_PlayPause.RaiseCanExecuteChanged();
                CMD_Stop.RaiseCanExecuteChanged();
                CMD_FullScreen.RaiseCanExecuteChanged();
                CMD_Prev.RaiseCanExecuteChanged();
                CMD_Next.RaiseCanExecuteChanged();
                CMD_SavePlayList.RaiseCanExecuteChanged();
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Unable To Load " + Path, "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
            }
        }
예제 #2
0
        /// <summary>
        /// Remove From a List
        /// </summary>
        public void                             CMD_DeleteIndex_Executed(ListView Arg)
        {
            if (Arg != null)
            {
                if (Arg.Name == "PlayList")
                {
                    bool              NeedToNext = false;
                    int               Tmp2       = PlaylistPos;
                    Model.Film        Tmp        = Playlist.GetCurrent();
                    List <Model.Film> DelList    = new List <Model.Film>();

                    foreach (var F in Arg.SelectedItems)
                    {
                        DelList.Add(F as Model.Film);
                    }
                    foreach (var F in DelList)
                    {
                        if (Tmp == F)
                        {
                            NeedToNext = true;
                        }
                        Playlist.Remove(F as Model.Film);
                    }
                    if (NeedToNext)
                    {
                        CMD_Stop_Executed(null);
                        if (Playlist.Films.Count > 0)
                        {
                            LoadMedia(Playlist.GetIndex(Tmp2).Path);
                        }
                    }
                    if (Playlist.Films.Count == 0)
                    {
                        IsLoaded = false;
                        CMD_PlayPause.RaiseCanExecuteChanged();
                        CMD_Stop.RaiseCanExecuteChanged();
                        CMD_FullScreen.RaiseCanExecuteChanged();
                        CMD_Prev.RaiseCanExecuteChanged();
                        CMD_Next.RaiseCanExecuteChanged();
                        NotifyPropertyChanged("IsLoaded");
                    }
                    NotifyPropertyChanged("PlaylistPos");
                    CMD_SavePlayList.RaiseCanExecuteChanged();
                }
                else
                {
                    List <Model.Film> DelList = new List <Model.Film>();
                    foreach (var F in Arg.SelectedItems)
                    {
                        DelList.Add(F as Model.Film);
                    }
                    foreach (var F in DelList)
                    {
                        Library.Remove(F as Model.Film);
                    }
                }
            }
        }