Squashed 'FSI.Lib/' content from commit 6aa4846
git-subtree-dir: FSI.Lib git-subtree-split: 6aa48465a834a7bfdd9cbeae8d2e4f769d0c0ff8
This commit is contained in:
54
FSI.Lib/Guis/AutoPw/FrmMain.xaml
Normal file
54
FSI.Lib/Guis/AutoPw/FrmMain.xaml
Normal file
@@ -0,0 +1,54 @@
|
||||
<Window x:Class="FSI.Lib.Guis.AutoPw.FrmMain"
|
||||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:FSI.Lib.Guis.AutoPw"
|
||||
mc:Ignorable="d"
|
||||
Title="Passwort eingeben"
|
||||
SizeToContent="WidthAndHeight"
|
||||
Height="Auto"
|
||||
Width="Auto"
|
||||
Icon="../../Icons/FondiumU.ico"
|
||||
WindowStyle="ToolWindow">
|
||||
|
||||
<Grid FocusManager.FocusedElement="{Binding ElementName=TbPw}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Passwort:"
|
||||
Margin="5 5" />
|
||||
<PasswordBox x:Name="TbPw"
|
||||
Margin=" 5 5 5 5"
|
||||
MinWidth="150"
|
||||
PasswordChanged="TbPw_PasswordChanged"
|
||||
KeyDown="TbPw_KeyDown"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1"
|
||||
Orientation="Horizontal">
|
||||
<Button x:Name="BtnOk"
|
||||
Content="Ok"
|
||||
MinWidth="75"
|
||||
Click="BtnOk_Click"
|
||||
Margin="5 5 " />
|
||||
|
||||
<Button x:Name="BtnCancel"
|
||||
Content="Abbruch"
|
||||
MinWidth="75"
|
||||
Click="BtnCancel_Click"
|
||||
Margin="5 5 " />
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StatusBar Grid.Row="2">
|
||||
<StatusBarItem HorizontalAlignment="Right">
|
||||
<TextBlock Text="{Binding CurrentTime}" />
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</Window>
|
||||
79
FSI.Lib/Guis/AutoPw/FrmMain.xaml.cs
Normal file
79
FSI.Lib/Guis/AutoPw/FrmMain.xaml.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
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.Shapes;
|
||||
|
||||
namespace FSI.Lib.Guis.AutoPw
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für FrmMain.xaml
|
||||
/// </summary>
|
||||
public partial class FrmMain : Window
|
||||
{
|
||||
public bool CloseAtLostFocus { get; set; }
|
||||
public bool PwOk { get; set; }
|
||||
public FrmMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
BtnOk.IsEnabled = false;
|
||||
Deactivated += FrmMain_Deactivated;
|
||||
DataContext = new MVVM.ViewModel.CurrentTimeViewModel();
|
||||
}
|
||||
|
||||
private void FrmMain_Deactivated(object sender, System.EventArgs e)
|
||||
{
|
||||
if (CloseAtLostFocus)
|
||||
Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
private void BtnOk_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void BtnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Close();
|
||||
PwOk = false;
|
||||
}
|
||||
|
||||
|
||||
private void TbPw_PasswordChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
if (((PasswordBox)sender).Password.Equals(DateTime.Now.ToString("yyyyMMdd")))
|
||||
{
|
||||
BtnOk.IsEnabled = true;
|
||||
PwOk = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
BtnOk.IsEnabled = false;
|
||||
PwOk = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void TbPw_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (BtnOk.IsEnabled == true)
|
||||
{
|
||||
PwOk = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
PwOk = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user