private static void GetMediaInfo(VideoFolderChild vd) { ShellObject shell = ShellObject.FromParsingName(vd.FilePath); try { vd.Thumbnail = shell.Thumbnail.LargeBitmapSource; if (string.IsNullOrEmpty(vd.Duration) || vd.Duration == ApplicationDummyMessage.DurationNotYetLoaded) { var duration = shell.Properties.System.Media.Duration; vd.Duration = duration.FormatForDisplay(PropertyDescriptionFormat.ShortTime); } //if (duration.Value != null) // vd.MaxiProgress = (int)(duration.Value / Math.Pow(10, 7)); } catch (Exception ex) { } var prop = shell.Properties.System.Title.Value; if (!string.IsNullOrEmpty(prop) && !prop.Contains("\"")) { vd.MediaTitle = prop; } }
public static ObservableCollection <VideoFolder> LoadChildrenFiles(IFolder Parentdir, bool newpath = false) { ObservableCollection <VideoFolder> Toparent = new ObservableCollection <VideoFolder>(); List <FileInfo> files = FileExplorerCommonHelper.GetFilesByExtensions(Parentdir.Directory, formats); if (files.Count > 0) { ApplicationService.CreateLastSeenFolder(Parentdir); ApplicationService.LoadLastSeenFile(Parentdir); } for (int i = 0; i < files.Count; i++) { VideoFolderChild vd; PlayedFiles pdf = (PlayedFiles)LastSeenHelper.GetProgress(Parentdir, files[i].Name); vd = new VideoFolderChild(Parentdir, files[i]) { FileSize = FileExplorerCommonHelper.FileSizeConverter(files[i].Length), FileType = FileType.File }; if (pdf != null) { vd.LastPlayedPoisition = pdf; } else { vd.LastPlayedPoisition = new PlayedFiles(files[i].Name); } Toparent.Add(vd); } return(Toparent); }
public void CloseMediaPlayer() { //(IVideoElement as Window).Dispatcher.Invoke(new Action(() => //{ //IVideoPlayer.MediaPlayer.Close(); //IsClosing = true; //HasSubcribed = false; //CreateHelper.SaveLastSeenFile(CurrentVideoItem.ParentDirectory.Directory); //currentvideoitem = null; //Current = null; MediaPlayStopAction(); MediaPositionTimer.Stop(); HasSubcribed = false; if (CurrentVideoItem != null) { ApplicationService.SaveLastSeenFile(CurrentVideoItem.ParentDirectory); } currentvideoitem = null; Current = null; if (Playlist.CurrentPlaylist != null) { Playlist.CurrentPlaylist.SetIsActive(false); } //}), null); }
private string GetMediaTitle(VideoFolderChild vd) { ShellObject shell = ShellObject.FromParsingName(vd.FilePath); try { var duration = shell.Properties.System.Media.Duration; vd.Duration = duration.FormatForDisplay(PropertyDescriptionFormat.ShortTime); //if (duration.Value != null) // vd.MaxiProgress = (int)(duration.Value / Math.Pow(10, 7)); } catch (Exception ex) { } //MediaInfo.MediaInfoWrapper mediaInfoWrapper = new MediaInfo.MediaInfoWrapper(vd.FullName); //string result = null; //if (mediaInfoWrapper.HasVideo) //{ // //Dispatcher.Invoke(new Action(() => { // // mediaInfoWrapper.Open(vd.FullName); // //result = mediaInfoWrapper.Get(MediaInfo.StreamKind.General, 0, 167); // result = (mediaInfoWrapper.Tags as AudioTags).Title; // vd.MaxiProgress = mediaInfoWrapper.Duration; // vd.Duration = mediaInfoWrapper.BestVideoStream.Duration.ToString(); //} //mediaInfoWrapper.Close(); //}),DispatcherPriority.Background); return(shell.Properties.System.Title.Value); }
private void NewPlaylist_executed(object sender, ExecutedRoutedEventArgs e) { VideoFolderChild vfc = (VideoFolderChild)e.Parameter; ((IShell.FileView.TreeViewer as ITreeViewer).MoviesPLaylist as PlaylistTree) .CreateNewPlayList(vfc.Directory.FullName); }
private void RemovefromPlayList_executed(object sender, ExecutedRoutedEventArgs e) { VideoFolderChild vfc = (VideoFolderChild)e.Parameter; if (vfc != null) { FilePlayerManager.PlaylistManagerViewModel.Remove(vfc); } }
private void Play_executed(object sender, ExecutedRoutedEventArgs e) { VideoFolderChild vfc = (VideoFolderChild)e.Parameter; if (vfc != null) { MediaControllerVM.Current.GetVideoItem(vfc, true); } }
private void WMPPlay_executed(object sender, ExecutedRoutedEventArgs e) { VideoFolderChild vfc = (VideoFolderChild)e.Parameter; if (vfc != null) { IPlayFile.WMPPlayFileInit(vfc); } }
private void RemoveFromLS_executed(object sender, ExecutedRoutedEventArgs e) { VideoFolderChild vfc = (VideoFolderChild)e.Parameter; IFolder folder = vfc.ParentDirectory; vfc.Progress = 0; ApplicationService.SavedLastSeenCollection.Remove((PlayedFiles)vfc.LastPlayedPoisition); vfc.LastPlayedPoisition = new PlayedFiles(vfc.FileName); }
private void Play_executed(object sender, ExecutedRoutedEventArgs e) { VideoFolderChild vfc = (VideoFolderChild)e.Parameter; if (vfc != null) { FilePlayerManager.MediaControllerViewModel.GetVideoItem(vfc, true); } }
private void Previous() { SavePlayed(); if (playListManager.CanPrevious) { CurrentVideoItem = playListManager.GetPreviousItem(); axWindowsMediaPlayer1.URL = (CurrentVideoItem.Directory.FullName); } }
private void RemoveFromLS_executed(object sender, ExecutedRoutedEventArgs e) { VideoFolderChild vfc = (VideoFolderChild)e.Parameter; IFolder folder = vfc.ParentDirectory; vfc.Progress = 0; LastSeenHelper.RemoveLastSeen(folder, vfc.LastPlayedPoisition); vfc.LastPlayedPoisition = new PlayedFiles(vfc.FileName); }
private void Next() { SavePlayed(); if (playListManager.CanNext) { CurrentVideoItem = playListManager.GetNextItem(); axWindowsMediaPlayer1.URL = (CurrentVideoItem.Directory.FullName); } }
private void AddtoPlayList_executed(object sender, ExecutedRoutedEventArgs e) { VideoFolderChild vfc = (VideoFolderChild)e.Parameter; if (vfc != null) { IPlayFile.AddFiletoPlayList(vfc); } }
private void RemovefromPlayList_executed(object sender, ExecutedRoutedEventArgs e) { VideoFolderChild vfc = (VideoFolderChild)e.Parameter; if (vfc != null) { MediaControllerVM.Current.Playlist.Remove(vfc); } }
private void RunShellFunction(VideoFolderChild vd) { string prop = null; prop = GetMediaTitle(vd); if (!string.IsNullOrEmpty(prop) && !prop.Contains("\"")) { vd.MediaTitle = prop; } }
public void AddFiletoPlayList(object obj) { InitPlayerView(); MediaControlExtension.SetFileexpVisiblity(VideoElement.PlayListView as UIElement, Visibility.Visible); VideoFolderChild vfc = (VideoFolderChild)obj; MediaControllerVM.Current.Playlist.Add(vfc); }
public void GetVideoItem(VideoFolderChild obj, bool frompl = false) { if (!MediaPlayerService.HasStopped) { MediaPlayerService.Stop(); } FilePlayerManager.VideoElement.ContentDockRegion.Content = null; NewVideoAction(obj, frompl); }
private VideoFolderChild GetItem_for_Repeat() { VideoFolderChild item = null; IsfetchingRepeatItemAsync = true; (IVideoElement as Window).Dispatcher.Invoke(new Action(() => { item = this.AsynSearchForNextItem(); })); return(item); }
public VideoFolderChild CreateVideoFolderChild(IFolder Parentdir, FileInfo fileInfo) { VideoFolderChild vfc = new VideoFolderChild(Parentdir, fileInfo) { FileSize = filecommonhelper.FileSizeConverter(fileInfo.Length), FileType = FileType.File }; vfc.OnFileNameChangedChanged += ParentDir_OnFileNameChangedChanged; SetLastSeen(vfc); return(vfc); }
private void GetThumbnail(VideoFolderChild file) { ImageSource imageSource = null; dispatcherService.InvokeDispatchAction(new Action(delegate { file.IsLoading = true; ShellObject shell = ShellObject.FromParsingName(file.FullName); file.Thumbnail = imageSource = shell.Thumbnail.LargeBitmapSource; shell.Dispose(); file.IsLoading = false; })); }
public void SetLastSeen(VideoFolderChild videoFolderChild) { PlayedFiles pdf = applicationService.SavedLastSeenCollection.GetLastSeen(videoFolderChild.FileInfo.Name) as PlayedFiles; if (pdf != null) { videoFolderChild.LastPlayedPoisition = pdf; } else { videoFolderChild.LastPlayedPoisition = new PlayedFiles(videoFolderChild.FileInfo.Name); } }
internal void OpenFile(VideoFolderChild obj) { if (CurrentVideoItem == null) { CurrentVideoItem = obj; } else if (CurrentVideoItem == obj) { return; } axWindowsMediaPlayer1.URL = obj.Directory.FullName; if (obj.HasLastSeen) { resumeposition = obj.LastPlayedPoisition.ProgressLastSeen; } axWindowsMediaPlayer1.Ctlcontrols.play(); }
//public void PlayIndexChanged(ref VideoFolderChild obj) //{ // this.NowPlaying = obj; //} public void UpdateNowPlaying(object obj, bool frompl) { if (NowPlaying == null && !frompl || !this.PlayList.Contains(obj)) { if (CurrentPlaylist != null && HasChanges) { SavePlaylistAction(); } CurrentPlaylist = null; this.NowPlaying = (VideoFolderChild)obj; VideoFolder parent = (VideoFolder)NowPlaying.ParentDirectory; PlayList = new ObservableCollection <VideoFolder>(); _playlist.AddRange(parent.OtherFiles.Where(x => x.FileType == FileType.File).ToList()); } else { this.NowPlaying = (VideoFolderChild)obj; } }
public ObservableCollection <VideoFolder> LoadChildrenFiles(VideoFolder Parentdir, IList <FileInfo> files, bool newpath = false) { ObservableCollection <VideoFolder> Toparent = new ObservableCollection <VideoFolder>(); for (int i = 0; i < files.Count; i++) { if (files[i] == null) { continue; } VideoFolderChild vd = CreateVideoFolderChild(Parentdir, files[i]); if (vd != null) { Toparent.Add(vd); } } return(Toparent); }
private void NewVideoAction(VideoFolderChild obj, bool frompl = false) { if (obj == null) { return; } if (CurrentVideoItem != null) { if (obj.FileName == CurrentVideoItem.FileName) { return; } if (!obj.ParentDirectory.Directory.FullName.Equals(CurrentVideoItem. ParentDirectory.Directory.FullName)) { IsDirectoryChanged = true; } } MediaState = MediaState.Stopped; if (obj.SubPath.Count > 0) { IVideoPlayer.Subtitle.LoadSub(obj.SubPath.First()); } else { IVideoPlayer.Subtitle.Clear(); //CSubtitle.ClearSubstitute(); OutlineTextSub.Visibility = //System.Windows.Visibility.Collapsed; } this.currentvideoitem = obj; CurrentVideoItemChangedEvent(currentvideoitem, frompl); IVideoElement.MediaPlayer.Source = new Uri(obj.FilePath); PlayAction(); RaiseCanPrevNext(); }
private void NewVideoAction(VideoFolderChild obj, bool frompl = false) { (IVideoElement as Window).Dispatcher.BeginInvoke(new Action(() => { if (obj == null) { return; } if (CurrentVideoItem != null) { if (this.RepeatMode == RepeatMode.RepeatOnce) { if (this.IsPlaying) { this.MediaPlayerService.CurrentTimer = TimeSpan.FromMilliseconds(0); return; } PlayAction(); return; } if (obj.FileName == CurrentVideoItem.FileName) { return; } if (!obj.ParentDirectory.Directory.FullName.Equals(CurrentVideoItem. ParentDirectory.Directory.FullName)) { IsDirectoryChanged = true; } } MediaPlayerStop(); this.currentvideoitem = obj; CurrentVideoItemChangedEvent(currentvideoitem, frompl); IVideoElement.Title = (obj.FileName); MediaPlayerService.LoadMedia(obj.FilePath, MediaPlayerService.VlcOption); PlayAction(true); CommandManager.InvalidateRequerySuggested(); }), DispatcherPriority.ContextIdle, null); }
public ObservableCollection <VideoFolder> LoadChildrenFiles(VideoFolder Parentdir, bool newpath = false) { ObservableCollection <VideoFolder> Toparent = new ObservableCollection <VideoFolder>(); List <Task> Tasks = new List <Task>(); List <FileInfo> files = filecommonhelper.GetFilesByExtensions(Parentdir.Directory, applicationService.Formats); for (int i = 0; i < files.Count; i++) { if (files[i] == null) { continue; } VideoFolderChild vd = CreateVideoFolderChild(Parentdir, files[i]); if (vd != null) { Toparent.Add(vd); } } return(Toparent); }
public static VideoFolder LoadChildrenFiles(DirectoryInfo directoryInfo, bool newpath = false) { IFolder Parentdir = new VideoFolder(directoryInfo.Parent.FullName); ApplicationService.CreateLastSeenFolder(Parentdir); ApplicationService.LoadLastSeenFile(Parentdir); FileInfo fileInfo = new FileInfo(directoryInfo.FullName); VideoFolderChild vd; PlayedFiles pdf = (PlayedFiles)LastSeenHelper.GetProgress(Parentdir, fileInfo.Name); vd = new VideoFolderChild(Parentdir, fileInfo) { FileSize = FileExplorerCommonHelper.FileSizeConverter(fileInfo.Length), FileType = FileType.File }; if (pdf != null) { vd.LastPlayedPoisition = pdf; } else { vd.LastPlayedPoisition = new PlayedFiles(fileInfo.Name); } IEnumerable <FileInfo> files = null; using (ShellObject shell = ShellObject.FromParsingName(vd.FilePath)) { IShellProperty prop = shell.Properties.System.Media.Duration; vd.Duration = prop.FormatForDisplay(PropertyDescriptionFormat.ShortTime); var duration = shell.Properties.System.Media.Duration; if (duration.Value != null) { vd.MaxiProgress = double.Parse(duration.Value.ToString()); } files = FileExplorerCommonHelper.GetSubtitleFiles(directoryInfo.Parent); } vd.SubPath = FileExplorerCommonHelper.MatchSubToMedia(vd.Name, files); return(vd); }
public VideoFolder LoadChildrenFiles(DirectoryInfo directoryInfo, bool newpath = false) { VideoFolder vf = null; MovieDataSource.DataSource.TryGetValue(directoryInfo.FullName, out vf); if (vf == null) { VideoFolder Parentdir = new VideoFolder(directoryInfo.Parent.FullName); FileInfo fileInfo = new FileInfo(directoryInfo.FullName); VideoFolderChild vfc = CreateVideoFolderChild(Parentdir, fileInfo); #region Search For Subtitle //IEnumerable<FileInfo> files = null; //files = filecommonhelper.GetSubtitleFiles(directoryInfo.Parent); //vfc.SubPath = filecommonhelper.MatchSubToMedia(vfc.Name, files); //RunShellFunction(vfc); #endregion return(vfc); } return(vf); }