-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a088d9
commit 893e1b0
Showing
3 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<Window x:Class="WingCryptWPF.PasswordDialog" | ||
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:WingCryptWPF" | ||
mc:Ignorable="d" | ||
Title="Confirm Password" | ||
Height="75" | ||
Width="325" | ||
ResizeMode="CanMinimize" | ||
SizeToContent="WidthAndHeight"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="5"/> | ||
<RowDefinition Height="*"/> | ||
<RowDefinition Height="*"/> | ||
</Grid.RowDefinitions> | ||
|
||
<Grid Grid.Row="1"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*"/> | ||
<ColumnDefinition Width="220"/> | ||
</Grid.ColumnDefinitions> | ||
|
||
<TextBlock Grid.Column="0" Text="Confirm Password:" Padding="5,0" Margin="0, 5"/> | ||
<PasswordBox Grid.Column="1" x:Name="passwordTextBox" Grid.Row="0" Margin="5,0" Height="20" Width="200"/> | ||
</Grid> | ||
|
||
<Grid Grid.Row="2"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*"/> | ||
<ColumnDefinition Width="150"/> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Button x:Name="confirmButton" Grid.Column="1" Margin="5, 5" Padding="5,0" Click="ButtonConfirm_Click">Confirm</Button> | ||
</Grid> | ||
|
||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace WingCryptWPF; | ||
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; | ||
using Microsoft.Win32; | ||
/// <summary> | ||
/// Interaction logic for PasswordDialog.xaml | ||
/// </summary> | ||
public partial class PasswordDialog : Window | ||
{ | ||
public PasswordDialog() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
public string Password => passwordTextBox.Password; | ||
|
||
public static string GetPassword() | ||
{ | ||
PasswordDialog passwordDialog = new(); | ||
|
||
if (passwordDialog.ShowDialog() == true) | ||
{ | ||
return passwordDialog.Password; | ||
} | ||
else throw new Exception("Cancelled."); | ||
} | ||
|
||
private void ButtonConfirm_Click(object sender, RoutedEventArgs e) | ||
{ | ||
DialogResult = true; | ||
} | ||
} |