@ -61,7 +61,7 @@ namespace MediaBrowser.ServerApplication
lblVersion . Content = "Version: " + appHost . ApplicationVersion ;
foreach ( var user in userManager . Users )
ddlProfile . Items . Add ( user ) ;
ddlProfile . Items . Insert ( 0 , new User { Name = "Physical" } ) ;
ddlProfile . Items . Insert ( 0 , new User { Name = "Physical" } ) ;
ddlProfile . SelectedIndex = 0 ;
ddlIndexBy . Visibility = ddlSortBy . Visibility = lblIndexBy . Visibility = lblSortBy . Visibility = Visibility . Hidden ;
@ -94,22 +94,22 @@ namespace MediaBrowser.ServerApplication
children = OrderByName ( children , CurrentUser ) ;
foreach ( Folder folder in children )
{
{
var currentFolder = folder ;
Task . Factory . StartNew ( ( ) = >
{
var prefs = ddlProfile . SelectedItem ! = null ? _displayPreferencesManager . GetDisplayPreferences ( currentFolder . GetDisplayPreferencesId ( ( ddlProfile . SelectedItem as User ) . Id ) ) ? ? new DisplayPreferences { SortBy = ItemSortBy . SortName } : new DisplayPreferences { SortBy = ItemSortBy . SortName } ;
var node = new TreeViewItem { Tag = currentFolder } ;
var subChildren = currentFolder . GetChildren ( CurrentUser , true , prefs . IndexBy ) ;
subChildren = OrderByName ( subChildren , CurrentUser ) ;
AddChildren ( node , subChildren , CurrentUser ) ;
node . Header = currentFolder . Name + " (" +
node . Items . Count + ")" ;
tvwLibrary . Items . Add ( node ) ;
} , CancellationToken . None , TaskCreationOptions . None , ui ) ;
}
var currentFolder = folder ;
Task . Factory . StartNew ( ( ) = >
{
var prefs = ddlProfile . SelectedItem ! = null ? _displayPreferencesManager . GetDisplayPreferences ( currentFolder . GetDisplayPreferencesId ( ( ddlProfile . SelectedItem as User ) . Id ) , ( ddlProfile . SelectedItem as User ) . Id , "LibraryExplorer" ) ? ? new DisplayPreferences { SortBy = ItemSortBy . SortName } : new DisplayPreferences { SortBy = ItemSortBy . SortName } ;
var node = new TreeViewItem { Tag = currentFolder } ;
var subChildren = currentFolder . GetChildren ( CurrentUser , true , prefs . IndexBy ) ;
subChildren = OrderByName ( subChildren , CurrentUser ) ;
AddChildren ( node , subChildren , CurrentUser ) ;
node . Header = currentFolder . Name + " (" +
node . Items . Count + ")" ;
tvwLibrary . Items . Add ( node ) ;
} , CancellationToken . None , TaskCreationOptions . None , ui ) ;
}
} ) ;
lblLoading . Visibility = Visibility . Hidden ;
Cursor = Cursors . Arrow ;
@ -148,11 +148,11 @@ namespace MediaBrowser.ServerApplication
{
foreach ( var item in children )
{
var node = new TreeViewItem { Tag = item } ;
var node = new TreeViewItem { Tag = item } ;
var subFolder = item as Folder ;
if ( subFolder ! = null )
{
var prefs = _displayPreferencesManager . GetDisplayPreferences ( subFolder . GetDisplayPreferencesId ( user . Id ) );
var prefs = _displayPreferencesManager . GetDisplayPreferences ( subFolder . GetDisplayPreferencesId ( user . Id ) , user . Id , "LibraryExplorer" );
AddChildren ( node , OrderBy ( subFolder . GetChildren ( user , true ) , user , prefs . SortBy ) , user ) ;
node . Header = item . Name + " (" + node . Items . Count + ")" ;
@ -185,7 +185,7 @@ namespace MediaBrowser.ServerApplication
lblIndexBy . Visibility = ddlIndexBy . Visibility = ddlSortBy . Visibility = lblSortBy . Visibility = Visibility . Visible ;
ddlIndexBy . ItemsSource = folder . IndexByOptionStrings ;
ddlSortBy . ItemsSource = new [ ]
ddlSortBy . ItemsSource = new [ ]
{
ItemSortBy . SortName ,
ItemSortBy . Album ,
@ -200,7 +200,7 @@ namespace MediaBrowser.ServerApplication
ItemSortBy . Runtime
} ;
var prefs = _displayPreferencesManager . GetDisplayPreferences ( folder . GetDisplayPreferencesId ( ( ddlProfile . SelectedItem as User ) . Id ) );
var prefs = _displayPreferencesManager . GetDisplayPreferences ( folder . GetDisplayPreferencesId ( ( ddlProfile . SelectedItem as User ) . Id ) , ( ddlProfile . SelectedItem as User ) . Id , "LibraryExplorer" );
ddlIndexBy . SelectedItem = prefs ! = null
? prefs . IndexBy ? ? LocalizedStrings . Instance . GetString ( "NoneDispPref" )
@ -359,7 +359,7 @@ namespace MediaBrowser.ServerApplication
var folder = treeItem ! = null
? treeItem . Tag as Folder
: null ;
var prefs = folder ! = null ? _displayPreferencesManager . GetDisplayPreferences ( folder . GetDisplayPreferencesId ( CurrentUser . Id ) ) : new DisplayPreferences { SortBy = ItemSortBy . SortName } ;
var prefs = folder ! = null ? _displayPreferencesManager . GetDisplayPreferences ( folder . GetDisplayPreferencesId ( CurrentUser . Id ) , CurrentUser . Id , "LibraryExplorer" ) : new DisplayPreferences { SortBy = ItemSortBy . SortName } ;
if ( folder ! = null & & prefs . IndexBy ! = ddlIndexBy . SelectedItem as string )
{
//grab UI context so we can update within the below task
@ -400,7 +400,7 @@ namespace MediaBrowser.ServerApplication
var folder = treeItem ! = null
? treeItem . Tag as Folder
: null ;
var prefs = folder ! = null ? _displayPreferencesManager . GetDisplayPreferences ( folder . GetDisplayPreferencesId ( CurrentUser . Id ) ) : new DisplayPreferences ( ) ;
var prefs = folder ! = null ? _displayPreferencesManager . GetDisplayPreferences ( folder . GetDisplayPreferencesId ( CurrentUser . Id ) , CurrentUser . Id , "LibraryExplorer" ) : new DisplayPreferences ( ) ;
if ( folder ! = null & & prefs . SortBy ! = ddlSortBy . SelectedItem as string )
{
//grab UI context so we can update within the below task
@ -605,7 +605,7 @@ namespace MediaBrowser.ServerApplication
uri = new Uri ( "pack://application:,,,/Resources/Images/series.png" ) ;
else if ( item is BoxSet )
uri = new Uri ( "pack://application:,,,/Resources/Images/boxset.png" ) ;
else
else
uri = new Uri ( "pack://application:,,,/Resources/Images/folder.png" ) ;
return new BitmapImage ( uri ) ;