diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-09-13 13:53:26 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-09-13 13:55:30 +0300 |
| commit | 99c757db6c5d9c67566b8c5ac6b3e5f18cb1010c (patch) | |
| tree | abb517598e708242d3d7c02130de7120ceb8a17c /Software/Visual_Studio/MachineStudio/Modules | |
| parent | 69a68e9a8b5dd452373cf2c4065e1a50178cfa02 (diff) | |
| download | Tango-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')
6 files changed, 207 insertions, 0 deletions
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 @@ <Reference Include="System" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll</HintPath> </Reference> @@ -109,6 +111,7 @@ <Compile Include="ViewModels\LiquidVolumeVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> <Compile Include="ViewModels\RgbVM.cs" /> + <Compile Include="ViewModels\RmlActiveSitesDialogVM.cs" /> <Compile Include="ViewModels\RmlDeleteDialogViewVM.cs" /> <Compile Include="Views\AddLiquidFactorView.xaml.cs"> <DependentUpon>AddLiquidFactorView.xaml</DependentUpon> @@ -131,6 +134,9 @@ <Compile Include="Views\ProcessParametersView.xaml.cs"> <DependentUpon>ProcessParametersView.xaml</DependentUpon> </Compile> + <Compile Include="Views\RmlActiveSitesDialog.xaml.cs"> + <DependentUpon>RmlActiveSitesDialog.xaml</DependentUpon> + </Compile> <Compile Include="Views\RmlDeleteDialogView.xaml.cs"> <DependentUpon>RmlDeleteDialogView.xaml</DependentUpon> </Compile> @@ -258,6 +264,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\RmlActiveSitesDialog.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\RmlDeleteDialogView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> 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; + } + } +} 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 @@ +<UserControl x:Class="Tango.MachineStudio.RML.Views.RmlActiveSitesDialog" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="400" Height="600" Width="500" Background="{StaticResource Dialog.Background}" d:DataContext="{d:DesignInstance Type=vm:RmlDeleteDialogViewVM, IsDesignTimeCreatable=False}" Foreground="{StaticResource Dialog.Foreground}"> + + <UserControl.Resources> + <Style x:Key="GridStyle" TargetType="DataGrid" BasedOn="{StaticResource {x:Type DataGrid}}"> + <Setter Property="AutoGenerateColumns" Value="False"></Setter> + <Setter Property="SelectionMode" Value="Single"></Setter> + <Setter Property="SelectionUnit" Value="FullRow"></Setter> + <Setter Property="IsReadOnly" Value="True"></Setter> + </Style> + <Style x:Key="CellStyle" TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type DataGridCell}"> + <Grid Background="{TemplateBinding Background}"> + <ContentPresenter VerticalAlignment="Center" Margin="8" /> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="BorderBrush" Value="Cyan"/> + </Trigger> + </Style.Triggers> + </Style> + + </UserControl.Resources> + + <Grid> + <DockPanel Margin="10"> + <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Center" DockPanel.Dock="Bottom"> + <Button Command="{Binding CloseCommand}" Width="140" Height="40" Margin="0 0 10 0"> + Close + </Button> + </StackPanel> + + <Grid DockPanel.Dock="Top"> + <DockPanel HorizontalAlignment="Stretch"> + <Grid DockPanel.Dock="Left"> + <materialDesign:PackIcon Kind="InformationVariant" Foreground="{StaticResource AccentColorBrush}" Width="28" Height="28" /> + </Grid> + <TextBlock DockPanel.Dock="Left" Margin="10 5 0 0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" TextWrapping="Wrap" Text="{Binding RMLName}"/> + </DockPanel> + </Grid> + <Grid DockPanel.Dock="Top" Margin="0 20 0 20"> + <materialDesign:Card Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch"> + <DataGrid ItemsSource="{Binding RMLSiteNamesList}" Style="{StaticResource GridStyle}" CellStyle="{StaticResource CellStyle}"> + <DataGrid.Columns> + <DataGridTextColumn Header="SITE NAME" IsReadOnly="True" Binding="{Binding }" Width="1*" /> + </DataGrid.Columns> + </DataGrid> + </materialDesign:Card> + </Grid> + + </DockPanel> + </Grid> +</UserControl> 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 +{ + /// <summary> + /// Interaction logic for RmlActiveSitesDialog.xaml + /// </summary> + 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 @@ <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" TextDecorations="Underline">Export Thread File</TextBlock> </StackPanel> </Button> + + <Button x:Name="ShowActiveInSitesBtn" Margin="30 0 0 0" Command="{Binding ActivatedInSitesCommand}" Foreground="{StaticResource BlackForegroundBrush}" FontSize="16" Style="{StaticResource emptyButton}" Cursor="Hand"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="InformationVariant" VerticalAlignment="Center" Width="26" Height="26" Foreground="Blue"/> + <TextBlock VerticalAlignment="Center" Margin="0 0 0 0" TextDecorations="Underline" Text="Activated in sites…"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Foreground" Value="{StaticResource BlackForegroundBrush}" /> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=ShowActiveInSitesBtn, Path=IsEnabled}" Value="False"> + <Setter Property="Foreground" Value="{StaticResource GrayBrush}" /> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </StackPanel> + </Button> + </StackPanel> </StackPanel> </Grid> |
