public Item Create(BaseItem baseItem) { Item item = null; foreach (IsOne isOne in itemFactoryItems.Keys) { if (isOne(baseItem)) { item = (Item)Activator.CreateInstance(itemFactoryItems[isOne]); } } if (item == null) { if (baseItem is User) { item = new UserItem(); } else if (baseItem is Folder) { item = new FolderModel(); } else { item = new Item(); } } item.Assign(baseItem); return(item); }
public Item Create(BaseItem baseItem) { Item item = null; foreach (IsOne isOne in itemFactoryItems.Keys) if (isOne(baseItem)) item = (Item)Activator.CreateInstance(itemFactoryItems[isOne]); if (item == null) if (baseItem is UpcomingTvFolder) { item = new UpcomingTvFolderModel(); } else if (baseItem is User) { item = new UserItem(); } else if (baseItem is Folder) { item = new FolderModel(); } else { item = new Item(); } item.Assign(baseItem); return item; }
public Item Create(BaseItem baseItem) { Item item; if (baseItem is Folder) { item = new FolderModel(); } else { item = new Item(); } item.Assign(baseItem); return item; }
private bool addProtectedFolder(FolderModel folder) { if (folder != null) { enteredProtectedFolders.Add(folder.Folder); return(true); } else { return(false); } }
public Item Create(BaseItem baseItem) { Item item; if (baseItem is Folder) { item = new FolderModel(); } else { item = new Item(); } item.Assign(baseItem); return(item); }
public void NavigateProtected(FolderModel folder) { //save parameters where we can get at them after pin entry this.anItem = folder; //now present pin screen - it will call our callback after finished pinCallback = NavPinEntered; if (folder.BaseItem.CustomPIN != "" && folder.BaseItem.CustomPIN != null) { customPIN = folder.BaseItem.CustomPIN; // use custom pin for this item } else { customPIN = Config.Instance.ParentalPIN; // use global pin } Logger.ReportInfo("Request to open protected content " + folder.Name); PromptForPin(pinCallback, Application.CurrentInstance.StringData("EnterPINToViewDial")); }
public void Navigate(Item item) { if (item.BaseItem is Person) { NavigateToActor(item); return; } if (item.BaseItem is Movie) { if (item.HasDataForDetailPage) { // go to details screen Dictionary <string, object> properties = new Dictionary <string, object>(); properties["Application"] = this; properties["Item"] = item; session.GoToPage("resx://MediaBrowser/MediaBrowser.Resources/MovieDetailsPage", properties); return; } } MediaBrowser.Library.FolderModel folder = item as MediaBrowser.Library.FolderModel; if (folder != null) { if (!Config.Instance.RememberIndexing) { folder.DisplayPrefs.IndexBy = IndexType.None; } if (Config.Instance.AutoEnterSingleDirs && (folder.Children.Count == 1)) { Navigate(folder.Children[0]); } else { OpenFolderPage(folder); } } else { item.Resume(); } }
public DirectorItemWrapper(string director, FolderModel parent) { this.Director = director; this.parent = parent; }
public void OpenFolderPage(FolderModel folder) { var properties = new Dictionary<string, object>(); properties["Application"] = this; properties["Folder"] = folder; properties["ThemeConfig"] = CurrentTheme.Config; CurrentFolder = folder; //store our current folder CurrentItem = null; //blank this out in case it was messed with in the last screen if (folder.IsRoot) RootFolderModel = folder; //store the root as well if (session != null) { folder.NavigatingInto(); session.GoToPage(folder.Folder.CustomUI ?? CurrentTheme.FolderPage, properties); } else { Logger.ReportError("Session is null in OpenPage"); } }
public void NavigateSecure(FolderModel folder) { //just call method on parentalControls - it will callback if secure Kernel.Instance.ParentalControls.NavigateProtected(folder); }
public void LaunchEntryPoint(string entryPointPath) { this.entryPointPath = entryPointPath; if (IsInEntryPoint) { //add in a fake breadcrumb so they will show properly session.AddBreadcrumb("DIRECTENTRY"); } if (this.EntryPointPath.ToLower() == ConfigEntryPointVal) //specialized case for config page { //OpenFolderPage((MediaBrowser.Library.FolderModel)ItemFactory.Instance.Create(this.RootFolder)); OpenConfiguration(true); } else { try { this.RootFolderModel = (MediaBrowser.Library.FolderModel)ItemFactory.Instance.Create(EntryPointResolver.EntryPoint(this.EntryPointPath)); if (!IsInEntryPoint) { Async.Queue("Top Level Refresher", () => { foreach (var item in RootFolderModel.Children) { if (item.BaseItem.RefreshMetadata(MetadataRefreshOptions.FastOnly)) item.ClearImages(); // refresh all the top-level folders to pick up any changes } RootFolderModel.Children.Sort(); //make sure sort is right }, 2000); } Navigate(this.RootFolderModel); } catch (Exception ex) { Microsoft.MediaCenter.Hosting.AddInHost.Current.MediaCenterEnvironment.Dialog(CurrentInstance.StringData("EntryPointErrorDial") + this.EntryPointPath + ". " + ex.ToString() + " " + ex.StackTrace.ToString(), CurrentInstance.StringData("EntryPointErrorCapDial"), DialogButtons.Ok, 30, true); Close(); } } }
public void Navigate(Item item) { Application.UIDeferredInvokeIfRequired(() => { Logger.ReportVerbose("Navigating to {0} item type {1}", item.Name, item.GetType()); currentContextMenu = null; //any sort of navigation should reset our context menu so it will properly re-evaluate on next ref if (item.BaseItem is Person) { NavigateToActor(item); return; } if (item.BaseItem is Show) { if ((item.HasDataForDetailPage) || this.Config.AlwaysShowDetailsPage) { item.NavigatingInto(); if (Config.EnableThemeBackgrounds && (currentPlaybackController == null || !currentPlaybackController.IsPlaying)) { BackdropController.PlayAsync(item.BaseItem); } // go to details screen var properties = new Dictionary<string, object>(); properties["Application"] = this; properties["Item"] = item; properties["ThemeConfig"] = CurrentTheme.Config; OpenMCMLPage(item.BaseItem.CustomUI ?? CurrentTheme.DetailPage, properties); return; } } var folder = item as MediaBrowser.Library.FolderModel; if (folder != null) { if (!Config.Instance.RememberIndexing) { folder.DisplayPrefs.IndexBy = MediaBrowser.Library.Localization.LocalizedStrings.Instance.GetString("NoneDispPref"); } if (Config.Instance.AutoEnterSingleDirs && (folder.Folder.Children.Count == 1)) { if (folder.IsRoot) //special breadcrumb if we are going from a single item root session.AddBreadcrumb("DIRECTENTRY"); else session.AddBreadcrumb(folder.Name); folder.NavigatingInto(); //make sure we validate CurrentFolder = folder; Navigate(folder.Children[0]); } else { OpenFolderPage(folder); } } else { Resume(item); } } ); }
public ActorItemWrapper(Actor actor, FolderModel parent) { this.Actor = actor; this.parent = parent; }
private void OpenFolderPage(FolderModel folder) { folder.RefreshMetadata(); Dictionary<string, object> properties = new Dictionary<string, object>(); properties["Application"] = this; properties["Folder"] = folder; if (session != null) { folder.NavigatingInto(); session.GoToPage("resx://MediaBrowser/MediaBrowser.Resources/Page", properties); } else { Logger.ReportError("Session is null in OpenPage"); } }
public StudioItemWrapper(Studio studio, FolderModel parent) { this.Studio = studio; this.parent = parent; }
private bool addProtectedFolder(FolderModel folder) { if (folder != null) { enteredProtectedFolders.Add(folder.Folder); return true; } else return false; }
public void NavigateProtected(FolderModel folder) { //save parameters where we can get at them after pin entry this.anItem = folder; //now present pin screen - it will call our callback after finished pinCallback = NavPinEntered; if (folder.BaseItem.CustomPIN != "" && folder.BaseItem.CustomPIN != null) customPIN = folder.BaseItem.CustomPIN; // use custom pin for this item else customPIN = Config.Instance.ParentalPIN; // use global pin Logger.ReportInfo("Request to open protected content " + folder.Name); PromptForPin(pinCallback, Application.CurrentInstance.StringData("EnterPINToViewDial")); }
public void OpenFolderPage(FolderModel folder) { Debug.Assert(Microsoft.MediaCenter.UI.Application.ApplicationThread == Thread.CurrentThread); var properties = new Dictionary<string, object>(); properties["Application"] = this; properties["Folder"] = folder; properties["ThemeConfig"] = CurrentTheme.Config; CurrentFolder = folder; //store our current folder CurrentItem = null; //blank this out in case it was messed with in the last screen if (folder.IsRoot) RootFolderModel = folder; //store the root as well if (session != null) { folder.NavigatingInto(); if (Config.EnableThemeBackgrounds && (currentPlaybackController == null || !currentPlaybackController.IsPlaying)) { BackdropController.PlayAsync(folder.BaseItem); } OpenMCMLPage(folder.Folder.CustomUI ?? CurrentTheme.FolderPage, properties); } else { Logger.ReportError("Session is null in OpenPage"); } }
public void OpenSecure(FolderModel folder) { //called if passed security OpenFolderPage(folder); }