123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- <UserControl
- x:Class="ShakerManger.View.AddUserView"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:hc="https://handyorg.github.io/handycontrol"
- xmlns:local="clr-namespace:ShakerManger.View"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:model="clr-namespace:Shaker.Model;assembly=Shaker"
- xmlns:vm="clr-namespace:ShakerManger.ViewModel"
- Width="{x:Static SystemParameters.PrimaryScreenWidth}"
- Height="{x:Static SystemParameters.PrimaryScreenHeight}"
- d:DataContext="{d:DesignInstance {x:Type vm:AddUserViewModel}}"
- d:DesignHeight="450"
- d:DesignWidth="800"
- Background="#afffffff"
- DataContext="{Binding Source={StaticResource MainViewModel}, Path=Data.SystemConfig.UserPage.AddUserViewModel}"
- FontSize="14"
- Foreground="{StaticResource LableBrush}"
- mc:Ignorable="d">
- <Border
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Background="{StaticResource MainBrush}"
- BorderBrush="{StaticResource AuxiliaryBrush}"
- BorderThickness="1"
- CornerRadius="6">
- <Grid
- Margin="60"
- HorizontalAlignment="Center"
- VerticalAlignment="Center">
- <Grid.RowDefinitions>
- <RowDefinition Height="46" />
- <RowDefinition Height="46" />
- <RowDefinition Height="46" />
- <RowDefinition Height="auto" />
- <RowDefinition Height="46" />
- </Grid.RowDefinitions>
- <StackPanel
- Grid.Row="0"
- Height="46"
- HorizontalAlignment="Center"
- Orientation="Horizontal">
- <TextBlock
- Width="80"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="用户名:" />
- <TextBox
- Width="220"
- Height="32"
- Background="Transparent"
- CaretBrush="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=Foreground}"
- FontSize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=FontSize}"
- Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=Foreground}"
- Text="{Binding UserName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
- </StackPanel>
- <StackPanel
- Grid.Row="1"
- Height="46"
- HorizontalAlignment="Center"
- Orientation="Horizontal">
- <TextBlock
- Width="80"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="用户类型:" />
- <ComboBox
- Width="220"
- Height="32"
- Background="Transparent"
- DisplayMemberPath="Description"
- Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=Foreground}"
- ItemsSource="{Binding UserType, Converter={StaticResource EnumToCollectionConverter}, Mode=OneTime}"
- SelectedValue="{Binding UserType}"
- SelectedValuePath="Value"
- Style="{StaticResource ComboBoxStyle1}" />
- </StackPanel>
- <StackPanel
- Grid.Row="2"
- Height="46"
- HorizontalAlignment="Center"
- Orientation="Horizontal">
- <TextBlock
- Width="80"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="密码:" />
- <TextBox
- Width="220"
- Height="32"
- Background="Transparent"
- CaretBrush="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=Foreground}"
- FontSize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=FontSize}"
- Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=Foreground}"
- Text="{Binding PassWord, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
- </StackPanel>
- <StackPanel Grid.Row="3">
- <ListView
- MinHeight="622"
- FontSize="14"
- ItemsSource="{Binding Source={StaticResource MainViewModel}, Path=Data.Shakers.Shakers}">
- <ListView.Style>
- <Style TargetType="ListView">
- <Setter Property="Background" Value="White" />
- <Setter Property="BorderBrush" Value="Transparent" />
- <Setter Property="Padding" Value="0" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ListView}">
- <Grid Height="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListView}, Path=ActualHeight}">
- <Grid.RowDefinitions>
- <RowDefinition Height="36" />
- <RowDefinition Height="auto" MaxHeight="540" />
- </Grid.RowDefinitions>
- <Grid Background="{StaticResource EmbellishBrush}">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="400" />
- <ColumnDefinition Width="140" />
- </Grid.ColumnDefinitions>
- <Line
- Grid.Column="0"
- HorizontalAlignment="Right"
- VerticalAlignment="Center"
- Stroke="{StaticResource AuxiliaryBrush}"
- StrokeThickness="1"
- X1="0"
- X2="0"
- Y1="0"
- Y2="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Grid}, Path=ActualHeight}" />
- <TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Foreground="{StaticResource MainBrush}"
- Text="振动台" />
- <TextBlock
- Grid.Column="1"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Foreground="{StaticResource MainBrush}"
- Text="是否允许" />
- </Grid>
- <hc:ScrollViewer
- Grid.Row="1"
- MaxHeight="540"
- Padding="0"
- HorizontalScrollBarVisibility="Hidden"
- VerticalScrollBarVisibility="Auto">
- <ItemsPresenter Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </hc:ScrollViewer>
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="ItemTemplate">
- <Setter.Value>
- <DataTemplate>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="400" />
- <ColumnDefinition Width="140" />
- </Grid.ColumnDefinitions>
- <Line
- Grid.Column="1"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- Stroke="{StaticResource AuxiliaryBrush}"
- StrokeThickness="1"
- X1="0"
- X2="0"
- Y1="0"
- Y2="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Grid}, Path=ActualHeight}" />
- <Line
- Grid.Column="0"
- Grid.ColumnSpan="2"
- VerticalAlignment="Bottom"
- Stroke="{StaticResource AuxiliaryBrush}"
- X1="0"
- X2="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Grid}, Path=ActualWidth}"
- Y1="0"
- Y2="0" />
- <TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Background="Transparent"
- Text="{Binding Description, Mode=OneWay}" />
- <hc:BulletCheckBox
- Grid.Column="1"
- Width="86"
- Height="32"
- hc:BorderElement.CornerRadius="0"
- BorderThickness="0"
- Cursor="Hand">
- <hc:BulletCheckBox.Style>
- <Style TargetType="hc:BulletCheckBox" BasedOn="{StaticResource {x:Type hc:BulletCheckBox}}">
- <Style.Setters>
- <Setter Property="IsChecked">
- <Setter.Value>
- <MultiBinding Converter="{StaticResource UserAllowClientIDConverter}" Mode="OneWay">
- <Binding Mode="OneWay" Path="ClientID" />
- <Binding
- Mode="OneWay"
- Path="Data.SystemConfig.UserPage.AddUserViewModel.ClientIDs"
- Source="{StaticResource MainViewModel}" />
- </MultiBinding>
- </Setter.Value>
- </Setter>
- </Style.Setters>
- </Style>
- </hc:BulletCheckBox.Style>
- <hc:Interaction.Triggers>
- <hc:EventTrigger EventName="Click">
- <hc:ExInvokeCommandAction Command="{Binding Source={StaticResource MainViewModel}, Path=Data.SystemConfig.UserPage.AddUserViewModel.ClickCommand}" CommandParameter="{Binding ClientID}" />
- </hc:EventTrigger>
- </hc:Interaction.Triggers>
- </hc:BulletCheckBox>
- </Grid>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="ItemContainerStyle">
- <Setter.Value>
- <Style TargetType="ListViewItem">
- <Setter Property="MinHeight" Value="46" />
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="BorderBrush" Value="Transparent" />
- <Setter Property="BorderThickness" Value="0" />
- <Setter Property="SnapsToDevicePixels" Value="True" />
- <Setter Property="OverridesDefaultStyle" Value="True" />
- <Setter Property="Cursor" Value="Hand" />
- <Setter Property="IsEnabled" Value="True" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="ListViewItem">
- <ContentPresenter />
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding Source={StaticResource MainViewModel}, Path=Data.SystemConfig.UserPage.AddUserViewModel.UserType}" Value="{x:Static model:UserType.SystemAdministrator}">
- <Setter Property="IsEnabled" Value="False" />
- </DataTrigger>
- <DataTrigger Binding="{Binding Source={StaticResource MainViewModel}, Path=Data.SystemConfig.UserPage.AddUserViewModel.UserType}" Value="{x:Static model:UserType.ClientUser}">
- <Setter Property="IsEnabled" Value="True" />
- </DataTrigger>
- <DataTrigger Binding="{Binding Source={StaticResource MainViewModel}, Path=Data.SystemConfig.UserPage.AddUserViewModel.UserType}" Value="{x:Static model:UserType.SystemUser}">
- <Setter Property="IsEnabled" Value="False" />
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </ListView.Style>
- </ListView>
- </StackPanel>
- <StackPanel
- Grid.Row="4"
- Height="46"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Orientation="Horizontal">
- <Button
- Width="120"
- Height="32"
- hc:IconElement.Geometry="{StaticResource YesGeometry}"
- hc:IconElement.Height="20"
- hc:IconElement.Width="20"
- Command="{Binding OkCommand}"
- Content="确认"
- FontSize="16"
- IsEnabled="{Binding CanOk}"
- Style="{StaticResource HasIconButton}" />
- <Button
- Width="120"
- Height="32"
- Margin="20,0,0,0"
- hc:IconElement.Geometry="{StaticResource NoGeometry}"
- hc:IconElement.Height="20"
- hc:IconElement.Width="20"
- Command="{Binding CancelCommand}"
- Content="取消"
- FontSize="16"
- Style="{StaticResource HasIconButton}" />
- </StackPanel>
- </Grid>
- </Border>
- </UserControl>
|