diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-01-19 12:17:41 +0200 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-01-19 12:17:41 +0200 |
| commit | dd33d4340a7971a47d782580535ceed0c8e2c4c7 (patch) | |
| tree | 60aa90d7da3bd6543a5ed84bb397c2e3c8ea83be /Software/Visual_Studio/MachineStudio | |
| parent | 6336e42d8a6753cdfef3612e4cb53e1e4bacf2ff (diff) | |
| download | Tango-dd33d4340a7971a47d782580535ceed0c8e2c4c7.tar.gz Tango-dd33d4340a7971a47d782580535ceed0c8e2c4c7.zip | |
MS. RML Extensions. Add RMLExtension object with import/export RML.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
4 files changed, 23 insertions, 5 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 44ba71ac0..fd276ea65 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 @@ -1577,9 +1577,14 @@ namespace Tango.MachineStudio.RML.ViewModels { var json = File.ReadAllText(file); var rmlFile = await Rml.FromRmlFile(db, json); - + db.Rmls.Add(rmlFile); + if (rmlFile.RmlsExtensions != null && rmlFile.RmlsExtensions.Count > 0) + { + db.RmlsExtensions.Add(rmlFile.RmlsExtensions.FirstOrDefault()); + } + _actionLogManager.InsertLog(BL.Enumerations.ActionLogType.RmlImported, _authentication.CurrentUser, rmlFile.Name, rmlFile, "RML imported from Machine Studio."); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs index 686d95ccc..321d4af04 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/ViewModels/MainViewVM.cs @@ -237,7 +237,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels set { _RMLFilter = value; RaisePropertyChangedAuto(); OnFilterChanged(); } } - private async void OnFilterChanged() + public async void OnFilterChanged() { await LoadRmlExtentions(); } @@ -940,7 +940,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels _allUsers.Add(model); } } - + var q = (from c in db.Rmls.Where(x => x.Name.ToLower().Contains(filter)) join p in db.RmlsExtensions on c.Guid equals p.RmlsGuid into ps from p in ps.DefaultIfEmpty() @@ -953,7 +953,7 @@ namespace Tango.MachineStudio.ThreadExtensions.ViewModels Manufacturer = x.RML.Manufacturer, Brand = x.RMLExtesion == null ? "" : (Brands.Where(y => y.Guid == x.RMLExtesion.YarnBrandGuid).Select(z => z.Name).FirstOrDefault()), LinearDensity = (int)x.RML.FiberSize, - CreatedBy = x.RMLExtesion == null ? "" : _allUsers.SingleOrDefault(y => y.Guid == x.RMLExtesion.UsersGuid).Name, + CreatedBy = (x.RMLExtesion == null || x.RMLExtesion.UsersGuid == null || null == _allUsers.SingleOrDefault(y => y.Guid == x.RMLExtesion.UsersGuid)) ? "" : _allUsers.SingleOrDefault(y => y.Guid == x.RMLExtesion.UsersGuid).Name, Created = x.RMLExtesion == null ? DateTime.Now : x.RMLExtesion.Created, LastUpdated = x.RMLExtesion == null ? DateTime.Now : x.RMLExtesion.LastUpdated, Status = x.RMLExtesion == null ? RMLExtensionStatus.New : x.RMLExtesion.RMLStatus, diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml index 255fd80d1..14b2f737f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml @@ -21,7 +21,7 @@ <localconverters:BoolToDisplayStatusConverter x:Key="BoolToDisplayStatusConverter"/> </UserControl.Resources> - <Grid IsEnabled="{Binding IsFree}"> + <Grid IsEnabled="{Binding IsFree}" IsVisibleChanged="RMLExtensionsView_IsVisibleChanged"> <DockPanel Margin="100 100 100 50" MaxWidth="1500"> <Grid DockPanel.Dock="Top"> <Image Source="../Images/threads.png" Width="300" Margin="10" /> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml.cs index 03bac4bbe..1b5a5872d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ThreadExtensions/Views/RMLExtensionsView.xaml.cs @@ -19,9 +19,22 @@ namespace Tango.MachineStudio.ThreadExtensions.Views /// </summary> public partial class RMLExtensionsView : UserControl { + private ViewModels.MainViewVM _vm { get;set; } public RMLExtensionsView() { InitializeComponent(); + _vm = (ViewModels.MainViewVM)this.DataContext; + } + + private void RMLExtensionsView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) + { + if ((bool)e.NewValue) + { + if(_vm != null) + { + _vm.OnFilterChanged(); + } + } } } } |
