Merge pull request #323 from jlewin/master
Add navigation mechanism for the Purchased folder
This commit is contained in:
commit
6db7fbdfb0
3 changed files with 19 additions and 2 deletions
|
|
@ -29,6 +29,8 @@ either expressed or implied, of the FreeBSD Project.
|
|||
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.MatterControl.PrintLibrary;
|
||||
using MatterHackers.MatterControl.PrintLibrary.Provider;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.VectorMath;
|
||||
|
|
@ -301,6 +303,12 @@ namespace MatterHackers.MatterControl
|
|||
ReloadAdvancedControlsPanelTrigger.CallEvents(this, null);
|
||||
}
|
||||
|
||||
public void SwitchToPurchasedLibrary()
|
||||
{
|
||||
// Switch to the purchased library
|
||||
LibraryDataView.CurrentLibraryProvider = LibraryProviderSelector.Instance.PurchasedLibrary;
|
||||
}
|
||||
|
||||
public void ChangeCloudSyncStatus(bool userAuthenticated)
|
||||
{
|
||||
CloudSyncStatusChanged.CallEvents(this, new CloudSyncEventArgs() { IsAuthenticated = userAuthenticated });
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
bool isChildOfCurrent = value.ParentLibraryProvider == currentLibraryProvider;
|
||||
|
||||
// Dispose of all children below this one.
|
||||
while (!isChildOfCurrent && currentLibraryProvider != value)
|
||||
while (!isChildOfCurrent && currentLibraryProvider != value && currentLibraryProvider.ParentLibraryProvider != null)
|
||||
{
|
||||
LibraryProvider parent = currentLibraryProvider.ParentLibraryProvider;
|
||||
currentLibraryProvider.Dispose();
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
|
||||
private List<LibraryProvider> visibleProviders;
|
||||
|
||||
internal LibraryProvider PurchasedLibrary { get; private set; }
|
||||
|
||||
private event EventHandler unregisterEvents;
|
||||
|
||||
private LibraryProviderSelector()
|
||||
|
|
@ -66,7 +68,14 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
|
|||
PluginFinder<LibraryProviderPlugin> libraryProviderPlugins = new PluginFinder<LibraryProviderPlugin>();
|
||||
foreach (LibraryProviderPlugin libraryProviderPlugin in libraryProviderPlugins.Plugins)
|
||||
{
|
||||
libraryProviders.Add(libraryProviderPlugin.CreateLibraryProvider(this));
|
||||
// This coupling is required to navigate to the Purchased folder after redemption or purchase updates
|
||||
var pluginProvider = libraryProviderPlugin.CreateLibraryProvider(this);
|
||||
if (pluginProvider.ProviderKey == "LibraryProviderPurchasedKey")
|
||||
{
|
||||
this.PurchasedLibrary = pluginProvider;
|
||||
}
|
||||
|
||||
libraryProviders.Add(pluginProvider);
|
||||
}
|
||||
|
||||
// and any directory providers (sd card provider, etc...)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue