AccountView.xaml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <UserControl x:Class="MECF.Framework.UI.Client.CenterViews.Configs.Accounts.AccountView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
  7. xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls"
  8. xmlns:micro="clr-namespace:Caliburn.Micro"
  9. Width="1920">
  10. <UserControl.Resources>
  11. <Style x:Key="ViewEnabledBtn" TargetType="{x:Type Button}" BasedOn="{StaticResource ResourceKey={x:Type Button}}">
  12. <Setter Property="Button.IsEnabled" Value="False" />
  13. <Style.Triggers>
  14. <MultiDataTrigger>
  15. <MultiDataTrigger.Conditions>
  16. <Condition Binding="{Binding Permission}" Value="3"></Condition>
  17. <Condition Binding="{Binding ControlMode}" Value="VIEW"></Condition>
  18. </MultiDataTrigger.Conditions>
  19. <Setter Property="Button.IsEnabled" Value="True"/>
  20. </MultiDataTrigger>
  21. </Style.Triggers>
  22. </Style>
  23. <Style x:Key="EditEnabledBtn" TargetType="{x:Type Button}" BasedOn="{StaticResource ResourceKey={x:Type Button}}">
  24. <Setter Property="Button.IsEnabled" Value="False" />
  25. <Style.Triggers>
  26. <MultiDataTrigger>
  27. <MultiDataTrigger.Conditions>
  28. <Condition Binding="{Binding Permission}" Value="3"></Condition>
  29. <Condition Binding="{Binding ControlMode}" Value="EDIT"></Condition>
  30. </MultiDataTrigger.Conditions>
  31. <Setter Property="Button.IsEnabled" Value="True"/>
  32. </MultiDataTrigger>
  33. </Style.Triggers>
  34. </Style>
  35. </UserControl.Resources>
  36. <Grid x:Name="MainTable" MinHeight="450" HorizontalAlignment="Left" MinWidth="1900">
  37. <Grid x:Name="MainField">
  38. <Grid.ColumnDefinitions>
  39. <ColumnDefinition Width="250"/>
  40. <ColumnDefinition />
  41. </Grid.ColumnDefinitions>
  42. <Grid.RowDefinitions>
  43. <RowDefinition />
  44. <RowDefinition Height="40"/>
  45. </Grid.RowDefinitions>
  46. <GridSplitter Width="5" Grid.Column="1" HorizontalAlignment="Left" BorderThickness="0,8">
  47. <GridSplitter.Background>
  48. <SolidColorBrush/>
  49. </GridSplitter.Background>
  50. </GridSplitter>
  51. <ListView Name="AccountList" AlternationCount="2" Margin="0,20,0,0" ItemsSource="{Binding AccountList}" SelectedItem="{Binding TreeSelectedAccount}">
  52. <ListView.Style>
  53. <Style TargetType="{x:Type ListView}" BasedOn="{StaticResource ResourceKey={x:Type ListView}}">
  54. <Setter Property="ListView.IsEnabled" Value="False"/>
  55. <Style.Triggers>
  56. <DataTrigger Binding="{Binding ControlMode}" Value="VIEW">
  57. <Setter Property="ListView.IsEnabled" Value="True"/>
  58. </DataTrigger>
  59. </Style.Triggers>
  60. </Style>
  61. </ListView.Style>
  62. <ListView.View>
  63. <GridView>
  64. <GridViewColumn Width="200" Header="Account" DisplayMemberBinding="{Binding DisplayAccountName}" />
  65. </GridView>
  66. </ListView.View>
  67. </ListView>
  68. <Grid Margin="10,0,0,0" Grid.Column="1">
  69. <Grid.RowDefinitions>
  70. <RowDefinition Height="20"/>
  71. <RowDefinition Height="Auto"/>
  72. <RowDefinition/>
  73. </Grid.RowDefinitions>
  74. <TextBlock TextWrapping="Wrap" Text="Account Property" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{DynamicResource FG_Black}" FontSize="14" FontWeight="Bold" FontFamily="Arial" Margin="5,0"/>
  75. <Grid Grid.Row="1" IsEnabled="{Binding IsPermission}" Margin="0,0,10,0">
  76. <Grid.RowDefinitions>
  77. <RowDefinition Height="24"/>
  78. <RowDefinition Height="24"/>
  79. <RowDefinition Height="24"/>
  80. <RowDefinition Height="24"/>
  81. <RowDefinition Height="24"/>
  82. <RowDefinition Height="24"/>
  83. <RowDefinition/>
  84. </Grid.RowDefinitions>
  85. <Grid x:Name="GdAccountName" Grid.Row="0">
  86. <Grid.ColumnDefinitions>
  87. <ColumnDefinition Width="120"/>
  88. <ColumnDefinition/>
  89. </Grid.ColumnDefinitions>
  90. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
  91. <TextBlock Text="Login Name" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="12" FontFamily="Arial" VerticalAlignment="Center"/>
  92. </Border>
  93. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,1,1,1" Background="{DynamicResource Table_BG_Content}" Grid.Column="1" Padding="5,1">
  94. <controls:TextBoxEx Text="{Binding TreeSelectedAccount.DisplayAccountName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{StaticResource ValidationTemplate}" HorizontalContentAlignment="Left" TextSaved="{Binding Mode=TwoWay, Path=TreeSelectedAccount.AccountTextSaved }" x:Name="TbAccountName"
  95. IsEnabled="{Binding Mode=TwoWay, Path=TreeSelectedAccount.IsEnableChangeAccountName }"
  96. HorizontalAlignment="Left" VerticalAlignment="Top" MaxLength="50" Width="200">
  97. <i:Interaction.Triggers>
  98. <i:EventTrigger EventName="TextChanged">
  99. <micro:ActionMessage MethodName="OnAccountChanged">
  100. </micro:ActionMessage>
  101. </i:EventTrigger>
  102. </i:Interaction.Triggers>
  103. </controls:TextBoxEx>
  104. </Border>
  105. </Grid>
  106. <Grid x:Name="GdNewPassword" Grid.Row="1">
  107. <Grid.ColumnDefinitions>
  108. <ColumnDefinition Width="120"/>
  109. <ColumnDefinition/>
  110. </Grid.ColumnDefinitions>
  111. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
  112. <TextBlock Text="New Password" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="12" FontFamily="Arial" VerticalAlignment="Center"/>
  113. </Border>
  114. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Grid.Column="1" Padding="5,1">
  115. <PasswordBox Name="pwNewPassword" HorizontalAlignment="Left" MaxLength="50" Width="200">
  116. <i:Interaction.Triggers>
  117. <i:EventTrigger EventName="PasswordChanged">
  118. <micro:ActionMessage MethodName="OnAccountChanged">
  119. </micro:ActionMessage>
  120. </i:EventTrigger>
  121. </i:Interaction.Triggers>
  122. </PasswordBox>
  123. </Border>
  124. </Grid>
  125. <Grid x:Name="GdConfirmPassword" Grid.Row="2">
  126. <Grid.ColumnDefinitions>
  127. <ColumnDefinition Width="120"/>
  128. <ColumnDefinition/>
  129. </Grid.ColumnDefinitions>
  130. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
  131. <TextBlock Text="Confirm Password" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="12" FontFamily="Arial" VerticalAlignment="Center"/>
  132. </Border>
  133. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Grid.Column="1" Padding="5,1">
  134. <PasswordBox Name="pwConfirmPassword" HorizontalAlignment="Left" MaxLength="50" Width="200">
  135. <i:Interaction.Triggers>
  136. <i:EventTrigger EventName="PasswordChanged">
  137. <micro:ActionMessage MethodName="OnAccountChanged">
  138. </micro:ActionMessage>
  139. </i:EventTrigger>
  140. </i:Interaction.Triggers>
  141. </PasswordBox>
  142. </Border>
  143. </Grid>
  144. <Grid x:Name="GdFirstName" Grid.Row="3">
  145. <Grid.ColumnDefinitions>
  146. <ColumnDefinition Width="120"/>
  147. <ColumnDefinition/>
  148. </Grid.ColumnDefinitions>
  149. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
  150. <TextBlock Text="First Name" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="12" FontFamily="Arial" VerticalAlignment="Center"/>
  151. </Border>
  152. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Grid.Column="1" Padding="5,1">
  153. <controls:TextBoxEx Text="{Binding TreeSelectedAccount.DisplayFirstName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{StaticResource ValidationTemplate}" HorizontalContentAlignment="Stretch" TextSaved="{Binding Mode=TwoWay, Path=TreeSelectedAccount.FirstNameTextSaved }" x:Name="TbFirstName"
  154. HorizontalAlignment="Left" VerticalAlignment="Top" MaxLength="50" Width="200">
  155. <i:Interaction.Triggers>
  156. <i:EventTrigger EventName="TextChanged">
  157. <micro:ActionMessage MethodName="OnAccountChanged">
  158. </micro:ActionMessage>
  159. </i:EventTrigger>
  160. </i:Interaction.Triggers>
  161. </controls:TextBoxEx>
  162. </Border>
  163. </Grid>
  164. <Grid x:Name="GdLastName" Grid.Row="4">
  165. <Grid.ColumnDefinitions>
  166. <ColumnDefinition Width="120"/>
  167. <ColumnDefinition/>
  168. </Grid.ColumnDefinitions>
  169. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
  170. <TextBlock Text="Last Name" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="12" FontFamily="Arial" VerticalAlignment="Center"/>
  171. </Border>
  172. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Grid.Column="1" Padding="5,1">
  173. <controls:TextBoxEx Text="{Binding TreeSelectedAccount.DisplayLastName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{StaticResource ValidationTemplate}" HorizontalContentAlignment="Stretch" TextSaved="{Binding Mode=TwoWay, Path=TreeSelectedAccount.LastNameTextSaved }" x:Name="TbLastName"
  174. HorizontalAlignment="Left" VerticalAlignment="Top" MaxLength="50" Width="200">
  175. <i:Interaction.Triggers>
  176. <i:EventTrigger EventName="TextChanged">
  177. <micro:ActionMessage MethodName="OnAccountChanged">
  178. </micro:ActionMessage>
  179. </i:EventTrigger>
  180. </i:Interaction.Triggers>
  181. </controls:TextBoxEx>
  182. </Border>
  183. </Grid>
  184. <Grid x:Name="GdEmail" Grid.Row="5">
  185. <Grid.ColumnDefinitions>
  186. <ColumnDefinition Width="120"/>
  187. <ColumnDefinition/>
  188. </Grid.ColumnDefinitions>
  189. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
  190. <TextBlock Text="Email" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="12" FontFamily="Arial" VerticalAlignment="Center"/>
  191. </Border>
  192. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Grid.Column="1" Padding="5,1">
  193. <controls:TextBoxEx Text="{Binding TreeSelectedAccount.DisplayEmail,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{StaticResource ValidationTemplate}" HorizontalContentAlignment="Stretch" TextSaved="{Binding Mode=TwoWay, Path=TreeSelectedAccount.EmailTextSaved }" x:Name="TbEmail"
  194. HorizontalAlignment="Left" VerticalAlignment="Top" MaxLength="50" Width="200">
  195. <i:Interaction.Triggers>
  196. <i:EventTrigger EventName="TextChanged">
  197. <micro:ActionMessage MethodName="OnAccountChanged">
  198. </micro:ActionMessage>
  199. </i:EventTrigger>
  200. </i:Interaction.Triggers>
  201. </controls:TextBoxEx>
  202. </Border>
  203. </Grid>
  204. <Grid x:Name="GdDescription" Grid.Row="6">
  205. <Grid.ColumnDefinitions>
  206. <ColumnDefinition Width="120"/>
  207. <ColumnDefinition/>
  208. </Grid.ColumnDefinitions>
  209. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Title}" Padding="5,1">
  210. <TextBlock Text="Description" TextWrapping="Wrap" Foreground="{DynamicResource FG_Black}" FontSize="12" FontFamily="Arial" VerticalAlignment="Center"/>
  211. </Border>
  212. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="0,0,1,1" Background="{DynamicResource Table_BG_Content}" Grid.Column="1" Padding="5,1">
  213. <controls:TextBoxEx Text="{Binding TreeSelectedAccount.DisplayDescription,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{StaticResource ValidationTemplate}" HorizontalContentAlignment="Stretch" TextSaved="{Binding Mode=TwoWay, Path=TreeSelectedAccount.DescriptionTextSaved }" x:Name="TbDescription"
  214. HorizontalAlignment="Left" VerticalAlignment="Top" MaxLength="50" MinWidth="200">
  215. <i:Interaction.Triggers>
  216. <i:EventTrigger EventName="TextChanged">
  217. <micro:ActionMessage MethodName="OnAccountChanged">
  218. </micro:ActionMessage>
  219. </i:EventTrigger>
  220. </i:Interaction.Triggers>
  221. </controls:TextBoxEx>
  222. </Border>
  223. </Grid>
  224. </Grid>
  225. <TabControl Grid.Row="2" Margin="0,10,10,0">
  226. <TabItem>
  227. <TabItem.Header>
  228. <TextBlock Text="Role Status" FontWeight="Bold"/>
  229. </TabItem.Header>
  230. <ListView Name="RolesStatusList" AlternationCount="2" ItemsSource="{Binding Path=TreeSelectedAccount.RoleColleciton}" VerticalAlignment="Top">
  231. <ListView.View>
  232. <GridView>
  233. <GridViewColumn Width="250" Header="Role" DisplayMemberBinding="{Binding RoleName}" />
  234. <GridViewColumn Width="300" Header="Status">
  235. <GridViewColumn.CellTemplate>
  236. <DataTemplate >
  237. <CheckBox IsChecked="{Binding DisplayRoleStatus}" >
  238. <i:Interaction.Triggers>
  239. <i:EventTrigger EventName="Click">
  240. <micro:ActionMessage MethodName="OnAccountChanged">
  241. </micro:ActionMessage>
  242. </i:EventTrigger>
  243. </i:Interaction.Triggers>
  244. </CheckBox>
  245. </DataTemplate>
  246. </GridViewColumn.CellTemplate>
  247. </GridViewColumn>
  248. </GridView>
  249. </ListView.View>
  250. </ListView>
  251. </TabItem>
  252. </TabControl>
  253. </Grid>
  254. <StackPanel Grid.Row="1" Grid.ColumnSpan="2" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
  255. <Button Content="Create" Style="{StaticResource ViewEnabledBtn}" Command="{Binding BtnAddAccountCommand}" Height="25" Width="80" />
  256. <Button Content="Delete" Style="{StaticResource ViewEnabledBtn}" Command="{Binding BtnDeleteAccountCommand}" Height="25" Width="80" Margin="10,0,0,0"/>
  257. <Button Content="Clone" Style="{StaticResource ViewEnabledBtn}" Command="{Binding BtnCloneAccountCommand}" Height="25" Width="80" Margin="10,0,0,0"/>
  258. <Button Content="Save" Style="{StaticResource EditEnabledBtn}" Command="{Binding BtnSaveAccountCommand}" Height="25" Width="80" Margin="10,0,0,0"/>
  259. <Button Content="Cancel" Style="{StaticResource EditEnabledBtn}" Command="{Binding BtnCancelAccountCommand}" Height="25" Width="80" Margin="10,0,0,0"/>
  260. </StackPanel>
  261. </Grid>
  262. </Grid>
  263. </UserControl>