diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 6 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogViewVM.cs | 26 |
2 files changed, 19 insertions, 13 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index e2c29cac5..edcc741e6 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -865,7 +865,11 @@ namespace Tango.PPC.Jobs.ViewModels /// <param name="stop">The stop.</param> private async void OpenTwineCatalog(BrushStop stop) { - var catalogItem = await NavigationManager.NavigateForResult<JobsModule, TwineCatalogView, CatalogItem, BrushStop>(stop, true); + var catalogItem = await NavigationManager.NavigateForResult<JobsModule, TwineCatalogView, CatalogItem, TwineCatalogNavigationObject>(new TwineCatalogNavigationObject() + { + BrushStop = stop, + RML = Job.Rml, + }, true); if (catalogItem != null) { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogViewVM.cs index 1fd5c8474..7c6ed0c81 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogViewVM.cs @@ -9,6 +9,7 @@ using Tango.BL.Entities; using Tango.Core.Commands; using Tango.PPC.Common; using Tango.PPC.Common.Navigation; +using Tango.PPC.Jobs.NavigationObjects; using Tango.Settings; namespace Tango.PPC.Jobs.ViewModels @@ -16,11 +17,12 @@ namespace Tango.PPC.Jobs.ViewModels /// <summary> /// Represents the twine catalog view model. /// </summary> - /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> - /// <seealso cref="Tango.PPC.Common.Navigation.INavigationResultProvider{Tango.BL.Catalogs.CatalogItem, Tango.BL.Entities.BrushStop}" /> - public class TwineCatalogViewVM : PPCViewModel, INavigationResultProvider<CatalogItem, BrushStop> + /// <seealso cref="PPCViewModel" /> + /// <seealso cref="INavigationResultProvider{CatalogItem, TwineCatalogNavigationObject}" /> + public class TwineCatalogViewVM : PPCViewModel, INavigationResultProvider<CatalogItem, TwineCatalogNavigationObject> { private bool _confirmed; + private ObservablesContext _db; private Catalog _catalog; /// <summary> @@ -73,11 +75,7 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> public override void OnApplicationStarted() { - InvokeUI(() => - { - Catalog = CatalogLoader.LoadCatalog(BL.Enumerations.ColorSpaces.Twine, ObservablesStaticCollections.Instance.Context); - Recent = CatalogLoader.GetRecent(Catalog, SettingsManager.Default.GetOrCreate<JobsModuleSettings>().RecentTwineCatalogColors); - }); + _db = ObservablesContext.CreateDefault(); } /// <summary> @@ -96,7 +94,6 @@ namespace Tango.PPC.Jobs.ViewModels { SettingsManager.Default.GetOrCreate<JobsModuleSettings>().RecentTwineCatalogColors.Add(SelectedItem.Entity.Name); SettingsManager.Default.Save(); - Recent = CatalogLoader.GetRecent(Catalog, SettingsManager.Default.GetOrCreate<JobsModuleSettings>().RecentTwineCatalogColors); _confirmed = true; NavigationManager.NavigateBack(); @@ -122,11 +119,16 @@ namespace Tango.PPC.Jobs.ViewModels /// Called when the navigation object has been received /// </summary> /// <param name="brushStop">The brush stop.</param> - public virtual void OnNavigationObjectReceived(BrushStop brushStop) + public async virtual void OnNavigationObjectReceived(TwineCatalogNavigationObject obj) { - if (brushStop.ColorCatalog != null) + IsFree = false; + Catalog = await CatalogLoader.LoadCatalog(BL.Enumerations.ColorSpaces.Twine, obj.RML, _db); + Recent = CatalogLoader.GetRecent(Catalog, SettingsManager.Default.GetOrCreate<JobsModuleSettings>().RecentTwineCatalogColors); + IsFree = true; + + if (obj.BrushStop.ColorCatalog != null) { - SelectedItem = Catalog.Groups.SelectMany(x => x.Items).SingleOrDefault(x => x.Entity.Guid == brushStop.ColorCatalog.Guid); + SelectedItem = Catalog.Groups.SelectMany(x => x.Items).SingleOrDefault(x => x.Entity.Guid == obj.BrushStop.ColorCatalog.Guid); } else { |
