123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- <UserControl x:Class="MECF.Framework.UI.Client.CenterViews.Configs.Roles.RoleView"
- 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:i="http://schemas.microsoft.com/expression/2010/interactivity"
- xmlns:micro="clr-namespace:Caliburn.Micro"
- xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls"
- xmlns:command="clr-namespace:OpenSEMI.ClientBase.Command"
- >
- <UserControl.Resources>
- <Style x:Key="ViewEnabledBtn" TargetType="{x:Type Button}" BasedOn="{StaticResource ResourceKey={x:Type Button}}">
- <Setter Property="Button.IsEnabled" Value="False" />
- <Style.Triggers>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding Permission}" Value="3"></Condition>
- <Condition Binding="{Binding ControlMode}" Value="VIEW"></Condition>
- </MultiDataTrigger.Conditions>
- <Setter Property="Button.IsEnabled" Value="True"/>
- </MultiDataTrigger>
- </Style.Triggers>
- </Style>
- <Style x:Key="EditEnabledBtn" TargetType="{x:Type Button}" BasedOn="{StaticResource ResourceKey={x:Type Button}}">
- <Setter Property="Button.IsEnabled" Value="False" />
- <Style.Triggers>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding Permission}" Value="3"></Condition>
- <Condition Binding="{Binding ControlMode}" Value="EDIT"></Condition>
- </MultiDataTrigger.Conditions>
- <Setter Property="Button.IsEnabled" Value="True"/>
- </MultiDataTrigger>
- </Style.Triggers>
- </Style>
- </UserControl.Resources>
- <Grid x:Name="MainTable" MinHeight="450" HorizontalAlignment="Left" MinWidth="1200" Width="1900">
- <Grid x:Name="MainField">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" MinWidth="250"/>
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition />
- <RowDefinition Height="40"/>
- </Grid.RowDefinitions>
- <GridSplitter Width="5" Grid.Column="1" HorizontalAlignment="Left" BorderThickness="0,8">
- <GridSplitter.Background>
- <SolidColorBrush/>
- </GridSplitter.Background>
- </GridSplitter>
- <Border BorderBrush="{DynamicResource Tab_BD}" BorderThickness="1" SnapsToDevicePixels="True" Background="{DynamicResource Tab_BG}" Margin="0,20,0,0" Padding="12">
- <TreeView HorizontalAlignment="Left" Name="RolesTree" VerticalAlignment="Top">
- <TreeView.Style>
- <Style TargetType="{x:Type TreeView}" BasedOn="{StaticResource ResourceKey={x:Type TreeView}}">
- <Setter Property="TreeView.IsEnabled" Value="False" />
- <Style.Triggers>
- <DataTrigger Binding="{Binding ControlMode}" Value="VIEW">
- <Setter Property="TreeView.IsEnabled" Value="True"/>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </TreeView.Style>
- <TreeViewItem Header="Roles" ItemsSource="{Binding RoleList}" IsExpanded="True">
- <TreeViewItem.ItemContainerStyle>
- <Style x:Name="RoleTreeViewItem" TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource ResourceKey={x:Type TreeViewItem}}">
- <Setter Property="IsSelected" Value="{Binding Path=IsSelected,Mode=TwoWay}"></Setter>
- <Style.Triggers>
- <Trigger Property="VirtualizingStackPanel.IsVirtualizing" Value="true">
- <Setter Property="ItemsPanel">
- <Setter.Value>
- <ItemsPanelTemplate>
- <VirtualizingStackPanel/>
- </ItemsPanelTemplate>
- </Setter.Value>
- </Setter>
- </Trigger>
- </Style.Triggers>
- </Style>
- </TreeViewItem.ItemContainerStyle>
- <TreeViewItem.ItemTemplate>
- <DataTemplate>
- <TextBlock Text="{Binding DisplayRoleName}" />
- </DataTemplate>
- </TreeViewItem.ItemTemplate>
- </TreeViewItem>
- <command:CommandSource.Trigger>
- <command:CommandTriggerGroup>
- <command:EventCommandTrigger
- RoutedEvent="TreeView.SelectedItemChanged"
- CustomParameter="{Binding ElementName=RolesTree,Path=SelectedItem}"
- Command="{Binding DataContext.RoleTreeSelectChangedCommand,
- RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" />
- </command:CommandTriggerGroup>
- </command:CommandSource.Trigger>
- </TreeView>
- </Border>
- <Grid Grid.Column="1" Margin="10,0,0,0">
- <Grid.RowDefinitions>
- <RowDefinition Height="20"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition/>
- </Grid.RowDefinitions>
- <TextBlock TextWrapping="Wrap" Text="Role Property" VerticalAlignment="Top" Foreground="{DynamicResource FG_Black}" FontWeight="Bold" FontSize="14" FontFamily="Arial" Margin="5,0,0,0"/>
- <Grid x:Name="Role_Property" Grid.Row="1" Margin="0,0,0,5" IsEnabled="{Binding IsPermission}">
- <Grid.RowDefinitions>
- <RowDefinition Height="24"/>
- <RowDefinition Height="24"/>
- <RowDefinition Height="24"/>
- <RowDefinition Height="24"/>
- </Grid.RowDefinitions>
- <Grid x:Name="Role_Name" Grid.Row="0">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="100"/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
- <TextBlock Text="Role Name" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="12" FontFamily="Arial" VerticalAlignment="Center"/>
- </Border>
- <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Grid.Column="1" Padding="5,1">
- <controls:TextBoxEx Text="{Binding TreeSelectedRole.DisplayRoleName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalContentAlignment="Stretch" TextSaved="{Binding Mode=TwoWay, Path=TreeSelectedRole.RoleNameTextSaved }" x:Name="textBox1"
- HorizontalAlignment="Left" VerticalAlignment="Center" Width="150" IsEnabled="{Binding IsEnabledRoleName}">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="TextChanged">
- <micro:ActionMessage MethodName="OnRoleChanged">
- </micro:ActionMessage>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </controls:TextBoxEx>
- </Border>
- </Grid>
- <Grid x:Name="Is_Auto_Logout" Grid.Row="1">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="100"/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
- <TextBlock Text="Is Auto lock" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="12" FontFamily="Arial" VerticalAlignment="Center"/>
- </Border>
- <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Grid.Column="1" Padding="5,1">
- <CheckBox IsChecked="{Binding TreeSelectedRole.DisplayIsAutoLogout}" HorizontalAlignment="Left" VerticalAlignment="Center"
- Content=""
- Name="checkBox1">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="Click">
- <micro:ActionMessage MethodName="OnAutoLogoutTimeChecked">
- <micro:Parameter Value="$source" />
- </micro:ActionMessage>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </CheckBox>
- </Border>
- </Grid>
- <Grid x:Name="Time" Grid.Row="2">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="100"/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
- <TextBlock Text="Time(minutes)" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="12" FontFamily="Arial" VerticalAlignment="Center"/>
- </Border>
- <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Grid.Column="1" Padding="5,1">
- <controls:TextBoxEx EditBoxMode="UnSignInteger" Text="{Binding TreeSelectedRole.DisplayAutoLogoutTime,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalContentAlignment="Stretch" TextSaved="{Binding Mode=TwoWay, Path=TreeSelectedRole.TimeTextSaved }" x:Name="textBox2"
- HorizontalAlignment="Left" VerticalAlignment="Center" Width="150" PreviewTextInput="TextBox2_PreviewTextInput">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="TextChanged">
- <micro:ActionMessage MethodName="OnRoleChanged">
- </micro:ActionMessage>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </controls:TextBoxEx>
- </Border>
- </Grid>
- <Grid x:Name="Description" Grid.Row="3">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="100"/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
- <TextBlock Text="Description" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="12" FontFamily="Arial" VerticalAlignment="Center"/>
- </Border>
- <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Grid.Column="1" Padding="5,1">
- <controls:TextBoxEx Text="{Binding TreeSelectedRole.DisplayDescription,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalContentAlignment="Stretch" TextSaved="{Binding Mode=TwoWay, Path=TreeSelectedRole.DescriptionTextSaved }" x:Name="textBox3"
- HorizontalAlignment="Left" VerticalAlignment="Center" MinWidth="150">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="TextChanged">
- <micro:ActionMessage MethodName="OnRoleChanged">
- </micro:ActionMessage>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </controls:TextBoxEx>
- </Border>
- </Grid>
- </Grid>
- <TabControl Grid.Row="2">
- <TabItem>
- <TabItem.Header>
- <TextBlock Text="Page Access Permission" FontWeight="Bold"/>
- </TabItem.Header>
- <ListView AlternationCount="2"
- VerticalAlignment="Top"
- Name="RolesList"
- ScrollViewer.HorizontalScrollBarVisibility="Auto"
- ScrollViewer.VerticalScrollBarVisibility="Auto"
- ScrollViewer.CanContentScroll="True"
- ItemsSource="{Binding Path=TreeSelectedRole.MenuCollection}" IsEnabled="{Binding IsPermission}">
- <ListView.View>
- <GridView>
- <GridViewColumn Width="200" Header="Menu Name" DisplayMemberBinding="{Binding Name}"/>
- <GridViewColumn Width="200" Header="Permission Configuration">
- <GridViewColumn.CellTemplate>
- <DataTemplate >
- <ComboBox Width="140" x:Name="combPermission"
- DisplayMemberPath="StringPermission"
- SelectedIndex="{Binding DisplayIndexPermission}"
- ItemsSource="{Binding DataContext.PermissionDictionary,
- RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="SelectionChanged">
- <micro:ActionMessage MethodName="OnRoleChanged">
- </micro:ActionMessage>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </ComboBox>
- </DataTemplate>
- </GridViewColumn.CellTemplate>
- </GridViewColumn>
- </GridView>
- </ListView.View>
- </ListView>
- </TabItem>
- </TabControl>
- </Grid>
- <StackPanel Grid.Row="1" Grid.ColumnSpan="2" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
- <Button Content="Create" Style="{StaticResource ViewEnabledBtn}" Command="{Binding btnAddRoleCommand}" Height="25" Width="80"/>
- <Button Content="Delete" Style="{StaticResource ViewEnabledBtn}" Command="{Binding btnDeleteRoleCommand}" Height="25" Width="80" Margin="10,0,0,0"/>
- <Button Content="Clone" Style="{StaticResource ViewEnabledBtn}" Command="{Binding btnCloneRoleCommand}" Height="25" Width="80" Margin="10,0,0,0"/>
- <Button Content="Save" Style="{StaticResource EditEnabledBtn}" Command="{Binding btnSaveCommand}" Height="25" Width="80" Margin="10,0,0,0" />
- <Button Content="Cancel" Style="{StaticResource EditEnabledBtn}" Command="{Binding BtnCancelRoleCommand}" Height="25" Width="80" Margin="10,0,0,0"/>
- </StackPanel>
- </Grid>
- </Grid>
- </UserControl>
|