private void LoadDisplayPreferences()
        {
            Logger.ReportInfo("Loading display prefs for " + this.Path);

            Guid id = Id;

            if (Config.Instance.EnableSyncViews)
            {
                if (baseItem is Folder && baseItem.GetType() != typeof(Folder))
                {
                    id = baseItem.GetType().FullName.GetMD5();
                }
            }

            DisplayPreferences dp = Kernel.Instance.ItemRepository.RetrieveDisplayPreferences(id);

            if (dp == null)
            {
                dp = new DisplayPreferences(id);
                dp.LoadDefaults();
                if ((this.PhysicalParent != null) && (Config.Instance.InheritDefaultView))
                {
                    // inherit some of the display properties from our parent the first time we are visited
                    DisplayPreferences pt = this.PhysicalParent.DisplayPrefs;
                    dp.ViewType.Chosen  = pt.ViewType.Chosen;
                    dp.ShowLabels.Value = pt.ShowLabels.Value;
                    // after some use, carrying the sort order forward doesn;t feel right - for seasons especially it can be confusing
                    // dp.SortOrder = pt.SortOrder;
                    dp.VerticalScroll.Value = pt.VerticalScroll.Value;
                }
            }
            this.DisplayPrefs = dp;
        }
Example #2
0
        public void SaveDisplayPreferences(DisplayPreferences prefs)
        {
            string file = GetDisplayPrefsFile(prefs.Id);

            using (Stream fs = WriteExclusiveFileStream(file)) {
                prefs.WriteToStream(new BinaryWriter(fs));
            }
        }
        public override void NavigatingInto() {
            // force display prefs to reload.
            displayPrefs = null;

            // metadata should be refreshed in a higher priority
            if (Config.Instance.AutoValidate) folderChildren.RefreshAsap();

            base.NavigatingInto();
        }
Example #4
0
        public void SaveDisplayPreferences(DisplayPreferences prefs)
        {
            string file = GetDisplayPrefsFile(prefs.Id);

            using (Stream fs = WriteExclusiveFileStream(file)) {
                prefs.WriteToStream(new BinaryWriter(fs));
            }
            //also save the thumb size in a way we can access outside of MC
            thumbSizes[prefs.Id] = new ThumbSize(prefs.ThumbConstraint.Value.Width, prefs.ThumbConstraint.Value.Height);
        }
        protected virtual void LoadDisplayPreferences()
        {
            Logger.ReportVerbose("Loading display prefs for " + this.Path);

            Folder.LoadDisplayPreferences();

            var dp = new DisplayPreferences(this.Folder.DisplayPreferencesId, this.Folder);

            this.DisplayPrefs = dp;
        }
        public override void NavigatingInto()
        {
            // force display prefs to reload.
            displayPrefs = null;

            // metadata should be refreshed in a higher priority
            folderChildren.RefreshAsap();

            base.NavigatingInto();
        }
        public override void NavigatingInto() {
            // force display prefs to reload.
            displayPrefs = null;

            // metadata should be refreshed in a higher priority
            if (Config.Instance.AutoValidate) folderChildren.RefreshAsap();

            // see if this will help get first unwatched index in time
            var ignore = FirstUnwatchedIndex;

            base.NavigatingInto();
        }
Example #8
0
        public override void NavigatingInto()
        {
            // force display prefs to reload.
            displayPrefs = null;

            // metadata should be refreshed in a higher priority
            if (Config.Instance.AutoValidate)
            {
                folderChildren.RefreshAsap();
            }

            base.NavigatingInto();
        }
Example #9
0
        public DisplayPreferences RetrieveDisplayPreferences(Guid id)
        {
            string file = GetDisplayPrefsFile(id);

            if (File.Exists(file))
            {
                using (Stream fs = ReadFileStream(file)) {
                    DisplayPreferences dp = DisplayPreferences.ReadFromStream(id, new BinaryReader(fs));
                    return(dp);
                }
            }

            return(null);
        }
Example #10
0
 protected void LoadDefaultDisplayPreferences(ref Guid id, ref DisplayPreferences dp)
 {
     dp = new DisplayPreferences(id, this.Folder);
     dp.LoadDefaults();
     if ((this.PhysicalParent != null) && (Config.Instance.InheritDefaultView))
     {
         // inherit some of the display properties from our parent the first time we are visited
         DisplayPreferences pt = this.PhysicalParent.DisplayPrefs;
         dp.ViewType.Chosen  = pt.ViewType.Chosen;
         dp.ShowLabels.Value = pt.ShowLabels.Value;
         // after some use, carrying the sort order forward doesn;t feel right - for seasons especially it can be confusing
         // dp.SortOrder = pt.SortOrder;
         dp.VerticalScroll.Value = pt.VerticalScroll.Value;
     }
 }
        public static DisplayPreferences ReadFromStream(Guid id, BinaryReader br)
        {
            DisplayPreferences dp = new DisplayPreferences(id);

            dp.saveEnabled = false;
            byte version = br.ReadByte();

            try
            {
                dp.viewType.Chosen = ViewTypeNames.GetName((ViewType)Enum.Parse(typeof(ViewType), br.SafeReadString()));
            }
            catch
            {
                dp.viewType.Chosen = ViewTypeNames.GetName(MediaBrowser.Library.ViewType.Poster);
            }
            dp.showLabels.Value     = br.ReadBoolean();
            dp.verticalScroll.Value = br.ReadBoolean();
            try
            {
                dp.SortOrder = (SortOrder)Enum.Parse(typeof(SortOrder), br.SafeReadString());
            }
            catch { }
            dp.IndexBy = (IndexType)Enum.Parse(typeof(IndexType), br.SafeReadString());
            if (!Config.Instance.RememberIndexing)
            {
                dp.IndexBy = IndexType.None;
            }
            dp.useBanner.Value       = br.ReadBoolean();
            dp.thumbConstraint.Value = new Size(br.ReadInt32(), br.ReadInt32());

            if (version >= 2)
            {
                dp.useCoverflow.Value = br.ReadBoolean();
            }

            if (version >= 3)
            {
                dp.useBackdrop.Value = br.ReadBoolean();
            }

            dp.saveEnabled = true;
            return(dp);
        }
Example #12
0
        protected virtual void LoadDisplayPreferences()
        {
            Logger.ReportVerbose("Loading display prefs for " + this.Path);

            Guid id = Id;

            if (Config.Instance.EnableSyncViews)
            {
                if (baseItem is Folder && baseItem.GetType() != typeof(Folder))
                {
                    id = baseItem.GetType().FullName.GetMD5();
                }
            }

            DisplayPreferences dp = new DisplayPreferences(id, this.Folder);

            dp = Kernel.Instance.ItemRepository.RetrieveDisplayPreferences(dp);
            if (dp == null)
            {
                LoadDefaultDisplayPreferences(ref id, ref dp);
            }

            this.DisplayPrefs = dp;
        }
Example #13
0
        protected virtual void LoadDisplayPreferences()
        {
            Logger.ReportVerbose("Loading display prefs for " + this.Path);

            Guid id = Id;

            if (Config.Instance.EnableSyncViews) {
                if (baseItem is Folder && baseItem.GetType() != typeof(Folder)) {
                    id = baseItem.GetType().FullName.GetMD5();
                }
            }

            DisplayPreferences dp = new DisplayPreferences(id, this.Folder);
            dp = Kernel.Instance.ItemRepository.RetrieveDisplayPreferences(dp);
            if (dp == null) {
                LoadDefaultDisplayPreferences(ref id, ref dp);
            }

            this.DisplayPrefs = dp;
        }
        public static DisplayPreferences ReadFromStream(Guid id, BinaryReader br)
        {
            DisplayPreferences dp = new DisplayPreferences(id);
            dp.saveEnabled = false;
            byte version = br.ReadByte();
            try
            {
                dp.viewType.Chosen = ViewTypeNames.GetName((ViewType)Enum.Parse(typeof(ViewType), br.SafeReadString()));
            }
            catch
            {
                dp.viewType.Chosen = ViewTypeNames.GetName(MediaBrowser.Library.ViewType.Poster);
            }
            dp.showLabels.Value = br.ReadBoolean();
            dp.verticalScroll.Value = br.ReadBoolean();
            try
            {
                dp.SortOrder = (SortOrder)Enum.Parse(typeof(SortOrder), br.SafeReadString());
            }
            catch { }
            dp.IndexBy = (IndexType)Enum.Parse(typeof(IndexType), br.SafeReadString());
            if (!Config.Instance.RememberIndexing)
                dp.IndexBy = IndexType.None;
            dp.useBanner.Value = br.ReadBoolean();
            dp.thumbConstraint.Value = new Size(br.ReadInt32(), br.ReadInt32());

            if (version >= 2)
                dp.useCoverflow.Value = br.ReadBoolean();

            if (version >= 3)
                dp.useBackdrop.Value = br.ReadBoolean();

            dp.saveEnabled = true;
            return dp;
        }
        public DisplayPreferences RetrieveDisplayPreferences(DisplayPreferences dp) {
            string file = GetDisplayPrefsFile(dp.Id);

            if (File.Exists(file)) {
                using (Stream fs = ReadFileStream(file)) {
                    dp.ReadFromStream(new BinaryReader(fs));
                    return dp;
                }
            } 

            return null;
        }
        protected virtual void LoadDisplayPreferences() {
            Logger.ReportVerbose("Loading display prefs for " + this.Path);

            Folder.LoadDisplayPreferences();

            var dp = new DisplayPreferences(this.Folder.DisplayPreferencesId, this.Folder);

            this.DisplayPrefs = dp;
        }
Example #17
0
        private void LoadDisplayPreferences()
        {
            Logger.ReportInfo("Loading display prefs for " + this.Path);

            Guid id = Id;

            if (Config.Instance.EnableSyncViews) {
                if (baseItem is Folder && baseItem.GetType() != typeof(Folder)) {
                    id = baseItem.GetType().FullName.GetMD5();
                }
            }

            DisplayPreferences dp = Kernel.Instance.ItemRepository.RetrieveDisplayPreferences(id);
            if (dp == null) {
                dp = new DisplayPreferences(id);
                dp.LoadDefaults();
                if ((this.PhysicalParent != null) && (Config.Instance.InheritDefaultView)) {
                    // inherit some of the display properties from our parent the first time we are visited
                    DisplayPreferences pt = this.PhysicalParent.DisplayPrefs;
                    dp.ViewType.Chosen = pt.ViewType.Chosen;
                    dp.ShowLabels.Value = pt.ShowLabels.Value;
                    // after some use, carrying the sort order forward doesn;t feel right - for seasons especially it can be confusing
                    // dp.SortOrder = pt.SortOrder;
                    dp.VerticalScroll.Value = pt.VerticalScroll.Value;
                }
            }
            this.DisplayPrefs = dp;
        }
 protected void LoadDefaultDisplayPreferences(ref Guid id, ref DisplayPreferences dp)
 {
     dp = new DisplayPreferences(this.Folder.DisplayPreferencesId, this.Folder);
     dp.LoadDefaults();
     if ((this.PhysicalParent != null) && (Config.Instance.InheritDefaultView))
     {
         // inherit some of the display properties from our parent the first time we are visited
         DisplayPreferences pt = this.PhysicalParent.DisplayPrefs;
         dp.ViewType.Chosen = pt.ViewType.Chosen;
         dp.ShowLabels.Value = pt.ShowLabels.Value;
         // after some use, carrying the sort order forward doesn;t feel right - for seasons especially it can be confusing
         // dp.SortOrder = pt.SortOrder;
         dp.VerticalScroll.Value = pt.VerticalScroll.Value;
     }
 }
 public void SaveDisplayPreferences(DisplayPreferences prefs)
 {
 }
 public void SaveDisplayPreferences(DisplayPreferences prefs) {
     string file = GetDisplayPrefsFile(prefs.Id);
     using (Stream fs = WriteExclusiveFileStream(file)) {
         prefs.WriteToStream(new BinaryWriter(fs));
     }
     //also save the thumb size in a way we can access outside of MC
     thumbSizes[prefs.Id] = new ThumbSize(prefs.ThumbConstraint.Value.Width, prefs.ThumbConstraint.Value.Height);
 }
Example #21
0
 public void SaveDisplayPreferences(DisplayPreferences prefs)
 {
     string file = GetDisplayPrefsFile(prefs.Id);
     using (Stream fs = WriteExclusiveFileStream(file)) {
         prefs.WriteToStream(new BinaryWriter(fs));
     }
 }