aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2023-09-13 13:53:26 +0300
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2023-09-13 13:55:30 +0300
commit99c757db6c5d9c67566b8c5ac6b3e5f18cb1010c (patch)
treeabb517598e708242d3d7c02130de7120ceb8a17c /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels
parent69a68e9a8b5dd452373cf2c4065e1a50178cfa02 (diff)
downloadTango-99c757db6c5d9c67566b8c5ac6b3e5f18cb1010c.tar.gz
Tango-99c757db6c5d9c67566b8c5ac6b3e5f18cb1010c.zip
Machine studio->RML: show text button: “Activated in sites…” once clicked it will show a window with a list of sites are using this RML.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs44
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RmlActiveSitesDialogVM.cs35
2 files changed, 79 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
index 7eb6e9058..e3c128cb7 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
@@ -41,6 +41,8 @@ namespace Tango.MachineStudio.RML.ViewModels
private ObservablesContext _active_context;
+ #region Properties
+
private List<RmlModel> _rmls;
public List<RmlModel> Rmls
{
@@ -237,7 +239,10 @@ namespace Tango.MachineStudio.RML.ViewModels
get { return _RMLFilter; }
set { _RMLFilter = value; RaisePropertyChangedAuto(); OnRMLFilterChanged(); }
}
+
+ #endregion
+ #region Commands
/// <summary>
/// Gets or sets the manage RML command.
/// </summary>
@@ -300,6 +305,10 @@ namespace Tango.MachineStudio.RML.ViewModels
public RelayCommand BatchConversionCommand { get; set; }
+ public RelayCommand ActivatedInSitesCommand { get; set; }
+
+ #endregion
+
public MainViewVM(INotificationProvider notificationProvider, IAuthenticationProvider authentication, IActionLogManager actionLogManager)
{
_notification = notificationProvider;
@@ -316,6 +325,7 @@ namespace Tango.MachineStudio.RML.ViewModels
RemoveLiquidFactorCommand = new RelayCommand<LiquidTypesRml>(RemoveLiquidFactor, () => IsFree);
CreateCalibrationDataExcelTemplateCommand = new RelayCommand(CreateCalibrationDataExcelTemplate);
SaveCommand = new RelayCommand(Save, () => IsFree);
+ ActivatedInSitesCommand = new RelayCommand(ActivatedInSitesDialog, () => SelectedRML != null);
ImportForwardDataCommand = new RelayCommand(ImportCCTData, () => ActiveRML != null && IsFree);
@@ -1128,6 +1138,40 @@ namespace Tango.MachineStudio.RML.ViewModels
}
}
+ private async void ActivatedInSitesDialog()
+ {
+ if(SelectedRML == null)
+ return;
+
+ try
+ {
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
+ {
+ IsFree = false;
+
+ var selSites = await db.SitesRmls.OrderBy(x => x.ID).Where(y => y.RmlGuid == SelectedRML.Guid).Include(x=>x.Site).Select(x => x.Site.Name).ToListAsync();
+
+ var vm = new RmlActiveSitesDialogVM(selSites, SelectedRML.Name);
+ _notification.ShowModalDialog<RmlActiveSitesDialogVM, RmlActiveSitesDialog>(vm, (x) => { }, () => { });
+
+ if (!vm.DialogResult)
+ {
+ return;
+ }
+
+
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error display Activated In Sites selected RML {SelectedRML?.Name}.");
+ }
+ finally
+ {
+ IsFree = true;
+ }
+ }
+
private async void BackToRmls()
{
View.NavigateTo(RmlNavigationView.RmlsView);
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RmlActiveSitesDialogVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RmlActiveSitesDialogVM.cs
new file mode 100644
index 000000000..dd5213bc3
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RmlActiveSitesDialogVM.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.SharedUI;
+
+namespace Tango.MachineStudio.RML.ViewModels
+{
+ public class RmlActiveSitesDialogVM : DialogViewVM
+ {
+ #region Properties
+
+ private List<string> _rmlSiteNamesList;
+
+ public List<string> RMLSiteNamesList
+ {
+ get { return _rmlSiteNamesList; }
+ set { _rmlSiteNamesList = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+
+ public String RMLName { get; set; }
+
+
+ #endregion
+
+ public RmlActiveSitesDialogVM(List<string> rmlSitenamesList, string rmlName)
+ {
+ RMLSiteNamesList = rmlSitenamesList;
+ RMLName = rmlName;
+ }
+ }
+}