mirror of
https://github.com/ZuneDev/ZuneShell.dll.git
synced 2026-07-27 13:11:51 -07:00
Initial implementation of Strix tracks in LibraryDataProviderQuery
This commit is contained in:
@@ -1,63 +1,55 @@
|
||||
#if OPENZUNE
|
||||
|
||||
using Microsoft.Iris;
|
||||
using Microsoft.Iris;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Zune.Library
|
||||
namespace Microsoft.Zune.Library;
|
||||
|
||||
internal class LibraryVirtualList : VirtualList, ISearchableList
|
||||
{
|
||||
internal class LibraryVirtualList : VirtualList, ISearchableList
|
||||
private StrixLibraryDataProviderQuery m_owner;
|
||||
private ZuneQueryList m_pQueryList;
|
||||
private string m_itemTypeName;
|
||||
private object m_itemTypeCookie;
|
||||
private bool m_autoRefresh;
|
||||
private bool m_useSlowDataRequests;
|
||||
private bool m_antialiasImageEdges;
|
||||
|
||||
public LibraryVirtualList(StrixLibraryDataProviderQuery owner, ZuneQueryList pQueryList,
|
||||
bool autoRefresh, bool antialiasEdges)
|
||||
: base(true)
|
||||
{
|
||||
private StrixLibraryDataProviderQuery m_owner;
|
||||
private ZuneQueryList m_pQueryList;
|
||||
private string m_itemTypeName;
|
||||
private object m_itemTypeCookie;
|
||||
private bool m_autoRefresh;
|
||||
private bool m_useSlowDataRequests;
|
||||
private bool m_antialiasImageEdges;
|
||||
|
||||
public LibraryVirtualList(StrixLibraryDataProviderQuery owner, ZuneQueryList pQueryList,
|
||||
bool autoRefresh, bool antialiasEdges)
|
||||
: base(true)
|
||||
try
|
||||
{
|
||||
try
|
||||
this.m_owner = owner;
|
||||
base.StoreQueryResults = true;
|
||||
this.m_pQueryList = pQueryList;
|
||||
//pQueryList.AddRef();
|
||||
//this.m_fBlockChanges = false;
|
||||
//this.m_fEndBulkArrivedDuringBlock = false;
|
||||
this.m_antialiasImageEdges = antialiasEdges;
|
||||
this.m_autoRefresh = autoRefresh;
|
||||
if (autoRefresh)
|
||||
{
|
||||
this.m_owner = owner;
|
||||
base.StoreQueryResults = true;
|
||||
this.m_pQueryList = pQueryList;
|
||||
//pQueryList.AddRef();
|
||||
//this.m_fBlockChanges = false;
|
||||
//this.m_fEndBulkArrivedDuringBlock = false;
|
||||
this.m_antialiasImageEdges = antialiasEdges;
|
||||
this.m_autoRefresh = autoRefresh;
|
||||
if (autoRefresh)
|
||||
{
|
||||
//this.m_pQueryList.Advise(this);
|
||||
}
|
||||
//base.Count = this.m_pQueryList.Count;
|
||||
|
||||
Add("Howdy there!");
|
||||
//this.m_pQueryList.Advise(this);
|
||||
}
|
||||
catch
|
||||
{
|
||||
base.Dispose(ModelItemDisposeMode.KeepOwnerReference);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetItemTypeCookie(string itemTypeName, object itemTypeCookie)
|
||||
{
|
||||
this.m_itemTypeName = itemTypeName;
|
||||
this.m_itemTypeCookie = itemTypeCookie;
|
||||
foreach (var item in pQueryList)
|
||||
Add(item);
|
||||
}
|
||||
|
||||
public int SearchForString(string searchString)
|
||||
catch
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
base.Dispose(ModelItemDisposeMode.KeepOwnerReference);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
internal void SetItemTypeCookie(string itemTypeName, object itemTypeCookie)
|
||||
{
|
||||
this.m_itemTypeName = itemTypeName;
|
||||
this.m_itemTypeCookie = itemTypeCookie;
|
||||
}
|
||||
|
||||
public int SearchForString(string searchString)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
#if OPENZUNE
|
||||
using Microsoft.Iris;
|
||||
using StrixMusic.Sdk.AppModels;
|
||||
|
||||
using Microsoft.Iris;
|
||||
namespace Microsoft.Zune.Library;
|
||||
|
||||
namespace Microsoft.Zune.Library
|
||||
public static class StrixLibraryDataProvider
|
||||
{
|
||||
public static class StrixLibraryDataProvider
|
||||
{
|
||||
public static void Register()
|
||||
{
|
||||
Application.RegisterDataProvider("Library", new DataProviderQueryFactory(ConstructQuery));
|
||||
}
|
||||
public static IStrixDataRoot DataRoot { get; set; }
|
||||
|
||||
private static DataProviderQuery ConstructQuery(object queryTypeCookie)
|
||||
{
|
||||
return new StrixLibraryDataProviderQuery(queryTypeCookie);
|
||||
}
|
||||
public static void Register()
|
||||
{
|
||||
Application.RegisterDataProvider("Library", new DataProviderQueryFactory(ConstructQuery));
|
||||
}
|
||||
|
||||
private static DataProviderQuery ConstructQuery(object queryTypeCookie)
|
||||
{
|
||||
return new StrixLibraryDataProviderQuery(queryTypeCookie, DataRoot);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,26 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Zune.Library
|
||||
namespace Microsoft.Zune.Library;
|
||||
|
||||
public class ZuneQueryList : List<object>, IDisposable
|
||||
{
|
||||
public class ZuneQueryList : IDisposable
|
||||
internal ZuneQueryList(EQueryType queryType = EQueryType.eQueryTypeInvalid)
|
||||
{
|
||||
internal ZuneQueryList(EQueryType queryType)
|
||||
{
|
||||
QueryType = queryType;
|
||||
}
|
||||
|
||||
}
|
||||
public bool IsEmpty => Count == 0;
|
||||
|
||||
public bool IsEmpty { get; protected set; }
|
||||
public bool IsDisposed { get; protected set; }
|
||||
|
||||
public bool IsDisposed { get; protected set; }
|
||||
public EQueryType QueryType { get; set; }
|
||||
|
||||
public int Count { get; protected set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
IsDisposed = true;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
IsDisposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,52 +140,55 @@ namespace Microsoft.Zune.Shell
|
||||
FeaturesChanged.Instance.StartUp();
|
||||
CultureHelper.CheckValidRegionAndLanguage();
|
||||
|
||||
DirectoryInfo cacheFolderPath = new(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Microsoft\Zune\OpenZune\LocalCoreCache"));
|
||||
cacheFolderPath.Create();
|
||||
OwlCore.Storage.SystemIO.SystemFolder cacheFolder = new(cacheFolderPath);
|
||||
|
||||
OwlCore.Storage.SystemIO.SystemFolder musicFolder = new(@"D:\Music\Zune\Test");
|
||||
var localCore = new StrixMusic.Cores.Storage.StorageCore(musicFolder, cacheFolder, "Local Test")
|
||||
{
|
||||
ScannerWaitBehavior = StrixMusic.Cores.Storage.ScannerWaitBehavior.AlwaysWait,
|
||||
};
|
||||
|
||||
var prefs = new MergedCollectionConfig
|
||||
{
|
||||
CoreRanking = new string[]
|
||||
{
|
||||
localCore.InstanceId
|
||||
}
|
||||
};
|
||||
var mergedLayer = new MergedCore(new ICore[] { localCore }, prefs);
|
||||
|
||||
// Perform any async initialization needed. Authenticating, connecting to database, etc.
|
||||
// Add plugins
|
||||
PlaybackHandler = new PlaybackHandlerService();
|
||||
PlaybackHandler.RegisterAudioPlayer(VlcAudioService.Instance, localCore.InstanceId);
|
||||
//PlaybackHandler.RegisterAudioPlayer(PlayerInteropAudioService.Instance, localCore.InstanceId);
|
||||
|
||||
DataRoot = new StrixDataRootPluginWrapper(mergedLayer,
|
||||
new PlaybackHandlerPlugin(PlaybackHandler)
|
||||
);
|
||||
|
||||
DataRoot.InitAsync().ContinueWith(async task =>
|
||||
{
|
||||
if (task.Status == System.Threading.Tasks.TaskStatus.Faulted)
|
||||
{
|
||||
Debug.WriteLine(task.Exception);
|
||||
return;
|
||||
}
|
||||
|
||||
DataRoot.Library.TracksChanged += LibraryTracksChanged;
|
||||
|
||||
//await DataRoot.Library.PlayTrackCollectionAsync();
|
||||
});
|
||||
|
||||
((ZuneUI.Shell)ZuneShell.DefaultInstance).ApplicationInitializationIsComplete = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void InitStrixSdk()
|
||||
{
|
||||
DirectoryInfo cacheFolderPath = new(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Microsoft\Zune\OpenZune\LocalCoreCache"));
|
||||
cacheFolderPath.Create();
|
||||
OwlCore.Storage.SystemIO.SystemFolder cacheFolder = new(cacheFolderPath);
|
||||
|
||||
OwlCore.Storage.SystemIO.SystemFolder musicFolder = new(@"D:\Music\Zune\Test");
|
||||
var localCore = new StrixMusic.Cores.Storage.StorageCore(musicFolder, cacheFolder, "Local Test")
|
||||
{
|
||||
ScannerWaitBehavior = StrixMusic.Cores.Storage.ScannerWaitBehavior.AlwaysWait,
|
||||
};
|
||||
|
||||
var prefs = new MergedCollectionConfig
|
||||
{
|
||||
CoreRanking = new string[]
|
||||
{
|
||||
localCore.InstanceId
|
||||
}
|
||||
};
|
||||
var mergedLayer = new MergedCore(new ICore[] { localCore }, prefs);
|
||||
|
||||
// Perform any async initialization needed. Authenticating, connecting to database, etc.
|
||||
// Add plugins
|
||||
PlaybackHandler = new PlaybackHandlerService();
|
||||
PlaybackHandler.RegisterAudioPlayer(VlcAudioService.Instance, localCore.InstanceId);
|
||||
//PlaybackHandler.RegisterAudioPlayer(PlayerInteropAudioService.Instance, localCore.InstanceId);
|
||||
|
||||
DataRoot = new StrixDataRootPluginWrapper(mergedLayer,
|
||||
new PlaybackHandlerPlugin(PlaybackHandler)
|
||||
);
|
||||
|
||||
DataRoot.InitAsync().ContinueWith(async task =>
|
||||
{
|
||||
if (task.Status == System.Threading.Tasks.TaskStatus.Faulted)
|
||||
{
|
||||
Debug.WriteLine(task.Exception);
|
||||
return;
|
||||
}
|
||||
|
||||
DataRoot.Library.TracksChanged += LibraryTracksChanged;
|
||||
|
||||
//await DataRoot.Library.PlayTrackCollectionAsync();
|
||||
});
|
||||
}
|
||||
|
||||
private static async void LibraryTracksChanged(object sender,
|
||||
IReadOnlyList<CollectionChangedItem<ITrack>> addedItems,
|
||||
IReadOnlyList<CollectionChangedItem<ITrack>> removedItems)
|
||||
@@ -437,8 +440,12 @@ namespace Microsoft.Zune.Shell
|
||||
DialogHelper.DialogNo = ZuneUI.Shell.LoadString(StringId.IDS_DIALOG_NO);
|
||||
DialogHelper.DialogOk = ZuneUI.Shell.LoadString(StringId.IDS_DIALOG_OK);
|
||||
XmlDataProviders.Register();
|
||||
//Library.StrixLibraryDataProvider.Register();
|
||||
LibraryDataProvider.Register();
|
||||
|
||||
InitStrixSdk();
|
||||
Library.StrixLibraryDataProvider.DataRoot = DataRoot;
|
||||
Library.StrixLibraryDataProvider.Register();
|
||||
//LibraryDataProvider.Register();
|
||||
|
||||
SubscriptionDataProvider.Register();
|
||||
StaticLibraryDataProvider.Register();
|
||||
AggregateDataProviderQuery.Register();
|
||||
|
||||
Reference in New Issue
Block a user