private void ExecuteDownloadCommand(object obj) { var download = obj as Download; // send onCore to the playback view with the Uri if (download!=null && PlaybackViewModel.Player!=null) { //var info = PlaybackViewModel.Player.GetMediaInformation(download.FilePath); var finder = new AVItemFinder(Presenter.Device); var item = (AVItem)finder.Find(download.Path); AVItem.ReplacePlaybackUri(item, download.FilePath); GoToPage("Global", "Gallery", item); } }
/// <summary> /// Attempts to find a DLNA path and set Presenter's current path value to the /// found path. /// </summary> /// <param name="path">The DLNA path to find and set the Presenter's CurrentPath to.</param> /// <returns>Returns the current path after the routine is completed.</returns> public string GoToPath(string path) { var sw = Utility.Watch(); string result = string.Empty; try { var finder = new AVItemFinder(Presenter.Device); var item = finder.Find(path, true); if (item != null) { GoToPage("Global", "Gallery", item); } } catch (Exception exception) { Tell("Presenter Error: " + exception.Message); } Utility.Logwatch(sw); return result; }
/// <summary> /// Attempts to find a DLNA path and set Presenter's current path value to the /// found path. /// </summary> /// <param name="path">The DLNA path to find and set the Presenter's CurrentPath to.</param> /// <returns>Returns the current path after the routine is completed.</returns> public string GoToPath(string path) { var result = string.Empty; try { //if (Presenter.Device == null) //{ // Tell("Presenter device not initialized."); //} //else if (String.IsNullOrEmpty(path) || path.Equals(Presenter.Device.FriendlyName)) //{ // NavigationCommands.BrowseHome.Execute(null, Presenter); // result = Presenter.Device.FriendlyName; //} //else //{ // GalleryCommands.GoToPathDirect.Execute(path, Presenter); // result = Presenter.CurrentPath; //} var finder = new AVItemFinder(Presenter.Device); var item = finder.Find(path, true); if (item != null) { GoToPage("Global", "Gallery", item); } } catch (Exception exception) { Tell("Presenter Error: " + exception.Message); } return result; }
internal void GoToPathDirect(string path, CancellationToken cancellationToken, bool useAnyDevice = true) { OnGoToPathStarted(new GoToPathStartedEventArgs(path)); var split = new List<string>(path.Split(Path.DirectorySeparatorChar)); // parse the path and create a list of page titles // ensure that the first page is a device if (split.Count < 1) throw new ArgumentException("path must have a Device."); if (useAnyDevice) split[0] = Device.FriendlyName; // ensure that the device is valid if (split[0] != Device.FriendlyName) throw new InvalidOperationException("The device name for this path is different than the current device."); Task.Factory.StartNew(() => { var finder = new AVItemFinder(Device); finder.FindBegin += (o, args) => OnGoToPathStarted(new GoToPathStartedEventArgs(args.Path)); finder.FindProgress += (o, args) => OnGoToPathProgress(new GoToPathProgressEventArgs(args.Id, args.Title, args.ParentDidl, args.Path, args.Step, args.Steps)); var item = finder.Find(path, CancellationToken.None); if (item == null) throw new ArgumentException("Invalid path."); GoToPage(item, cancellationToken); OnGoToPathCompleted(new GoToPathCompletedEventArgs(item)); }, cancellationToken); }