Merge branch 'feat-v1' of https://github.com/xiangwork/VideoConcat into feat-v1
This commit is contained in:
commit
949deef9e4
76
Helpers/PasswordBoxHelper.cs
Normal file
76
Helpers/PasswordBoxHelper.cs
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
// PasswordBoxHelper.cs
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace VideoConcat.Helpers
|
||||||
|
{
|
||||||
|
public static class PasswordBoxHelper
|
||||||
|
{
|
||||||
|
public static readonly DependencyProperty BoundPasswordProperty =
|
||||||
|
DependencyProperty.RegisterAttached("BoundPassword", typeof(string), typeof(PasswordBoxHelper),
|
||||||
|
new PropertyMetadata(string.Empty, OnBoundPasswordChanged));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty BindPasswordProperty =
|
||||||
|
DependencyProperty.RegisterAttached("BindPassword", typeof(bool), typeof(PasswordBoxHelper),
|
||||||
|
new PropertyMetadata(false, OnBindPasswordChanged));
|
||||||
|
|
||||||
|
public static string GetBoundPassword(DependencyObject dp)
|
||||||
|
{
|
||||||
|
return (string)dp.GetValue(BoundPasswordProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetBoundPassword(DependencyObject dp, string value)
|
||||||
|
{
|
||||||
|
dp.SetValue(BoundPasswordProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool GetBindPassword(DependencyObject dp)
|
||||||
|
{
|
||||||
|
return (bool)dp.GetValue(BindPasswordProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetBindPassword(DependencyObject dp, bool value)
|
||||||
|
{
|
||||||
|
dp.SetValue(BindPasswordProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnBoundPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (d is PasswordBox passwordBox)
|
||||||
|
{
|
||||||
|
passwordBox.Password = (string)e.NewValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnBindPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (d is not PasswordBox passwordBox)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((bool)e.OldValue)
|
||||||
|
{
|
||||||
|
passwordBox.PasswordChanged -= PasswordChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((bool)e.NewValue)
|
||||||
|
{
|
||||||
|
passwordBox.PasswordChanged += PasswordChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void PasswordChanged(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is PasswordBox passwordBox)
|
||||||
|
{
|
||||||
|
var boundPassword = GetBoundPassword(passwordBox);
|
||||||
|
if (passwordBox.Password != boundPassword)
|
||||||
|
{
|
||||||
|
SetBoundPassword(passwordBox, passwordBox.Password);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,32 +4,38 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:helpers="clr-namespace:VideoConcat.Helpers"
|
||||||
xmlns:local="clr-namespace:VideoConcat"
|
xmlns:local="clr-namespace:VideoConcat"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="登录" Height="300" Width="500"
|
Title="登录"
|
||||||
ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
|
Height="300"
|
||||||
>
|
Width="500"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
WindowStartupLocation="CenterScreen">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/>
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/>
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"/>
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Red.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Red.xaml"/>
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml"/>
|
||||||
|
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Grid >
|
<Grid>
|
||||||
<Border>
|
<Border>
|
||||||
<StackPanel Orientation="Horizontal" >
|
<StackPanel Orientation="Horizontal">
|
||||||
<StackPanel Width="500">
|
<StackPanel Width="500">
|
||||||
<StackPanel >
|
<StackPanel>
|
||||||
<TextBlock Margin="20" FontFamily="Great Vibes"
|
<TextBlock Margin="20"
|
||||||
FontSize="38" TextAlignment="Center">
|
FontFamily="Great Vibes"
|
||||||
|
FontSize="38"
|
||||||
|
TextAlignment="Center">
|
||||||
用户登录
|
用户登录
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<StackPanel Margin="10" Orientation="Horizontal">
|
<StackPanel Margin="10"
|
||||||
|
Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon
|
<materialDesign:PackIcon
|
||||||
Width="30" Height="30"
|
Width="30" Height="30"
|
||||||
Kind="User" Margin="10,0,10,0"/>
|
Kind="User" Margin="10,0,10,0"/>
|
||||||
@ -39,7 +45,8 @@
|
|||||||
SelectionBrush="#FFD94448"
|
SelectionBrush="#FFD94448"
|
||||||
materialDesign:HintAssist.Hint="输入 用户名"/>
|
materialDesign:HintAssist.Hint="输入 用户名"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Margin="10" Orientation="Horizontal">
|
<StackPanel Margin="10"
|
||||||
|
Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon
|
<materialDesign:PackIcon
|
||||||
Width="30" Height="30"
|
Width="30" Height="30"
|
||||||
Kind="Lock" Margin="10,0,10,0"/>
|
Kind="Lock" Margin="10,0,10,0"/>
|
||||||
@ -49,8 +56,17 @@
|
|||||||
CaretBrush="#FFD94448"
|
CaretBrush="#FFD94448"
|
||||||
SelectionBrush="#FFD94448"
|
SelectionBrush="#FFD94448"
|
||||||
materialDesign:HintAssist.Hint="输入 密码"
|
materialDesign:HintAssist.Hint="输入 密码"
|
||||||
x:Name="Password"
|
x:Name="Password"/>
|
||||||
/>
|
<PasswordBox
|
||||||
|
Width="400"
|
||||||
|
Margin="10,0"
|
||||||
|
BorderBrush="White"
|
||||||
|
CaretBrush="#FFD94448"
|
||||||
|
SelectionBrush="#FFD94448"
|
||||||
|
materialDesign:HintAssist.Hint="输入 密码"
|
||||||
|
helpers:PasswordBoxHelper.BindPassword="True"
|
||||||
|
helpers:PasswordBoxHelper.BoundPassword="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
||||||
|
</PasswordBox>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Margin="10" HorizontalAlignment="Center" VerticalAlignment="Center">
|
<StackPanel Margin="10" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
|
|||||||
@ -14,7 +14,7 @@ namespace VideoConcat.Views
|
|||||||
|
|
||||||
private void BtnExit_Click(object sender, RoutedEventArgs e)
|
private void BtnExit_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BtnLogin_Click(object sender, RoutedEventArgs e)
|
private void BtnLogin_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
|
||||||
xmlns:local="clr-namespace:VideoConcat.Views"
|
xmlns:local="clr-namespace:VideoConcat.Views"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="视频拼接" Height="600" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
Title="视频拼接" Height="600" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
|
||||||
@ -48,7 +49,7 @@
|
|||||||
</DataGrid>
|
</DataGrid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user