diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-23 10:58:08 -0500 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-23 10:58:08 -0500 |
| commit | 17c1fd576057bdd2d6aea517d733fe8af6e6b2ba (patch) | |
| tree | 660f47e816a8599aabdb7ee47f3cde64c72c3f4d /MediaBrowser.Plugins.DefaultTheme/Model/VirtualCollection.cs | |
| parent | 33ed929b526acbda696f00f5966917ebd6a9ded2 (diff) | |
moved ui to it's own repo
Diffstat (limited to 'MediaBrowser.Plugins.DefaultTheme/Model/VirtualCollection.cs')
| -rw-r--r-- | MediaBrowser.Plugins.DefaultTheme/Model/VirtualCollection.cs | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/MediaBrowser.Plugins.DefaultTheme/Model/VirtualCollection.cs b/MediaBrowser.Plugins.DefaultTheme/Model/VirtualCollection.cs deleted file mode 100644 index 9bdf61129..000000000 --- a/MediaBrowser.Plugins.DefaultTheme/Model/VirtualCollection.cs +++ /dev/null @@ -1,90 +0,0 @@ -using MediaBrowser.Model.DTO; -using MediaBrowser.UI.Controls; -using System; -using System.Threading; -using System.Windows; - -namespace MediaBrowser.Plugins.DefaultTheme.Model -{ - public class VirtualCollection : ModelItem, IDisposable - { - private string _name; - public string Name - { - get { return _name; } - set - { - _name = value; - OnPropertyChanged("Name"); - } - } - - private DtoBaseItem[] _items; - public DtoBaseItem[] Items - { - get { return _items; } - set - { - _items = value; - OnPropertyChanged("Items"); - CurrentItemIndex = Items.Length == 0 ? -1 : 0; - - ReloadTimer(); - } - } - - private int _currentItemIndex; - public int CurrentItemIndex - { - get { return _currentItemIndex; } - set - { - _currentItemIndex = value; - OnPropertyChanged("CurrentItemIndex"); - OnPropertyChanged("CurrentItem"); - } - } - - public DtoBaseItem CurrentItem - { - get { return CurrentItemIndex == -1 ? null : Items[CurrentItemIndex]; } - } - - private Timer CurrentItemTimer { get; set; } - - private void DisposeTimer() - { - if (CurrentItemTimer != null) - { - CurrentItemTimer.Dispose(); - } - } - - private void ReloadTimer() - { - DisposeTimer(); - - if (Items.Length > 0) - { - CurrentItemTimer = new Timer(state => Application.Current.Dispatcher.InvokeAsync(() => IncrementCurrentItemIndex()), null, 5000, 5000); - } - } - - private void IncrementCurrentItemIndex() - { - var newIndex = CurrentItemIndex + 1; - - if (newIndex >= Items.Length) - { - newIndex = 0; - } - - CurrentItemIndex = newIndex; - } - - public void Dispose() - { - DisposeTimer(); - } - } -} |
