From 69a68e9a8b5dd452373cf2c4065e1a50178cfa02 Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 12 Sep 2023 12:47:01 +0300 Subject: MachineStudio. Sites. selected RMLs using a text button: “Show selected”. Also allow to filter by words by using: “Filter:_abc_____” MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/SiteDetailsViewVM.cs | 57 ++++++++++++++++++++++ .../Views/SiteDetailsView.xaml | 12 ++++- 2 files changed, 67 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs index 02c9f4346..bf2ebdbcf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/ViewModels/SiteDetailsViewVM.cs @@ -14,6 +14,8 @@ using Tango.MachineStudio.Common.Authentication; using Tango.BL.ActionLogs; using Tango.BL.DTO; using Tango.BL.Builders; +using System.ComponentModel; +using System.Windows.Data; namespace Tango.MachineStudio.Sites.ViewModels { @@ -70,12 +72,44 @@ namespace Tango.MachineStudio.Sites.ViewModels set { _spoolTypes = value; RaisePropertyChangedAuto(); } } + private bool _showSelectedRMLsOnly; + + public bool ShowSelectedRMLsOnly + { + get { return _showSelectedRMLsOnly; } + set { _showSelectedRMLsOnly = value; + RaisePropertyChangedAuto(); RMLCollection.Refresh(); } + } + + private String _RMLFilter; + + public String RMLFilter + { + get { return _RMLFilter; } + set { + _RMLFilter = value; + RaisePropertyChangedAuto(); + RMLCollection.Refresh(); + } + } + + + private ICollectionView _rmlscollectionFilter; + public ICollectionView RMLCollection + { + get { return _rmlscollectionFilter; } + set { _rmlscollectionFilter = value; + RaisePropertyChangedAuto(); } + } + + public RelayCommand SaveCommand { get; set; } public SiteDetailsViewVM() { SaveCommand = new RelayCommand(Save, () => IsFree); + _showSelectedRMLsOnly = true; } public async Task Init(String siteGuid, INotificationProvider notification, IAuthenticationProvider authentication, IActionLogManager actionLogManager, bool isNew, string newSiteName = null) @@ -127,6 +161,29 @@ namespace Tango.MachineStudio.Sites.ViewModels } _siteBeforeSave = SiteDTO.FromObservable(Site); + + RMLCollection = CollectionViewSource.GetDefaultView(Rmls); + RMLCollection.Filter = new Predicate(x => + { + SelectedObject Sel_rml = x as SelectedObject; + + if (!String.IsNullOrEmpty(RMLFilter))// by filter and check box Show selected only + { + var rml = Sel_rml.Data as Rml; + if (rml != null && rml.Name.ToLower().Contains(RMLFilter.ToLower())) + { + return ShowSelectedRMLsOnly ? Sel_rml.IsSelected : true; + } + else + return false; + } + else + { + return ShowSelectedRMLsOnly ? Sel_rml.IsSelected : true; + } + + + }); } private async void Save() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/Views/SiteDetailsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/Views/SiteDetailsView.xaml index b4da6f35c..e6c2e78f9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/Views/SiteDetailsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Sites/Views/SiteDetailsView.xaml @@ -114,9 +114,11 @@ SITE RML + - - + + + @@ -129,6 +131,12 @@ + + + + + + -- cgit v1.3.1 From 99c757db6c5d9c67566b8c5ac6b3e5f18cb1010c Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Wed, 13 Sep 2023 13:53:26 +0300 Subject: 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. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tango.MachineStudio.RML.csproj | 10 +++ .../ViewModels/MainViewVM.cs | 44 ++++++++++++++ .../ViewModels/RmlActiveSitesDialogVM.cs | 35 +++++++++++ .../Views/RmlActiveSitesDialog.xaml | 71 ++++++++++++++++++++++ .../Views/RmlActiveSitesDialog.xaml.cs | 28 +++++++++ .../Tango.MachineStudio.RML/Views/RmlsView.xaml | 19 ++++++ 6 files changed, 207 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RmlActiveSitesDialogVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlActiveSitesDialog.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlActiveSitesDialog.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj index 4ba97e35b..dfa8e2add 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj @@ -58,6 +58,8 @@ + + ..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll @@ -109,6 +111,7 @@ + AddLiquidFactorView.xaml @@ -131,6 +134,9 @@ ProcessParametersView.xaml + + RmlActiveSitesDialog.xaml + RmlDeleteDialogView.xaml @@ -258,6 +264,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile 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 _rmls; public List Rmls { @@ -237,7 +239,10 @@ namespace Tango.MachineStudio.RML.ViewModels get { return _RMLFilter; } set { _RMLFilter = value; RaisePropertyChangedAuto(); OnRMLFilterChanged(); } } + + #endregion + #region Commands /// /// Gets or sets the manage RML command. /// @@ -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(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(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 _rmlSiteNamesList; + + public List RMLSiteNamesList + { + get { return _rmlSiteNamesList; } + set { _rmlSiteNamesList = value; + RaisePropertyChangedAuto(); + } + } + + public String RMLName { get; set; } + + + #endregion + + public RmlActiveSitesDialogVM(List rmlSitenamesList, string rmlName) + { + RMLSiteNamesList = rmlSitenamesList; + RMLName = rmlName; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlActiveSitesDialog.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlActiveSitesDialog.xaml new file mode 100644 index 000000000..b02380508 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlActiveSitesDialog.xaml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlActiveSitesDialog.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlActiveSitesDialog.xaml.cs new file mode 100644 index 000000000..f9c020506 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlActiveSitesDialog.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.RML.Views +{ + /// + /// Interaction logic for RmlActiveSitesDialog.xaml + /// + public partial class RmlActiveSitesDialog : UserControl + { + public RmlActiveSitesDialog() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml index 9c684c052..2c0f77937 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml @@ -77,6 +77,25 @@ Export Thread File + + + -- cgit v1.3.1