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);
        }
Пример #2
0
        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;
        }
Пример #3
0
 public Item Create(BaseItem baseItem)
 {
     Item item;
     if (baseItem is Folder) {
         item = new FolderModel();
     } else {
         item = new Item();
     }
     item.Assign(baseItem);
     return item;
 }
Пример #4
0
 private bool addProtectedFolder(FolderModel folder)
 {
     if (folder != null)
     {
         enteredProtectedFolders.Add(folder.Folder);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #5
0
        public Item Create(BaseItem baseItem)
        {
            Item item;

            if (baseItem is Folder)
            {
                item = new FolderModel();
            }
            else
            {
                item = new Item();
            }
            item.Assign(baseItem);
            return(item);
        }
Пример #6
0
        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"));
        }
Пример #7
0
        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();
            }
        }
Пример #8
0
 public DirectorItemWrapper(string director, FolderModel parent)
 {
     this.Director = director;
     this.parent   = parent;
 }
Пример #9
0
        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");
            }
        }
Пример #10
0
 public void NavigateSecure(FolderModel folder)
 {
     //just call method on parentalControls - it will callback if secure
     Kernel.Instance.ParentalControls.NavigateProtected(folder);
 }
Пример #11
0
        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();
                }
            }
        }
Пример #12
0
        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);
                    }
                }
            );
        }
Пример #13
0
 public ActorItemWrapper(Actor actor, FolderModel parent)
 {
     this.Actor  = actor;
     this.parent = parent;
 }
Пример #14
0
        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");
            }
        }
Пример #15
0
 public StudioItemWrapper(Studio studio, FolderModel parent)
 {
     this.Studio = studio;
     this.parent = parent;
 }
 public DirectorItemWrapper(string director, FolderModel parent)
 {
     this.Director = director;
     this.parent = parent;
 }
Пример #17
0
 private bool addProtectedFolder(FolderModel folder)
 {
     if (folder != null)
     {
         enteredProtectedFolders.Add(folder.Folder);
         return true;
     }
     else
         return false;
 }
Пример #18
0
        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"));
        }
Пример #19
0
        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 ActorItemWrapper(Actor actor, FolderModel parent)
 {
     this.Actor = actor;
     this.parent = parent;
 }
Пример #21
0
 public StudioItemWrapper(Studio studio, FolderModel parent)
 {
     this.Studio = studio;
     this.parent = parent;
 }
Пример #22
0
 public void OpenSecure(FolderModel folder)
 {
     //called if passed security
     OpenFolderPage(folder);
 }