mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Password generation button with display toggle and indicator is now a user control
SetCredentials user controls now uses PasswordGenerationBox user control Some layout improvements in EntryDetailsPage WIP Clipboard suspend issues
This commit is contained in:
@@ -8,14 +8,11 @@
|
|||||||
<Setter Property="BorderBrush" Value="{ThemeResource ComboBoxBorderThemeBrush}" />
|
<Setter Property="BorderBrush" Value="{ThemeResource ComboBoxBorderThemeBrush}" />
|
||||||
<Setter Property="BorderThickness" Value="{ThemeResource TextControlBorderThemeThickness}" />
|
<Setter Property="BorderThickness" Value="{ThemeResource TextControlBorderThemeThickness}" />
|
||||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
||||||
<Setter Property="FontSize" Value="{ThemeResource SearchBoxContentThemeFontSize}" />
|
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
|
||||||
<Setter Property="FontWeight" Value="{ThemeResource SearchBoxContentThemeFontWeight}"/>
|
<Setter Property="FontWeight" Value="{ThemeResource SearchBoxContentThemeFontWeight}"/>
|
||||||
<Setter Property="Foreground" Value="{ThemeResource SearchBoxForegroundThemeBrush}" />
|
<Setter Property="Foreground" Value="{ThemeResource SearchBoxForegroundThemeBrush}" />
|
||||||
<Setter Property="Padding" Value="{ThemeResource SearchBoxThemePadding}"/>
|
<Setter Property="Padding" Value="{ThemeResource SearchBoxThemePadding}"/>
|
||||||
<Setter Property="IsTabStop" Value="False" />
|
<Setter Property="IsTabStop" Value="False" />
|
||||||
<Setter Property="Width" Value="350" />
|
|
||||||
<Setter Property="Height" Value="32" />
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
|
||||||
<Setter Property="Typography.StylisticSet20" Value="True"/>
|
<Setter Property="Typography.StylisticSet20" Value="True"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
@@ -299,7 +296,7 @@
|
|||||||
FontSize="{TemplateBinding FontSize}"
|
FontSize="{TemplateBinding FontSize}"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Style="{StaticResource ActionButtonStyle}"
|
Style="{StaticResource ActionButtonStyle}"
|
||||||
Content="{TemplateBinding ButtonSymbol}"
|
Content="{TemplateBinding ButtonContent}"
|
||||||
Command="{TemplateBinding ButtonCommand}"
|
Command="{TemplateBinding ButtonCommand}"
|
||||||
CommandParameter="{TemplateBinding ButtonCommandParameter}">
|
CommandParameter="{TemplateBinding ButtonCommandParameter}">
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
|
@@ -204,8 +204,8 @@
|
|||||||
<data name="EntryPassword.Text" xml:space="preserve">
|
<data name="EntryPassword.Text" xml:space="preserve">
|
||||||
<value>Password</value>
|
<value>Password</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="EntryShowPassword.Content" xml:space="preserve">
|
<data name="EntryShowPassword.OnContent" xml:space="preserve">
|
||||||
<value>Show password</value>
|
<value>Hide password</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="GroupCreateEntry.Text" xml:space="preserve">
|
<data name="GroupCreateEntry.Text" xml:space="preserve">
|
||||||
<value>Create new entry</value>
|
<value>Create new entry</value>
|
||||||
@@ -564,4 +564,10 @@
|
|||||||
<data name="SettingsCopyExpiration.Text" xml:space="preserve">
|
<data name="SettingsCopyExpiration.Text" xml:space="preserve">
|
||||||
<value>Delete copied value from clipboard after how many seconds ?</value>
|
<value>Delete copied value from clipboard after how many seconds ?</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="EntryShowPassword.OffContent" xml:space="preserve">
|
||||||
|
<value>Show password</value>
|
||||||
|
</data>
|
||||||
|
<data name="PasswordGenerationButton.ButtonContent" xml:space="preserve">
|
||||||
|
<value>Random</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@@ -204,9 +204,6 @@
|
|||||||
<data name="EntryPassword.Text" xml:space="preserve">
|
<data name="EntryPassword.Text" xml:space="preserve">
|
||||||
<value>Mot de passe</value>
|
<value>Mot de passe</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="EntryShowPassword.Content" xml:space="preserve">
|
|
||||||
<value>Afficher le mot de passe</value>
|
|
||||||
</data>
|
|
||||||
<data name="GroupCreateEntry.Text" xml:space="preserve">
|
<data name="GroupCreateEntry.Text" xml:space="preserve">
|
||||||
<value>Créer une nouvelle entrée</value>
|
<value>Créer une nouvelle entrée</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -564,4 +561,13 @@
|
|||||||
<data name="EntryAddAdditionalField.Text" xml:space="preserve">
|
<data name="EntryAddAdditionalField.Text" xml:space="preserve">
|
||||||
<value>Ajouter un champ</value>
|
<value>Ajouter un champ</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="EntryShowPassword.OffContent" xml:space="preserve">
|
||||||
|
<value>Afficher le mot de passe</value>
|
||||||
|
</data>
|
||||||
|
<data name="EntryShowPassword.OnContent" xml:space="preserve">
|
||||||
|
<value>Cacher le mot de passe</value>
|
||||||
|
</data>
|
||||||
|
<data name="PasswordGenerationButton.ButtonContent" xml:space="preserve">
|
||||||
|
<value>Aléatoire</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@@ -26,8 +26,6 @@ using ModernKeePass.Application.Group.Commands.AddEntry;
|
|||||||
using ModernKeePass.Application.Group.Commands.DeleteEntry;
|
using ModernKeePass.Application.Group.Commands.DeleteEntry;
|
||||||
using ModernKeePass.Application.Group.Commands.RemoveEntry;
|
using ModernKeePass.Application.Group.Commands.RemoveEntry;
|
||||||
using ModernKeePass.Application.Group.Queries.GetGroup;
|
using ModernKeePass.Application.Group.Queries.GetGroup;
|
||||||
using ModernKeePass.Application.Security.Commands.GeneratePassword;
|
|
||||||
using ModernKeePass.Application.Security.Queries.EstimatePasswordComplexity;
|
|
||||||
using ModernKeePass.Domain.Enums;
|
using ModernKeePass.Domain.Enums;
|
||||||
using ModernKeePass.Application.Group.Models;
|
using ModernKeePass.Application.Group.Models;
|
||||||
using ModernKeePass.Common;
|
using ModernKeePass.Common;
|
||||||
@@ -42,58 +40,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
public class EntryDetailVm : ViewModelBase
|
public class EntryDetailVm : ViewModelBase
|
||||||
{
|
{
|
||||||
public bool HasExpired => HasExpirationDate && ExpiryDate < DateTime.Now;
|
public bool HasExpired => HasExpirationDate && ExpiryDate < DateTime.Now;
|
||||||
public double PasswordComplexityIndicator => _mediator.Send(new EstimatePasswordComplexityQuery {Password = Password}).GetAwaiter().GetResult();
|
|
||||||
public double PasswordLength
|
|
||||||
{
|
|
||||||
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.PasswordLength, 25); }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_settings.PutSetting(Constants.Settings.PasswordGenerationOptions.PasswordLength, value);
|
|
||||||
RaisePropertyChanged(nameof(PasswordLength));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public bool UpperCasePatternSelected
|
|
||||||
{
|
|
||||||
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.UpperCasePattern, true); }
|
|
||||||
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.UpperCasePattern, value); }
|
|
||||||
}
|
|
||||||
public bool LowerCasePatternSelected
|
|
||||||
{
|
|
||||||
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.LowerCasePattern, true); }
|
|
||||||
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.LowerCasePattern, value); }
|
|
||||||
}
|
|
||||||
public bool DigitsPatternSelected
|
|
||||||
{
|
|
||||||
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.DigitsPattern, true); }
|
|
||||||
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.DigitsPattern, value); }
|
|
||||||
}
|
|
||||||
public bool MinusPatternSelected
|
|
||||||
{
|
|
||||||
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.MinusPattern, false); }
|
|
||||||
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.MinusPattern, value); }
|
|
||||||
}
|
|
||||||
public bool UnderscorePatternSelected
|
|
||||||
{
|
|
||||||
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.UnderscorePattern, false); }
|
|
||||||
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.UnderscorePattern, value); }
|
|
||||||
}
|
|
||||||
public bool SpacePatternSelected
|
|
||||||
{
|
|
||||||
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.SpacePattern, false); }
|
|
||||||
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.SpacePattern, value); }
|
|
||||||
}
|
|
||||||
public bool SpecialPatternSelected
|
|
||||||
{
|
|
||||||
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.SpecialPattern, true); }
|
|
||||||
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.SpecialPattern, value); }
|
|
||||||
}
|
|
||||||
public bool BracketsPatternSelected
|
|
||||||
{
|
|
||||||
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.BracketsPattern, false); }
|
|
||||||
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.BracketsPattern, value); }
|
|
||||||
}
|
|
||||||
public string CustomChars { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
public string Id => SelectedItem.Id;
|
public string Id => SelectedItem.Id;
|
||||||
|
|
||||||
public string ParentGroupName => _parent.Title;
|
public string ParentGroupName => _parent.Title;
|
||||||
@@ -124,7 +71,6 @@ namespace ModernKeePass.ViewModels
|
|||||||
Set(() => SelectedItem, ref _selectedItem, value, true);
|
Set(() => SelectedItem, ref _selectedItem, value, true);
|
||||||
if (value != null)
|
if (value != null)
|
||||||
{
|
{
|
||||||
//AdditionalFields = new ObservableCollection<FieldVm>(SelectedItem.AdditionalFields);
|
|
||||||
AdditionalFields =
|
AdditionalFields =
|
||||||
new ObservableCollection<EntryFieldVm>(
|
new ObservableCollection<EntryFieldVm>(
|
||||||
SelectedItem.AdditionalFields.Select(f =>
|
SelectedItem.AdditionalFields.Select(f =>
|
||||||
@@ -166,13 +112,6 @@ namespace ModernKeePass.ViewModels
|
|||||||
{
|
{
|
||||||
Set(() => AdditionalFieldSelectedIndex, ref _additionalFieldSelectedIndex, value);
|
Set(() => AdditionalFieldSelectedIndex, ref _additionalFieldSelectedIndex, value);
|
||||||
DeleteAdditionalField.RaiseCanExecuteChanged();
|
DeleteAdditionalField.RaiseCanExecuteChanged();
|
||||||
/*if (value != -1)
|
|
||||||
{
|
|
||||||
var additionalField = AdditionalFields[value];
|
|
||||||
Set(nameof(AdditionalFieldName), ref _additionalFieldName, additionalField.Name);
|
|
||||||
Set(nameof(AdditionalFieldValue), ref _additionalFieldValue, additionalField.IsProtected ? _cryptography.UnProtect(additionalField.Value).GetAwaiter().GetResult() : additionalField.Value);
|
|
||||||
Set(nameof(AdditionalFieldIsProtected), ref _additionalFieldIsProtected, additionalField.IsProtected);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +146,6 @@ namespace ModernKeePass.ViewModels
|
|||||||
SetFieldValue(nameof(Password), protectedPassword, true).ConfigureAwait(false).GetAwaiter();
|
SetFieldValue(nameof(Password), protectedPassword, true).ConfigureAwait(false).GetAwaiter();
|
||||||
|
|
||||||
RaisePropertyChanged(nameof(Password));
|
RaisePropertyChanged(nameof(Password));
|
||||||
RaisePropertyChanged(nameof(PasswordComplexityIndicator));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,49 +241,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
set { Set(() => IsEditMode, ref _isEditMode, value); }
|
set { Set(() => IsEditMode, ref _isEditMode, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsRevealPassword
|
|
||||||
{
|
|
||||||
get { return _isRevealPassword; }
|
|
||||||
set { Set(() => IsRevealPassword, ref _isRevealPassword, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/*private string _additionalFieldName;
|
|
||||||
private string _additionalFieldValue;
|
|
||||||
private bool _additionalFieldIsProtected;
|
|
||||||
|
|
||||||
public string AdditionalFieldName
|
|
||||||
{
|
|
||||||
get { return _additionalFieldName; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
var newName = EntryFieldName.StandardFieldNames.Contains(value) ? $"{value}_1" : value;
|
|
||||||
UpdateFieldName(_additionalFieldName, newName, AdditionalFieldValue, AdditionalFieldIsProtected).ConfigureAwait(false).GetAwaiter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string AdditionalFieldValue
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _additionalFieldValue;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetFieldValue(AdditionalFieldName, value, AdditionalFieldIsProtected).ConfigureAwait(false).GetAwaiter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AdditionalFieldIsProtected
|
|
||||||
{
|
|
||||||
get { return _additionalFieldIsProtected; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetFieldValue(AdditionalFieldName, AdditionalFieldValue, value).ConfigureAwait(false).GetAwaiter();
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public RelayCommand SaveCommand { get; }
|
public RelayCommand SaveCommand { get; }
|
||||||
public RelayCommand GeneratePasswordCommand { get; }
|
|
||||||
public RelayCommand<string> MoveCommand { get; }
|
public RelayCommand<string> MoveCommand { get; }
|
||||||
public RelayCommand RestoreCommand { get; }
|
public RelayCommand RestoreCommand { get; }
|
||||||
public RelayCommand DeleteCommand { get; }
|
public RelayCommand DeleteCommand { get; }
|
||||||
@@ -365,17 +261,15 @@ namespace ModernKeePass.ViewModels
|
|||||||
private readonly IDialogService _dialog;
|
private readonly IDialogService _dialog;
|
||||||
private readonly INotificationService _notification;
|
private readonly INotificationService _notification;
|
||||||
private readonly IFileProxy _file;
|
private readonly IFileProxy _file;
|
||||||
private readonly ISettingsProxy _settings;
|
|
||||||
private readonly ICryptographyClient _cryptography;
|
private readonly ICryptographyClient _cryptography;
|
||||||
private GroupVm _parent;
|
private GroupVm _parent;
|
||||||
private EntryVm _selectedItem;
|
private EntryVm _selectedItem;
|
||||||
private int _selectedIndex;
|
private int _selectedIndex;
|
||||||
private int _additionalFieldSelectedIndex = -1;
|
private int _additionalFieldSelectedIndex = -1;
|
||||||
private bool _isEditMode;
|
private bool _isEditMode;
|
||||||
private bool _isRevealPassword;
|
|
||||||
private bool _isDirty;
|
private bool _isDirty;
|
||||||
|
|
||||||
public EntryDetailVm(IMediator mediator, INavigationService navigation, IResourceProxy resource, IDialogService dialog, INotificationService notification, IFileProxy file, ISettingsProxy settings, ICryptographyClient cryptography)
|
public EntryDetailVm(IMediator mediator, INavigationService navigation, IResourceProxy resource, IDialogService dialog, INotificationService notification, IFileProxy file, ICryptographyClient cryptography)
|
||||||
{
|
{
|
||||||
_mediator = mediator;
|
_mediator = mediator;
|
||||||
_navigation = navigation;
|
_navigation = navigation;
|
||||||
@@ -383,11 +277,9 @@ namespace ModernKeePass.ViewModels
|
|||||||
_dialog = dialog;
|
_dialog = dialog;
|
||||||
_notification = notification;
|
_notification = notification;
|
||||||
_file = file;
|
_file = file;
|
||||||
_settings = settings;
|
|
||||||
_cryptography = cryptography;
|
_cryptography = cryptography;
|
||||||
|
|
||||||
SaveCommand = new RelayCommand(async () => await SaveChanges(), () => Database.IsDirty);
|
SaveCommand = new RelayCommand(async () => await SaveChanges(), () => Database.IsDirty);
|
||||||
GeneratePasswordCommand = new RelayCommand(async () => await GeneratePassword());
|
|
||||||
MoveCommand = new RelayCommand<string>(async destination => await Move(destination), destination => _parent != null && !string.IsNullOrEmpty(destination) && destination != _parent.Id);
|
MoveCommand = new RelayCommand<string>(async destination => await Move(destination), destination => _parent != null && !string.IsNullOrEmpty(destination) && destination != _parent.Id);
|
||||||
RestoreCommand = new RelayCommand(async () => await RestoreHistory());
|
RestoreCommand = new RelayCommand(async () => await RestoreHistory());
|
||||||
DeleteCommand = new RelayCommand(async () => await AskForDelete());
|
DeleteCommand = new RelayCommand(async () => await AskForDelete());
|
||||||
@@ -402,6 +294,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
MessengerInstance.Register<DatabaseSavedMessage>(this, _ => SaveCommand.RaiseCanExecuteChanged());
|
MessengerInstance.Register<DatabaseSavedMessage>(this, _ => SaveCommand.RaiseCanExecuteChanged());
|
||||||
MessengerInstance.Register<EntryFieldValueChangedMessage>(this, async message => await SetFieldValue(message.FieldName, message.FieldValue, message.IsProtected));
|
MessengerInstance.Register<EntryFieldValueChangedMessage>(this, async message => await SetFieldValue(message.FieldName, message.FieldValue, message.IsProtected));
|
||||||
MessengerInstance.Register<EntryFieldNameChangedMessage>(this, async message => await UpdateFieldName(message.OldName, message.NewName, message.Value, message.IsProtected));
|
MessengerInstance.Register<EntryFieldNameChangedMessage>(this, async message => await UpdateFieldName(message.OldName, message.NewName, message.Value, message.IsProtected));
|
||||||
|
MessengerInstance.Register<PasswordGeneratedMessage>(this, message => Password = message.Password);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Initialize(string entryId)
|
public async Task Initialize(string entryId)
|
||||||
@@ -421,23 +314,6 @@ namespace ModernKeePass.ViewModels
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task GeneratePassword()
|
|
||||||
{
|
|
||||||
Password = await _mediator.Send(new GeneratePasswordCommand
|
|
||||||
{
|
|
||||||
BracketsPatternSelected = BracketsPatternSelected,
|
|
||||||
CustomChars = CustomChars,
|
|
||||||
DigitsPatternSelected = DigitsPatternSelected,
|
|
||||||
LowerCasePatternSelected = LowerCasePatternSelected,
|
|
||||||
MinusPatternSelected = MinusPatternSelected,
|
|
||||||
PasswordLength = (int)PasswordLength,
|
|
||||||
SpacePatternSelected = SpacePatternSelected,
|
|
||||||
SpecialPatternSelected = SpecialPatternSelected,
|
|
||||||
UnderscorePatternSelected = UnderscorePatternSelected,
|
|
||||||
UpperCasePatternSelected = UpperCasePatternSelected
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task AddHistory()
|
public async Task AddHistory()
|
||||||
{
|
{
|
||||||
if (_isDirty) await _mediator.Send(new AddHistoryCommand { Entry = History[0] });
|
if (_isDirty) await _mediator.Send(new AddHistoryCommand { Entry = History[0] });
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
||||||
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
||||||
xmlns:actions="using:ModernKeePass.Actions"
|
xmlns:actions="using:ModernKeePass.Actions"
|
||||||
xmlns:userControls="using:ModernKeePass.Views.UserControls"
|
xmlns:controls="using:ModernKeePass.Views.UserControls"
|
||||||
x:Class="ModernKeePass.Views.EntryDetailPage"
|
x:Class="ModernKeePass.Views.EntryDetailPage"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
SizeChanged="EntryDetailPage_OnSizeChanged"
|
SizeChanged="EntryDetailPage_OnSizeChanged"
|
||||||
@@ -16,346 +16,6 @@
|
|||||||
<Page.Resources>
|
<Page.Resources>
|
||||||
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||||
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter" />
|
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter" />
|
||||||
<converters:ProgressBarLegalValuesConverter x:Key="ProgressBarLegalValuesConverter" />
|
|
||||||
<converters:DoubleToSolidColorBrushConverter x:Key="DoubleToForegroundBrushComplexityConverter" />
|
|
||||||
|
|
||||||
<Style TargetType="local:PasswordBoxWithButton" x:Key="PasswordBoxWithButtonStyle">
|
|
||||||
<Setter Property="Background" Value="{ThemeResource SearchBoxBackgroundThemeBrush}" />
|
|
||||||
<Setter Property="BorderBrush" Value="{ThemeResource ComboBoxBorderThemeBrush}" />
|
|
||||||
<Setter Property="BorderThickness" Value="{ThemeResource TextControlBorderThemeThickness}" />
|
|
||||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
|
||||||
<Setter Property="FontSize" Value="{ThemeResource SearchBoxContentThemeFontSize}" />
|
|
||||||
<Setter Property="FontWeight" Value="{ThemeResource SearchBoxContentThemeFontWeight}"/>
|
|
||||||
<Setter Property="Foreground" Value="{ThemeResource SearchBoxForegroundThemeBrush}" />
|
|
||||||
<Setter Property="Padding" Value="{ThemeResource SearchBoxThemePadding}"/>
|
|
||||||
<Setter Property="IsTabStop" Value="False" />
|
|
||||||
<Setter Property="Width" Value="350" />
|
|
||||||
<Setter Property="Height" Value="32" />
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
|
||||||
<Setter Property="Typography.StylisticSet20" Value="True"/>
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate TargetType="local:PasswordBoxWithButton">
|
|
||||||
<Grid x:Name="SearchBoxGrid">
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
|
||||||
<VisualStateGroup x:Name="CommonStates">
|
|
||||||
<VisualState x:Name="Normal">
|
|
||||||
<Storyboard>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxGrid" Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxBorder" Storyboard.TargetProperty="BorderBrush">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
<VisualState x:Name="PointerOver">
|
|
||||||
<Storyboard>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxGrid" Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxPointerOverBackgroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxBorder" Storyboard.TargetProperty="BorderBrush">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxPointerOverBorderThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxPointerOverTextThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
<VisualState x:Name="Disabled">
|
|
||||||
<Storyboard>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxGrid" Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxDisabledBackgroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxBorder" Storyboard.TargetProperty="BorderBrush">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxDisabledBorderThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxDisabledTextThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PasswordBox" Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
<VisualState x:Name="Focused">
|
|
||||||
<Storyboard>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxGrid" Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxFocusedBackgroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxBorder" Storyboard.TargetProperty="BorderBrush">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource MainColor}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxButtonForegroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxFocusedBorderThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
<VisualState x:Name="FocusedDropDown">
|
|
||||||
<Storyboard>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxGrid" Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxFocusedBackgroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxBorder" Storyboard.TargetProperty="BorderBrush">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxFocusedBorderThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxFocusedTextThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
</VisualStateGroup>
|
|
||||||
</VisualStateManager.VisualStateGroups>
|
|
||||||
<Grid.Resources>
|
|
||||||
<Style x:Key="ActionButtonStyle" TargetType="Button">
|
|
||||||
<Setter Property="IsTabStop" Value="False" />
|
|
||||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate TargetType="Button">
|
|
||||||
<Grid Background="Transparent">
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
|
||||||
<VisualStateGroup x:Name="CommonStates">
|
|
||||||
<VisualState x:Name="Normal" />
|
|
||||||
<VisualState x:Name="PointerOver">
|
|
||||||
<Storyboard>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchGlyph" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxButtonPointerOverForegroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButtonBackground" Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxButtonPointerOverBackgroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
<VisualState x:Name="Pressed">
|
|
||||||
<Storyboard>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchGlyph" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxFocusedTextThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButtonBackground" Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxFocusedBackgroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
<VisualState x:Name="Disabled" />
|
|
||||||
</VisualStateGroup>
|
|
||||||
<VisualStateGroup x:Name="FocusStates">
|
|
||||||
<VisualState x:Name="Focused" />
|
|
||||||
<VisualState x:Name="Unfocused" />
|
|
||||||
<VisualState x:Name="PointerFocused" />
|
|
||||||
</VisualStateGroup>
|
|
||||||
</VisualStateManager.VisualStateGroups>
|
|
||||||
<Grid x:Name="ActionButtonBackground" Background="{TemplateBinding Background}">
|
|
||||||
<TextBlock x:Name="SearchGlyph"
|
|
||||||
AutomationProperties.AccessibilityView="Raw"
|
|
||||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
|
||||||
Foreground="{TemplateBinding Foreground}"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
FontStyle="Normal"
|
|
||||||
Padding="4,0,4,0"
|
|
||||||
Text="{TemplateBinding Content}"
|
|
||||||
VerticalAlignment="Center" />
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
<Style x:Key="PasswordBoxStyle" TargetType="PasswordBox">
|
|
||||||
<Setter Property="MinWidth" Value="{ThemeResource TextControlThemeMinWidth}" />
|
|
||||||
<Setter Property="MinHeight" Value="{ThemeResource TextControlThemeMinHeight}" />
|
|
||||||
<Setter Property="Foreground" Value="{ThemeResource TextBoxForegroundThemeBrush}" />
|
|
||||||
<Setter Property="Background" Value="{ThemeResource TextBoxBackgroundThemeBrush}" />
|
|
||||||
<Setter Property="BorderBrush" Value="{ThemeResource TextBoxBorderThemeBrush}" />
|
|
||||||
<Setter Property="SelectionHighlightColor" Value="{ThemeResource TextSelectionHighlightColorThemeBrush}" />
|
|
||||||
<Setter Property="BorderThickness" Value="{ThemeResource TextControlBorderThemeThickness}" />
|
|
||||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
|
||||||
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
|
|
||||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
|
|
||||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
|
|
||||||
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
|
|
||||||
<Setter Property="Padding" Value="{ThemeResource TextControlThemePadding}"/>
|
|
||||||
<Setter Property="Template">
|
|
||||||
<Setter.Value>
|
|
||||||
<ControlTemplate TargetType="PasswordBox">
|
|
||||||
<Grid>
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
|
||||||
<VisualStateGroup x:Name="CommonStates">
|
|
||||||
<VisualState x:Name="Disabled">
|
|
||||||
<Storyboard>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement"
|
|
||||||
Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxDisabledBackgroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
|
|
||||||
Storyboard.TargetProperty="BorderBrush">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxDisabledBorderThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement"
|
|
||||||
Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxDisabledForegroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter"
|
|
||||||
Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxDisabledForegroundThemeBrush}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
<VisualState x:Name="Normal">
|
|
||||||
<Storyboard>
|
|
||||||
<DoubleAnimation Storyboard.TargetName="BackgroundElement"
|
|
||||||
Storyboard.TargetProperty="Opacity"
|
|
||||||
Duration="0"
|
|
||||||
To="{ThemeResource TextControlBackgroundThemeOpacity}" />
|
|
||||||
<DoubleAnimation Storyboard.TargetName="BorderElement"
|
|
||||||
Storyboard.TargetProperty="Opacity"
|
|
||||||
Duration="0"
|
|
||||||
To="{ThemeResource TextControlBorderThemeOpacity}" />
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
<VisualState x:Name="PointerOver">
|
|
||||||
<Storyboard>
|
|
||||||
<DoubleAnimation Storyboard.TargetName="BackgroundElement"
|
|
||||||
Storyboard.TargetProperty="Opacity"
|
|
||||||
Duration="0"
|
|
||||||
To="{ThemeResource TextControlPointerOverBackgroundThemeOpacity}" />
|
|
||||||
<DoubleAnimation Storyboard.TargetName="BorderElement"
|
|
||||||
Storyboard.TargetProperty="Opacity"
|
|
||||||
Duration="0"
|
|
||||||
To="{ThemeResource TextControlPointerOverBorderThemeOpacity}" />
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
<VisualState x:Name="Focused" />
|
|
||||||
</VisualStateGroup>
|
|
||||||
<VisualStateGroup x:Name="ButtonStates" />
|
|
||||||
</VisualStateManager.VisualStateGroups>
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Border x:Name="BackgroundElement"
|
|
||||||
Grid.Row="1"
|
|
||||||
Background="{TemplateBinding Background}"
|
|
||||||
Margin="{TemplateBinding BorderThickness}" />
|
|
||||||
<Border x:Name="BorderElement"
|
|
||||||
Grid.Row="1"
|
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
|
||||||
BorderThickness="{TemplateBinding BorderThickness}" />
|
|
||||||
<ContentPresenter x:Name="HeaderContentPresenter"
|
|
||||||
Grid.Row="0"
|
|
||||||
Foreground="{ThemeResource TextBoxForegroundHeaderThemeBrush}"
|
|
||||||
Margin="0,4,0,4"
|
|
||||||
Content="{TemplateBinding Header}"
|
|
||||||
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
|
||||||
FontWeight="Semilight" />
|
|
||||||
<ScrollViewer x:Name="ContentElement"
|
|
||||||
Grid.Row="1"
|
|
||||||
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
|
|
||||||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
|
||||||
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
|
|
||||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
|
||||||
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
|
|
||||||
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
|
|
||||||
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
|
||||||
Margin="{TemplateBinding BorderThickness}"
|
|
||||||
Padding="{TemplateBinding Padding}"
|
|
||||||
IsTabStop="False"
|
|
||||||
AutomationProperties.AccessibilityView="Raw"
|
|
||||||
ZoomMode="Disabled" />
|
|
||||||
<ContentControl x:Name="PlaceholderTextContentPresenter"
|
|
||||||
Grid.Row="1"
|
|
||||||
Foreground="{ThemeResource TextBoxPlaceholderTextThemeBrush}"
|
|
||||||
Margin="{TemplateBinding BorderThickness}"
|
|
||||||
Padding="{TemplateBinding Padding}"
|
|
||||||
IsTabStop="False"
|
|
||||||
Grid.ColumnSpan="2"
|
|
||||||
Content="{TemplateBinding PlaceholderText}"
|
|
||||||
IsHitTestVisible="False" />
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
</Grid.Resources>
|
|
||||||
<Border x:Name="SearchBoxBorder"
|
|
||||||
Background="Transparent"
|
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
|
||||||
BorderThickness="{TemplateBinding BorderThickness}">
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition Width="Auto" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<PasswordBox x:Name="PasswordBox"
|
|
||||||
BorderThickness="0"
|
|
||||||
Background="Transparent"
|
|
||||||
FontFamily="{TemplateBinding FontFamily}"
|
|
||||||
FontSize="{TemplateBinding FontSize}"
|
|
||||||
FontWeight="{TemplateBinding FontWeight}"
|
|
||||||
Foreground="{TemplateBinding Foreground}"
|
|
||||||
MaxLength="2048"
|
|
||||||
MinHeight="{ThemeResource SearchBoxTextBoxThemeMinHeight}"
|
|
||||||
Padding="{TemplateBinding Padding}"
|
|
||||||
PlaceholderText="{TemplateBinding PlaceholderText}"
|
|
||||||
Style="{StaticResource PasswordBoxStyle}"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
Margin="0"
|
|
||||||
Password="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Path=Password}"
|
|
||||||
IsPasswordRevealButtonEnabled="{TemplateBinding IsPasswordRevealEnabled}"/>
|
|
||||||
<Button x:Name="ActionButton"
|
|
||||||
AutomationProperties.AccessibilityView="Raw"
|
|
||||||
Background="Transparent"
|
|
||||||
FontWeight="{ThemeResource SearchBoxButtonThemeFontWeight}"
|
|
||||||
FontSize="{TemplateBinding FontSize}"
|
|
||||||
Grid.Column="1"
|
|
||||||
Style="{StaticResource ActionButtonStyle}"
|
|
||||||
Content="{TemplateBinding ButtonSymbol}"
|
|
||||||
IsEnabled="{TemplateBinding IsButtonEnabled}">
|
|
||||||
<Button.Flyout>
|
|
||||||
<Flyout>
|
|
||||||
<interactivity:Interaction.Behaviors>
|
|
||||||
<core:DataTriggerBehavior Binding="{Binding Password}" ComparisonCondition="NotEqual" Value="" >
|
|
||||||
<core:CallMethodAction MethodName="Hide" />
|
|
||||||
</core:DataTriggerBehavior>
|
|
||||||
</interactivity:Interaction.Behaviors>
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock>
|
|
||||||
<Run x:Uid="PasswordGeneratorLength" />
|
|
||||||
<Run Text="{Binding PasswordLength}" />
|
|
||||||
</TextBlock>
|
|
||||||
<Slider Value="{Binding PasswordLength, Mode=TwoWay}" Margin="0,-10,0,-20" />
|
|
||||||
<CheckBox IsChecked="{Binding UpperCasePatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorUpper" />
|
|
||||||
<CheckBox IsChecked="{Binding LowerCasePatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorLower" />
|
|
||||||
<CheckBox IsChecked="{Binding DigitsPatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorDigits" />
|
|
||||||
<CheckBox IsChecked="{Binding MinusPatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorMinus" />
|
|
||||||
<CheckBox IsChecked="{Binding UnderscorePatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorUnderscore" />
|
|
||||||
<CheckBox IsChecked="{Binding SpacePatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorSpace" />
|
|
||||||
<CheckBox IsChecked="{Binding SpecialPatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorSpecial" />
|
|
||||||
<CheckBox IsChecked="{Binding BracketsPatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorBrackets" />
|
|
||||||
<TextBlock x:Uid="PasswordGeneratorAlso" Margin="0,5,0,0"/>
|
|
||||||
<TextBox Text="{Binding CustomChars, Mode=TwoWay}" />
|
|
||||||
<Button x:Uid="PasswordGeneratorButton" Command="{Binding GeneratePasswordCommand}" />
|
|
||||||
</StackPanel>
|
|
||||||
</Flyout>
|
|
||||||
</Button.Flyout>
|
|
||||||
<ToolTipService.ToolTip>
|
|
||||||
<ToolTip x:Uid="PasswordGeneratorTooltip" />
|
|
||||||
</ToolTipService.ToolTip>
|
|
||||||
</Button>
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
|
||||||
</Setter.Value>
|
|
||||||
</Setter>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
</Page.Resources>
|
</Page.Resources>
|
||||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||||
<Grid.ChildrenTransitions>
|
<Grid.ChildrenTransitions>
|
||||||
@@ -372,7 +32,7 @@
|
|||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<userControls:HamburgerMenuUserControl
|
<controls:HamburgerMenuUserControl
|
||||||
x:Name="HamburgerMenu"
|
x:Name="HamburgerMenu"
|
||||||
x:Uid="HistoryLeftListView"
|
x:Uid="HistoryLeftListView"
|
||||||
ItemsSource="{Binding History}"
|
ItemsSource="{Binding History}"
|
||||||
@@ -390,7 +50,7 @@
|
|||||||
<HubSection x:Uid="EntryHubMain">
|
<HubSection x:Uid="EntryHubMain">
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||||
<StackPanel Margin="20,0,0,20" MinWidth="400">
|
<StackPanel Width="350" Margin="0,0,25,0">
|
||||||
<StackPanel.Resources>
|
<StackPanel.Resources>
|
||||||
<Style TargetType="CheckBox">
|
<Style TargetType="CheckBox">
|
||||||
<Setter Property="Margin" Value="0,20,0,0"/>
|
<Setter Property="Margin" Value="0,20,0,0"/>
|
||||||
@@ -398,7 +58,7 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</StackPanel.Resources>
|
</StackPanel.Resources>
|
||||||
<TextBlock x:Uid="EntryLogin" Style="{StaticResource EntryTextBlockStyle}" />
|
<TextBlock x:Uid="EntryLogin" Style="{StaticResource EntryTextBlockStyle}" />
|
||||||
<local:TextBoxWithButton x:Uid="LoginTextBox" Text="{Binding UserName, Mode=TwoWay}" Style="{StaticResource TextBoxWithButtonStyle}" ButtonSymbol="" IsEnabled="{Binding IsCurrentEntry}">
|
<local:TextBoxWithButton x:Uid="LoginTextBox" Text="{Binding UserName, Mode=TwoWay}" Style="{StaticResource TextBoxWithButtonStyle}" ButtonContent="" IsEnabled="{Binding IsCurrentEntry}">
|
||||||
<interactivity:Interaction.Behaviors>
|
<interactivity:Interaction.Behaviors>
|
||||||
<core:EventTriggerBehavior EventName="ButtonClick">
|
<core:EventTriggerBehavior EventName="ButtonClick">
|
||||||
<actions:ClipboardAction Text="{Binding UserName}" />
|
<actions:ClipboardAction Text="{Binding UserName}" />
|
||||||
@@ -407,19 +67,9 @@
|
|||||||
</interactivity:Interaction.Behaviors>
|
</interactivity:Interaction.Behaviors>
|
||||||
</local:TextBoxWithButton>
|
</local:TextBoxWithButton>
|
||||||
<TextBlock x:Uid="EntryPassword" Style="{StaticResource EntryTextBlockStyle}" />
|
<TextBlock x:Uid="EntryPassword" Style="{StaticResource EntryTextBlockStyle}" />
|
||||||
<local:PasswordBoxWithButton Password="{Binding Password, Mode=TwoWay}" IsPasswordRevealEnabled="True" Visibility="{Binding IsRevealPassword, Converter={StaticResource InverseBooleanToVisibilityConverter}}" Style="{StaticResource PasswordBoxWithButtonStyle}" IsEnabled="{Binding IsCurrentEntry}" ButtonSymbol="" />
|
<controls:PasswordGenerationBox Password="{Binding Password, Mode=TwoWay}" IsEnabled="{Binding IsCurrentEntry}" />
|
||||||
<local:TextBoxWithButton x:Uid="PasswordTextBox" Text="{Binding Password, Mode=TwoWay}" Visibility="{Binding IsRevealPassword, Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource TextBoxWithButtonStyle}" ButtonSymbol="" IsEnabled="{Binding IsCurrentEntry}">
|
|
||||||
<interactivity:Interaction.Behaviors>
|
|
||||||
<core:EventTriggerBehavior EventName="ButtonClick">
|
|
||||||
<actions:ClipboardAction Text="{Binding Password}" />
|
|
||||||
<actions:ToastAction x:Uid="ToastCopyPassword" Title="{Binding Title}" />
|
|
||||||
</core:EventTriggerBehavior>
|
|
||||||
</interactivity:Interaction.Behaviors>
|
|
||||||
</local:TextBoxWithButton>
|
|
||||||
<ProgressBar Value="{Binding PasswordComplexityIndicator, ConverterParameter=0\,128, Converter={StaticResource ProgressBarLegalValuesConverter}}" Maximum="128" Width="350" HorizontalAlignment="Left" Foreground="{Binding PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToForegroundBrushComplexityConverter}}" />
|
|
||||||
<CheckBox x:Uid="EntryShowPassword" HorizontalAlignment="Left" Margin="-3,0,0,0" IsChecked="{Binding IsRevealPassword, Mode=TwoWay}" />
|
|
||||||
<TextBlock Text="URL" Style="{StaticResource EntryTextBlockStyle}"/>
|
<TextBlock Text="URL" Style="{StaticResource EntryTextBlockStyle}"/>
|
||||||
<local:TextBoxWithButton x:Uid="UrlTextBox" Text="{Binding Url, Mode=TwoWay}" Style="{StaticResource TextBoxWithButtonStyle}" ButtonSymbol="" IsEnabled="{Binding IsCurrentEntry}">
|
<local:TextBoxWithButton x:Uid="UrlTextBox" Text="{Binding Url, Mode=TwoWay}" Style="{StaticResource TextBoxWithButtonStyle}" ButtonContent="" IsEnabled="{Binding IsCurrentEntry}">
|
||||||
<interactivity:Interaction.Behaviors>
|
<interactivity:Interaction.Behaviors>
|
||||||
<core:EventTriggerBehavior EventName="ButtonClick">
|
<core:EventTriggerBehavior EventName="ButtonClick">
|
||||||
<actions:NavigateToUrlAction Url="{Binding Url}" />
|
<actions:NavigateToUrlAction Url="{Binding Url}" />
|
||||||
@@ -427,8 +77,8 @@
|
|||||||
</interactivity:Interaction.Behaviors>
|
</interactivity:Interaction.Behaviors>
|
||||||
</local:TextBoxWithButton>
|
</local:TextBoxWithButton>
|
||||||
<TextBlock x:Uid="EntryNotes" Style="{StaticResource EntryTextBlockStyle}" />
|
<TextBlock x:Uid="EntryNotes" Style="{StaticResource EntryTextBlockStyle}" />
|
||||||
<TextBox HorizontalAlignment="Left" TextWrapping="Wrap" Text="{Binding Notes, Mode=TwoWay}" Width="350" Height="200" AcceptsReturn="True" IsSpellCheckEnabled="True" IsEnabled="{Binding IsCurrentEntry}" />
|
<TextBox TextWrapping="Wrap" Text="{Binding Notes, Mode=TwoWay}" Width="350" Height="200" AcceptsReturn="True" IsSpellCheckEnabled="True" IsEnabled="{Binding IsCurrentEntry}" />
|
||||||
<CheckBox x:Uid="EntryExpirationDate" IsChecked="{Binding HasExpirationDate, Mode=TwoWay}" IsEnabled="{Binding IsCurrentEntry}" />
|
<CheckBox x:Uid="EntryExpirationDate" Margin="-3,0,0,0" IsChecked="{Binding HasExpirationDate, Mode=TwoWay}" IsEnabled="{Binding IsCurrentEntry}" />
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
@@ -470,11 +120,11 @@
|
|||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<TextBlock x:Uid="EntryIcon" Style="{StaticResource EntryTextBlockStyle}" />
|
<TextBlock x:Uid="EntryIcon" Style="{StaticResource EntryTextBlockStyle}" />
|
||||||
<userControls:SymbolPickerUserControl SelectedSymbol="{Binding Icon, Mode=TwoWay}" HorizontalAlignment="Left" IsEnabled="{Binding IsCurrentEntry}" />
|
<controls:SymbolPickerUserControl SelectedSymbol="{Binding Icon, Mode=TwoWay}" HorizontalAlignment="Left" IsEnabled="{Binding IsCurrentEntry}" />
|
||||||
<TextBlock x:Uid="EntryBackgroundColor" Style="{StaticResource EntryTextBlockStyle}" />
|
<TextBlock x:Uid="EntryBackgroundColor" Style="{StaticResource EntryTextBlockStyle}" />
|
||||||
<userControls:ColorPickerUserControl SelectedColor="{Binding BackgroundColor, Mode=TwoWay}" IsEnabled="{Binding IsCurrentEntry}" Width="250" />
|
<controls:ColorPickerUserControl SelectedColor="{Binding BackgroundColor, Mode=TwoWay}" IsEnabled="{Binding IsCurrentEntry}" Width="250" />
|
||||||
<TextBlock x:Uid="EntryForegroundColor" Style="{StaticResource EntryTextBlockStyle}" />
|
<TextBlock x:Uid="EntryForegroundColor" Style="{StaticResource EntryTextBlockStyle}" />
|
||||||
<userControls:ColorPickerUserControl SelectedColor="{Binding ForegroundColor, Mode=TwoWay}" IsEnabled="{Binding IsCurrentEntry}" Width="250" />
|
<controls:ColorPickerUserControl SelectedColor="{Binding ForegroundColor, Mode=TwoWay}" IsEnabled="{Binding IsCurrentEntry}" Width="250" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</HubSection>
|
</HubSection>
|
||||||
@@ -612,7 +262,7 @@
|
|||||||
</core:DataTriggerBehavior>
|
</core:DataTriggerBehavior>
|
||||||
</interactivity:Interaction.Behaviors>
|
</interactivity:Interaction.Behaviors>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
<userControls:TopMenuUserControl
|
<controls:TopMenuUserControl
|
||||||
x:Name="TopMenu" Grid.Column="4"
|
x:Name="TopMenu" Grid.Column="4"
|
||||||
IsEditButtonChecked="{Binding IsEditMode, Mode=TwoWay}"
|
IsEditButtonChecked="{Binding IsEditMode, Mode=TwoWay}"
|
||||||
MoveButtonVisibility="{Binding IsCurrentEntry, Converter={StaticResource BooleanToVisibilityConverter}}"
|
MoveButtonVisibility="{Binding IsCurrentEntry, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||||
@@ -626,7 +276,7 @@
|
|||||||
<actions:SetupFocusAction TargetObject="{Binding ElementName=TitleTextBox}" />
|
<actions:SetupFocusAction TargetObject="{Binding ElementName=TitleTextBox}" />
|
||||||
</core:EventTriggerBehavior>
|
</core:EventTriggerBehavior>
|
||||||
</interactivity:Interaction.Behaviors>
|
</interactivity:Interaction.Behaviors>
|
||||||
</userControls:TopMenuUserControl>
|
</controls:TopMenuUserControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
@@ -14,7 +14,7 @@ namespace ModernKeePass.Views
|
|||||||
public sealed partial class EntryDetailPage
|
public sealed partial class EntryDetailPage
|
||||||
{
|
{
|
||||||
public EntryDetailVm Model => (EntryDetailVm) DataContext;
|
public EntryDetailVm Model => (EntryDetailVm) DataContext;
|
||||||
|
|
||||||
public EntryDetailPage()
|
public EntryDetailPage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -29,7 +29,6 @@ namespace ModernKeePass.Views
|
|||||||
{
|
{
|
||||||
await Model.Initialize(args.Id);
|
await Model.Initialize(args.Id);
|
||||||
Model.IsEditMode = args.IsNew;
|
Model.IsEditMode = args.IsNew;
|
||||||
if (args.IsNew) await Model.GeneratePassword();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -142,7 +142,7 @@
|
|||||||
ButtonCommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Text}"
|
ButtonCommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Text}"
|
||||||
Style="{StaticResource TextBoxWithButtonStyle}"
|
Style="{StaticResource TextBoxWithButtonStyle}"
|
||||||
KeyDown="NewGroupTextBox_OnKeyDown"
|
KeyDown="NewGroupTextBox_OnKeyDown"
|
||||||
ButtonSymbol="">
|
ButtonContent="">
|
||||||
<interactivity:Interaction.Behaviors>
|
<interactivity:Interaction.Behaviors>
|
||||||
<core:EventTriggerBehavior EventName="LostFocus">
|
<core:EventTriggerBehavior EventName="LostFocus">
|
||||||
<core:ChangePropertyAction TargetObject="{Binding ElementName=NewGroupButton}" PropertyName="Visibility" Value="Visible" />
|
<core:ChangePropertyAction TargetObject="{Binding ElementName=NewGroupButton}" PropertyName="Visibility" Value="Visible" />
|
||||||
|
384
ModernKeePass/Views/UserControls/PasswordGenerationBox.xaml
Normal file
384
ModernKeePass/Views/UserControls/PasswordGenerationBox.xaml
Normal file
@@ -0,0 +1,384 @@
|
|||||||
|
<UserControl x:Name="UserControl"
|
||||||
|
x:Class="ModernKeePass.Views.UserControls.PasswordGenerationBox"
|
||||||
|
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:controls="using:ModernKeePass.Controls"
|
||||||
|
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
||||||
|
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
||||||
|
xmlns:converters="using:ModernKeePass.Converters"
|
||||||
|
xmlns:actions="using:ModernKeePass.Actions"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
BorderBrush="{ThemeResource ComboBoxBorderThemeBrush}">
|
||||||
|
<StackPanel x:Name="StackPanel" Orientation="Vertical" DataContext="{Binding Source={StaticResource Locator}, Path=PasswordGenerationBox}">
|
||||||
|
<StackPanel.Resources>
|
||||||
|
<converters:ProgressBarLegalValuesConverter x:Key="ProgressBarLegalValuesConverter" />
|
||||||
|
<converters:DoubleToSolidColorBrushConverter x:Key="DoubleToForegroundBrushComplexityConverter" />
|
||||||
|
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||||
|
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter" />
|
||||||
|
<Style TargetType="controls:PasswordBoxWithButton" x:Key="PasswordBoxWithButtonStyle">
|
||||||
|
<Setter Property="Background" Value="{ThemeResource SearchBoxBackgroundThemeBrush}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{ThemeResource ComboBoxBorderThemeBrush}" />
|
||||||
|
<Setter Property="BorderThickness" Value="{ThemeResource TextControlBorderThemeThickness}" />
|
||||||
|
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
||||||
|
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
|
||||||
|
<Setter Property="FontWeight" Value="{ThemeResource SearchBoxContentThemeFontWeight}"/>
|
||||||
|
<Setter Property="Foreground" Value="{ThemeResource SearchBoxForegroundThemeBrush}" />
|
||||||
|
<Setter Property="Padding" Value="{ThemeResource SearchBoxThemePadding}"/>
|
||||||
|
<Setter Property="IsTabStop" Value="False" />
|
||||||
|
<Setter Property="Typography.StylisticSet20" Value="True"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="controls:PasswordBoxWithButton">
|
||||||
|
<Grid x:Name="SearchBoxGrid">
|
||||||
|
<VisualStateManager.VisualStateGroups>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxGrid" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxBorder" Storyboard.TargetProperty="BorderBrush">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Foreground}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="PointerOver">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxGrid" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxPointerOverBackgroundThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxBorder" Storyboard.TargetProperty="BorderBrush">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxPointerOverBorderThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxPointerOverTextThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxGrid" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxDisabledBackgroundThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxBorder" Storyboard.TargetProperty="BorderBrush">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxDisabledBorderThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxDisabledTextThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PasswordBox" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Focused">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxGrid" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxFocusedBackgroundThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxBorder" Storyboard.TargetProperty="BorderBrush">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource MainColor}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxButtonForegroundThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxFocusedBorderThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="FocusedDropDown">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxGrid" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxFocusedBackgroundThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchBoxBorder" Storyboard.TargetProperty="BorderBrush">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxFocusedBorderThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxFocusedTextThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
<Grid.Resources>
|
||||||
|
<Style x:Key="ActionButtonStyle" TargetType="Button">
|
||||||
|
<Setter Property="IsTabStop" Value="False" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Grid Background="Transparent">
|
||||||
|
<VisualStateManager.VisualStateGroups>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="PointerOver">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchGlyph" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxButtonPointerOverForegroundThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButtonBackground" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxButtonPointerOverBackgroundThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Pressed">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SearchGlyph" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxFocusedTextThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButtonBackground" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SearchBoxFocusedBackgroundThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Disabled" />
|
||||||
|
</VisualStateGroup>
|
||||||
|
<VisualStateGroup x:Name="FocusStates">
|
||||||
|
<VisualState x:Name="Focused" />
|
||||||
|
<VisualState x:Name="Unfocused" />
|
||||||
|
<VisualState x:Name="PointerFocused" />
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
<Grid x:Name="ActionButtonBackground" Background="{TemplateBinding Background}">
|
||||||
|
<TextBlock x:Name="SearchGlyph"
|
||||||
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
|
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||||
|
Foreground="{TemplateBinding Foreground}"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
FontStyle="Italic"
|
||||||
|
Padding="4,0,4,0"
|
||||||
|
Text="{TemplateBinding Content}"
|
||||||
|
VerticalAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="PasswordBoxStyle" TargetType="PasswordBox">
|
||||||
|
<Setter Property="MinWidth" Value="{ThemeResource TextControlThemeMinWidth}" />
|
||||||
|
<Setter Property="MinHeight" Value="{ThemeResource TextControlThemeMinHeight}" />
|
||||||
|
<Setter Property="Foreground" Value="{ThemeResource TextBoxForegroundThemeBrush}" />
|
||||||
|
<Setter Property="Background" Value="{ThemeResource TextBoxBackgroundThemeBrush}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{ThemeResource TextBoxBorderThemeBrush}" />
|
||||||
|
<Setter Property="SelectionHighlightColor" Value="{ThemeResource TextSelectionHighlightColorThemeBrush}" />
|
||||||
|
<Setter Property="BorderThickness" Value="{ThemeResource TextControlBorderThemeThickness}" />
|
||||||
|
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
||||||
|
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
|
||||||
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden" />
|
||||||
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden" />
|
||||||
|
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
|
||||||
|
<Setter Property="Padding" Value="{ThemeResource TextControlThemePadding}"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="PasswordBox">
|
||||||
|
<Grid>
|
||||||
|
<VisualStateManager.VisualStateGroups>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement"
|
||||||
|
Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxDisabledBackgroundThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
|
||||||
|
Storyboard.TargetProperty="BorderBrush">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxDisabledBorderThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement"
|
||||||
|
Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxDisabledForegroundThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter"
|
||||||
|
Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextBoxDisabledForegroundThemeBrush}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Normal">
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="BackgroundElement"
|
||||||
|
Storyboard.TargetProperty="Opacity"
|
||||||
|
Duration="0"
|
||||||
|
To="{ThemeResource TextControlBackgroundThemeOpacity}" />
|
||||||
|
<DoubleAnimation Storyboard.TargetName="BorderElement"
|
||||||
|
Storyboard.TargetProperty="Opacity"
|
||||||
|
Duration="0"
|
||||||
|
To="{ThemeResource TextControlBorderThemeOpacity}" />
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="PointerOver">
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="BackgroundElement"
|
||||||
|
Storyboard.TargetProperty="Opacity"
|
||||||
|
Duration="0"
|
||||||
|
To="{ThemeResource TextControlPointerOverBackgroundThemeOpacity}" />
|
||||||
|
<DoubleAnimation Storyboard.TargetName="BorderElement"
|
||||||
|
Storyboard.TargetProperty="Opacity"
|
||||||
|
Duration="0"
|
||||||
|
To="{ThemeResource TextControlPointerOverBorderThemeOpacity}" />
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Focused" />
|
||||||
|
</VisualStateGroup>
|
||||||
|
<VisualStateGroup x:Name="ButtonStates" />
|
||||||
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border x:Name="BackgroundElement"
|
||||||
|
Grid.Row="1"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
Margin="{TemplateBinding BorderThickness}" />
|
||||||
|
<Border x:Name="BorderElement"
|
||||||
|
Grid.Row="1"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}" />
|
||||||
|
<ContentPresenter x:Name="HeaderContentPresenter"
|
||||||
|
Grid.Row="0"
|
||||||
|
Foreground="{ThemeResource TextBoxForegroundHeaderThemeBrush}"
|
||||||
|
Margin="0,4,0,4"
|
||||||
|
Content="{TemplateBinding Header}"
|
||||||
|
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||||
|
FontWeight="Semilight" />
|
||||||
|
<ScrollViewer x:Name="ContentElement"
|
||||||
|
Grid.Row="1"
|
||||||
|
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
|
||||||
|
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||||
|
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
|
||||||
|
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
||||||
|
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
|
||||||
|
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
|
||||||
|
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
||||||
|
Margin="{TemplateBinding BorderThickness}"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
IsTabStop="False"
|
||||||
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
|
ZoomMode="Disabled" />
|
||||||
|
<ContentControl x:Name="PlaceholderTextContentPresenter"
|
||||||
|
Grid.Row="1"
|
||||||
|
Foreground="{ThemeResource TextBoxPlaceholderTextThemeBrush}"
|
||||||
|
Margin="{TemplateBinding BorderThickness}"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
IsTabStop="False"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
Content="{TemplateBinding PlaceholderText}"
|
||||||
|
IsHitTestVisible="False" />
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</Grid.Resources>
|
||||||
|
<Border x:Name="SearchBoxBorder"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<PasswordBox x:Name="PasswordBox"
|
||||||
|
BorderThickness="0"
|
||||||
|
Background="Transparent"
|
||||||
|
FontFamily="{TemplateBinding FontFamily}"
|
||||||
|
FontSize="{TemplateBinding FontSize}"
|
||||||
|
FontWeight="{TemplateBinding FontWeight}"
|
||||||
|
Foreground="{TemplateBinding Foreground}"
|
||||||
|
MaxLength="2048"
|
||||||
|
MinHeight="{ThemeResource SearchBoxTextBoxThemeMinHeight}"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
PlaceholderText="{TemplateBinding PlaceholderText}"
|
||||||
|
Style="{StaticResource PasswordBoxStyle}"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
Margin="0"
|
||||||
|
Password="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Path=Password, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
IsPasswordRevealButtonEnabled="{TemplateBinding IsPasswordRevealEnabled}"/>
|
||||||
|
<Button x:Name="ActionButton"
|
||||||
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
|
Background="Transparent"
|
||||||
|
FontWeight="{ThemeResource SearchBoxButtonThemeFontWeight}"
|
||||||
|
FontSize="12"
|
||||||
|
Grid.Column="1"
|
||||||
|
Style="{StaticResource ActionButtonStyle}"
|
||||||
|
Content="{TemplateBinding ButtonContent}"
|
||||||
|
IsEnabled="{TemplateBinding IsButtonEnabled}">
|
||||||
|
<Button.Flyout>
|
||||||
|
<Flyout>
|
||||||
|
<interactivity:Interaction.Behaviors>
|
||||||
|
<core:DataTriggerBehavior Binding="{Binding Password}" ComparisonCondition="NotEqual" Value="" >
|
||||||
|
<core:CallMethodAction MethodName="Hide" />
|
||||||
|
</core:DataTriggerBehavior>
|
||||||
|
</interactivity:Interaction.Behaviors>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock>
|
||||||
|
<Run x:Uid="PasswordGeneratorLength" />
|
||||||
|
<Run Text="{Binding PasswordLength}" />
|
||||||
|
</TextBlock>
|
||||||
|
<Slider Value="{Binding PasswordLength, Mode=TwoWay}" Margin="0,-10,0,-20" />
|
||||||
|
<CheckBox IsChecked="{Binding UpperCasePatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorUpper" />
|
||||||
|
<CheckBox IsChecked="{Binding LowerCasePatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorLower" />
|
||||||
|
<CheckBox IsChecked="{Binding DigitsPatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorDigits" />
|
||||||
|
<CheckBox IsChecked="{Binding MinusPatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorMinus" />
|
||||||
|
<CheckBox IsChecked="{Binding UnderscorePatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorUnderscore" />
|
||||||
|
<CheckBox IsChecked="{Binding SpacePatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorSpace" />
|
||||||
|
<CheckBox IsChecked="{Binding SpecialPatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorSpecial" />
|
||||||
|
<CheckBox IsChecked="{Binding BracketsPatternSelected, Mode=TwoWay}" x:Uid="PasswordGeneratorBrackets" />
|
||||||
|
<TextBlock x:Uid="PasswordGeneratorAlso" Margin="0,5,0,0"/>
|
||||||
|
<TextBox Text="{Binding CustomChars, Mode=TwoWay}" />
|
||||||
|
<Button x:Uid="PasswordGeneratorButton" Command="{Binding GeneratePasswordCommand}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Flyout>
|
||||||
|
</Button.Flyout>
|
||||||
|
<ToolTipService.ToolTip>
|
||||||
|
<ToolTip x:Uid="PasswordGeneratorTooltip" />
|
||||||
|
</ToolTipService.ToolTip>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</StackPanel.Resources>
|
||||||
|
<controls:PasswordBoxWithButton x:Uid="PasswordGenerationButton"
|
||||||
|
Password="{Binding Password, Mode=TwoWay, ElementName=UserControl}"
|
||||||
|
IsPasswordRevealEnabled="True"
|
||||||
|
Style="{StaticResource PasswordBoxWithButtonStyle}"
|
||||||
|
IsEnabled="{Binding IsEnabled, ElementName=UserControl}"
|
||||||
|
PlaceholderText="{Binding PlaceholderText, ElementName=UserControl}"
|
||||||
|
Visibility="{Binding IsRevealPassword, Converter={StaticResource InverseBooleanToVisibilityConverter}}"
|
||||||
|
BorderBrush="{Binding BorderBrush, ElementName=UserControl}" />
|
||||||
|
<controls:TextBoxWithButton
|
||||||
|
x:Uid="PasswordTextBox"
|
||||||
|
Text="{Binding Password, Mode=TwoWay}"
|
||||||
|
Visibility="{Binding IsRevealPassword, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||||
|
Style="{StaticResource TextBoxWithButtonStyle}"
|
||||||
|
ButtonContent=""
|
||||||
|
IsEnabled="{Binding IsEnabled, ElementName=UserControl}"
|
||||||
|
BorderBrush="{Binding BorderBrush, ElementName=UserControl}" >
|
||||||
|
<interactivity:Interaction.Behaviors>
|
||||||
|
<core:EventTriggerBehavior EventName="ButtonClick">
|
||||||
|
<actions:ClipboardAction Text="{Binding Password}" />
|
||||||
|
<actions:ToastAction x:Uid="ToastCopyPassword" Title="Password" />
|
||||||
|
</core:EventTriggerBehavior>
|
||||||
|
</interactivity:Interaction.Behaviors>
|
||||||
|
</controls:TextBoxWithButton>
|
||||||
|
<ProgressBar
|
||||||
|
Value="{Binding PasswordComplexityIndicator, ConverterParameter=0\,128, Converter={StaticResource ProgressBarLegalValuesConverter}}"
|
||||||
|
Maximum="128"
|
||||||
|
Width="{Binding ActualWidth, ElementName=UserControl}"
|
||||||
|
Foreground="{Binding PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToForegroundBrushComplexityConverter}}" />
|
||||||
|
<ToggleSwitch x:Uid="EntryShowPassword" Margin="-3,-10,0,0" IsOn="{Binding IsRevealPassword, Mode=TwoWay}" />
|
||||||
|
</StackPanel>
|
||||||
|
</UserControl>
|
@@ -0,0 +1,44 @@
|
|||||||
|
using Windows.UI.Xaml;
|
||||||
|
using ModernKeePass.ViewModels;
|
||||||
|
|
||||||
|
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
|
||||||
|
|
||||||
|
namespace ModernKeePass.Views.UserControls
|
||||||
|
{
|
||||||
|
public sealed partial class PasswordGenerationBox
|
||||||
|
{
|
||||||
|
public string Password
|
||||||
|
{
|
||||||
|
get { return (string)GetValue(PasswordProperty); }
|
||||||
|
set { SetValue(PasswordProperty, value); }
|
||||||
|
}
|
||||||
|
public static readonly DependencyProperty PasswordProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
nameof(Password),
|
||||||
|
typeof(string),
|
||||||
|
typeof(PasswordGenerationBox),
|
||||||
|
new PropertyMetadata(string.Empty, (o, args) =>
|
||||||
|
{
|
||||||
|
var passwordGenerationBox = o as PasswordGenerationBox;
|
||||||
|
var vm = passwordGenerationBox?.StackPanel.DataContext as PasswordGenerationBoxControlVm;
|
||||||
|
if (vm != null) vm.Password = args.NewValue.ToString();
|
||||||
|
}));
|
||||||
|
|
||||||
|
public string PlaceholderText
|
||||||
|
{
|
||||||
|
get { return (string)GetValue(PlaceholderTextProperty); }
|
||||||
|
set { SetValue(PlaceholderTextProperty, value); }
|
||||||
|
}
|
||||||
|
public static readonly DependencyProperty PlaceholderTextProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
nameof(PlaceholderText),
|
||||||
|
typeof(string),
|
||||||
|
typeof(PasswordGenerationBox),
|
||||||
|
new PropertyMetadata(string.Empty, (o, args) => { }));
|
||||||
|
|
||||||
|
public PasswordGenerationBox()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -7,10 +7,11 @@
|
|||||||
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
|
||||||
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
|
||||||
xmlns:converters="using:ModernKeePass.Converters"
|
xmlns:converters="using:ModernKeePass.Converters"
|
||||||
|
xmlns:userControls="using:ModernKeePass.Views.UserControls"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<converters:ProgressBarLegalValuesConverter x:Key="ProgressBarLegalValuesConverter"/>
|
<!--<converters:ProgressBarLegalValuesConverter x:Key="ProgressBarLegalValuesConverter"/>
|
||||||
<converters:DoubleToSolidColorBrushConverter x:Key="DoubleToSolidColorBrushConverter"/>
|
<converters:DoubleToSolidColorBrushConverter x:Key="DoubleToSolidColorBrushConverter"/>-->
|
||||||
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter"/>
|
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid DataContext="{Binding Source={StaticResource Locator}, Path=SetCredentials}">
|
<Grid DataContext="{Binding Source={StaticResource Locator}, Path=SetCredentials}">
|
||||||
@@ -23,30 +24,36 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="45" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="45" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="40" />
|
<RowDefinition Height="40" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="40" />
|
<RowDefinition Height="40" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<CheckBox Grid.Row="0" Grid.Column="0" IsChecked="{Binding HasPassword, Mode=TwoWay}" />
|
<CheckBox Grid.Row="0" Grid.Column="0" IsChecked="{Binding HasPassword, Mode=TwoWay}" />
|
||||||
<PasswordBox Grid.Row="0" Grid.Column="1" Height="30"
|
<!--<PasswordBox Grid.Row="0" Grid.Column="1" Height="30"
|
||||||
x:Uid="CompositeKeyPassword"
|
x:Uid="CompositeKeyPassword"
|
||||||
x:Name="PasswordBox"
|
x:Name="PasswordBox"
|
||||||
Password="{Binding Password, Mode=TwoWay}"
|
Password="{Binding Password, Mode=TwoWay}"
|
||||||
IsEnabled="{Binding HasPassword}"
|
IsEnabled="{Binding HasPassword}"
|
||||||
IsPasswordRevealButtonEnabled="True" />
|
IsPasswordRevealButtonEnabled="True" />-->
|
||||||
<PasswordBox Grid.Row="1" Grid.Column="1" Height="30"
|
<userControls:PasswordGenerationBox Grid.Row="0" Grid.Column="1"
|
||||||
|
x:Uid="CompositeKeyPassword"
|
||||||
|
x:Name="PasswordBox"
|
||||||
|
Password="{Binding Password, Mode=TwoWay}"
|
||||||
|
IsEnabled="{Binding HasPassword}" />
|
||||||
|
<PasswordBox Grid.Row="1" Grid.Column="1"
|
||||||
x:Uid="CompositeKeyConfirmPassword"
|
x:Uid="CompositeKeyConfirmPassword"
|
||||||
x:Name="ConfirmPasswordBox"
|
x:Name="ConfirmPasswordBox"
|
||||||
|
Margin="0,5,0,0"
|
||||||
Password="{Binding ConfirmPassword, Mode=TwoWay}"
|
Password="{Binding ConfirmPassword, Mode=TwoWay}"
|
||||||
IsEnabled="{Binding HasPassword}"
|
IsEnabled="{Binding HasPassword}"
|
||||||
IsPasswordRevealButtonEnabled="True" />
|
IsPasswordRevealButtonEnabled="True" />
|
||||||
<ProgressBar Grid.Row="1" Grid.Column="1"
|
<!--<ProgressBar Grid.Row="1" Grid.Column="1"
|
||||||
Maximum="128" VerticalAlignment="Bottom"
|
Maximum="128" VerticalAlignment="Bottom"
|
||||||
Value="{Binding PasswordComplexityIndicator, ConverterParameter=0\,128, Converter={StaticResource ProgressBarLegalValuesConverter}}"
|
Value="{Binding PasswordComplexityIndicator, ConverterParameter=0\,128, Converter={StaticResource ProgressBarLegalValuesConverter}}"
|
||||||
Foreground="{Binding PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToSolidColorBrushConverter}}"/>
|
Foreground="{Binding PasswordComplexityIndicator, ConverterParameter=128, Converter={StaticResource DoubleToSolidColorBrushConverter}}"/>-->
|
||||||
<TextBlock Grid.Row="2" Grid.Column="1"
|
<TextBlock Grid.Row="2" Grid.Column="1"
|
||||||
FontSize="14" FontWeight="Light"
|
FontSize="14" FontWeight="Light"
|
||||||
x:Uid="SetCredentialsControlMatchingPasswords"
|
x:Uid="SetCredentialsControlMatchingPasswords"
|
||||||
|
@@ -168,6 +168,9 @@
|
|||||||
<Compile Include="Views\UserControls\HamburgerMenuUserControl.xaml.cs">
|
<Compile Include="Views\UserControls\HamburgerMenuUserControl.xaml.cs">
|
||||||
<DependentUpon>HamburgerMenuUserControl.xaml</DependentUpon>
|
<DependentUpon>HamburgerMenuUserControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\UserControls\PasswordGenerationBox.xaml.cs">
|
||||||
|
<DependentUpon>PasswordGenerationBox.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Views\UserControls\SymbolPickerUserControl.xaml.cs">
|
<Compile Include="Views\UserControls\SymbolPickerUserControl.xaml.cs">
|
||||||
<DependentUpon>SymbolPickerUserControl.xaml</DependentUpon>
|
<DependentUpon>SymbolPickerUserControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -317,6 +320,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Views\UserControls\PasswordGenerationBox.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\UserControls\SymbolPickerUserControl.xaml">
|
<Page Include="Views\UserControls\SymbolPickerUserControl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
@@ -42,6 +42,7 @@ namespace ModernKeePass.Actions
|
|||||||
var dataPackage = new DataPackage { RequestedOperation = DataPackageOperation.Copy };
|
var dataPackage = new DataPackage { RequestedOperation = DataPackageOperation.Copy };
|
||||||
dataPackage.SetText(IsProtected ? cryptography.UnProtect(Text).GetAwaiter().GetResult() : Text);
|
dataPackage.SetText(IsProtected ? cryptography.UnProtect(Text).GetAwaiter().GetResult() : Text);
|
||||||
Clipboard.SetContent(dataPackage);
|
Clipboard.SetContent(dataPackage);
|
||||||
|
Clipboard.Flush();
|
||||||
_dispatcher.Start();
|
_dispatcher.Start();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -49,8 +50,14 @@ namespace ModernKeePass.Actions
|
|||||||
|
|
||||||
private void Dispatcher_Tick(object sender, object e)
|
private void Dispatcher_Tick(object sender, object e)
|
||||||
{
|
{
|
||||||
Clipboard.SetContent(null);
|
try
|
||||||
_dispatcher.Stop();
|
{
|
||||||
|
Clipboard.SetContent(null);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_dispatcher.Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,14 +8,14 @@ namespace ModernKeePass.Controls
|
|||||||
{
|
{
|
||||||
public event EventHandler<RoutedEventArgs> ButtonClick;
|
public event EventHandler<RoutedEventArgs> ButtonClick;
|
||||||
|
|
||||||
public string ButtonSymbol
|
public string ButtonContent
|
||||||
{
|
{
|
||||||
get { return (string)GetValue(ButtonSymbolProperty); }
|
get { return (string)GetValue(ButtonContentProperty); }
|
||||||
set { SetValue(ButtonSymbolProperty, value); }
|
set { SetValue(ButtonContentProperty, value); }
|
||||||
}
|
}
|
||||||
public static readonly DependencyProperty ButtonSymbolProperty =
|
public static readonly DependencyProperty ButtonContentProperty =
|
||||||
DependencyProperty.Register(
|
DependencyProperty.Register(
|
||||||
nameof(ButtonSymbol),
|
nameof(ButtonContent),
|
||||||
typeof(string),
|
typeof(string),
|
||||||
typeof(PasswordBoxWithButton),
|
typeof(PasswordBoxWithButton),
|
||||||
new PropertyMetadata("", (o, args) => { }));
|
new PropertyMetadata("", (o, args) => { }));
|
||||||
|
87
WinAppCommon/Controls/PasswordGenerationBox.cs
Normal file
87
WinAppCommon/Controls/PasswordGenerationBox.cs
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
using System;
|
||||||
|
using Windows.UI.Xaml;
|
||||||
|
using Windows.UI.Xaml.Controls;
|
||||||
|
|
||||||
|
namespace ModernKeePass.Controls
|
||||||
|
{
|
||||||
|
public class PasswordGenerationBox : SearchBox
|
||||||
|
{
|
||||||
|
public event EventHandler<RoutedEventArgs> ButtonClick;
|
||||||
|
|
||||||
|
public string ButtonSymbol
|
||||||
|
{
|
||||||
|
get { return (string)GetValue(ButtonSymbolProperty); }
|
||||||
|
set { SetValue(ButtonSymbolProperty, value); }
|
||||||
|
}
|
||||||
|
public static readonly DependencyProperty ButtonSymbolProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
nameof(ButtonSymbol),
|
||||||
|
typeof(string),
|
||||||
|
typeof(PasswordGenerationBox),
|
||||||
|
new PropertyMetadata("", (o, args) => { }));
|
||||||
|
|
||||||
|
public string ButtonTooltip
|
||||||
|
{
|
||||||
|
get { return (string)GetValue(ButtonTooltipProperty); }
|
||||||
|
set { SetValue(ButtonTooltipProperty, value); }
|
||||||
|
}
|
||||||
|
public static readonly DependencyProperty ButtonTooltipProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
nameof(ButtonTooltip),
|
||||||
|
typeof(string),
|
||||||
|
typeof(PasswordGenerationBox),
|
||||||
|
new PropertyMetadata(string.Empty, (o, args) => { }));
|
||||||
|
|
||||||
|
public string Password
|
||||||
|
{
|
||||||
|
get { return (string)GetValue(PasswordProperty); }
|
||||||
|
set { SetValue(PasswordProperty, value); }
|
||||||
|
}
|
||||||
|
public static readonly DependencyProperty PasswordProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
nameof(Password),
|
||||||
|
typeof(string),
|
||||||
|
typeof(PasswordGenerationBox),
|
||||||
|
new PropertyMetadata(string.Empty, (o, args) => { }));
|
||||||
|
|
||||||
|
public bool IsButtonEnabled
|
||||||
|
{
|
||||||
|
get { return (bool)GetValue(IsButtonEnabledProperty); }
|
||||||
|
set { SetValue(IsButtonEnabledProperty, value); }
|
||||||
|
}
|
||||||
|
public static readonly DependencyProperty IsButtonEnabledProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
nameof(IsButtonEnabled),
|
||||||
|
typeof(bool),
|
||||||
|
typeof(PasswordGenerationBox),
|
||||||
|
new PropertyMetadata(true, (o, args) => { }));
|
||||||
|
|
||||||
|
public bool IsPasswordRevealEnabled
|
||||||
|
{
|
||||||
|
get { return (bool)GetValue(IsPasswordRevealEnabledProperty); }
|
||||||
|
set { SetValue(IsPasswordRevealEnabledProperty, value); }
|
||||||
|
}
|
||||||
|
public static readonly DependencyProperty IsPasswordRevealEnabledProperty =
|
||||||
|
DependencyProperty.Register(
|
||||||
|
nameof(IsPasswordRevealEnabled),
|
||||||
|
typeof(bool),
|
||||||
|
typeof(PasswordGenerationBox),
|
||||||
|
new PropertyMetadata(true, (o, args) => { }));
|
||||||
|
|
||||||
|
|
||||||
|
public PasswordGenerationBox()
|
||||||
|
{
|
||||||
|
DefaultStyleKey = typeof(PasswordGenerationBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnApplyTemplate()
|
||||||
|
{
|
||||||
|
base.OnApplyTemplate();
|
||||||
|
var actionButton = GetTemplateChild("ActionButton") as Button;
|
||||||
|
if (actionButton != null)
|
||||||
|
{
|
||||||
|
actionButton.Click += (sender, e) => ButtonClick?.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -9,14 +9,14 @@ namespace ModernKeePass.Controls
|
|||||||
{
|
{
|
||||||
public event EventHandler<RoutedEventArgs> ButtonClick;
|
public event EventHandler<RoutedEventArgs> ButtonClick;
|
||||||
|
|
||||||
public string ButtonSymbol
|
public string ButtonContent
|
||||||
{
|
{
|
||||||
get { return (string)GetValue(ButtonSymbolProperty); }
|
get { return (string)GetValue(ButtonContentProperty); }
|
||||||
set { SetValue(ButtonSymbolProperty, value); }
|
set { SetValue(ButtonContentProperty, value); }
|
||||||
}
|
}
|
||||||
public static readonly DependencyProperty ButtonSymbolProperty =
|
public static readonly DependencyProperty ButtonContentProperty =
|
||||||
DependencyProperty.Register(
|
DependencyProperty.Register(
|
||||||
nameof(ButtonSymbol),
|
nameof(ButtonContent),
|
||||||
typeof(string),
|
typeof(string),
|
||||||
typeof(TextBoxWithButton),
|
typeof(TextBoxWithButton),
|
||||||
new PropertyMetadata("", (o, args) => { }));
|
new PropertyMetadata("", (o, args) => { }));
|
||||||
|
7
WinAppCommon/Messages/PasswordGeneratedMessage.cs
Normal file
7
WinAppCommon/Messages/PasswordGeneratedMessage.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Messages
|
||||||
|
{
|
||||||
|
public class PasswordGeneratedMessage
|
||||||
|
{
|
||||||
|
public string Password { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,113 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using GalaSoft.MvvmLight;
|
||||||
|
using GalaSoft.MvvmLight.Command;
|
||||||
|
using MediatR;
|
||||||
|
using Messages;
|
||||||
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Security.Commands.GeneratePassword;
|
||||||
|
using ModernKeePass.Common;
|
||||||
|
|
||||||
|
namespace ModernKeePass.ViewModels
|
||||||
|
{
|
||||||
|
public class PasswordGenerationBoxControlVm: ViewModelBase
|
||||||
|
{
|
||||||
|
private readonly IMediator _mediator;
|
||||||
|
private readonly ISettingsProxy _settings;
|
||||||
|
private readonly ICredentialsProxy _credentials;
|
||||||
|
private string _password;
|
||||||
|
private bool _isRevealPassword;
|
||||||
|
|
||||||
|
public double PasswordComplexityIndicator => _credentials.EstimatePasswordComplexity(Password);
|
||||||
|
public double PasswordLength
|
||||||
|
{
|
||||||
|
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.PasswordLength, 25); }
|
||||||
|
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.PasswordLength, value); }
|
||||||
|
}
|
||||||
|
public bool UpperCasePatternSelected
|
||||||
|
{
|
||||||
|
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.UpperCasePattern, true); }
|
||||||
|
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.UpperCasePattern, value); }
|
||||||
|
}
|
||||||
|
public bool LowerCasePatternSelected
|
||||||
|
{
|
||||||
|
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.LowerCasePattern, true); }
|
||||||
|
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.LowerCasePattern, value); }
|
||||||
|
}
|
||||||
|
public bool DigitsPatternSelected
|
||||||
|
{
|
||||||
|
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.DigitsPattern, true); }
|
||||||
|
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.DigitsPattern, value); }
|
||||||
|
}
|
||||||
|
public bool MinusPatternSelected
|
||||||
|
{
|
||||||
|
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.MinusPattern, false); }
|
||||||
|
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.MinusPattern, value); }
|
||||||
|
}
|
||||||
|
public bool UnderscorePatternSelected
|
||||||
|
{
|
||||||
|
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.UnderscorePattern, false); }
|
||||||
|
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.UnderscorePattern, value); }
|
||||||
|
}
|
||||||
|
public bool SpacePatternSelected
|
||||||
|
{
|
||||||
|
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.SpacePattern, false); }
|
||||||
|
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.SpacePattern, value); }
|
||||||
|
}
|
||||||
|
public bool SpecialPatternSelected
|
||||||
|
{
|
||||||
|
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.SpecialPattern, true); }
|
||||||
|
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.SpecialPattern, value); }
|
||||||
|
}
|
||||||
|
public bool BracketsPatternSelected
|
||||||
|
{
|
||||||
|
get { return _settings.GetSetting(Constants.Settings.PasswordGenerationOptions.BracketsPattern, false); }
|
||||||
|
set { _settings.PutSetting(Constants.Settings.PasswordGenerationOptions.BracketsPattern, value); }
|
||||||
|
}
|
||||||
|
public string CustomChars { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Password
|
||||||
|
{
|
||||||
|
get { return _password; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Set(() => Password, ref _password, value);
|
||||||
|
RaisePropertyChanged(() => PasswordComplexityIndicator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsRevealPassword
|
||||||
|
{
|
||||||
|
get { return _isRevealPassword; }
|
||||||
|
set { Set(() => IsRevealPassword, ref _isRevealPassword, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public RelayCommand GeneratePasswordCommand { get; }
|
||||||
|
|
||||||
|
public PasswordGenerationBoxControlVm(IMediator mediator, ISettingsProxy settings, ICredentialsProxy credentials)
|
||||||
|
{
|
||||||
|
_mediator = mediator;
|
||||||
|
_settings = settings;
|
||||||
|
_credentials = credentials;
|
||||||
|
|
||||||
|
GeneratePasswordCommand = new RelayCommand(async () => await GeneratePassword());
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task GeneratePassword()
|
||||||
|
{
|
||||||
|
Password = await _mediator.Send(new GeneratePasswordCommand
|
||||||
|
{
|
||||||
|
BracketsPatternSelected = BracketsPatternSelected,
|
||||||
|
CustomChars = CustomChars,
|
||||||
|
DigitsPatternSelected = DigitsPatternSelected,
|
||||||
|
LowerCasePatternSelected = LowerCasePatternSelected,
|
||||||
|
MinusPatternSelected = MinusPatternSelected,
|
||||||
|
PasswordLength = (int)PasswordLength,
|
||||||
|
SpacePatternSelected = SpacePatternSelected,
|
||||||
|
SpecialPatternSelected = SpecialPatternSelected,
|
||||||
|
UnderscorePatternSelected = UnderscorePatternSelected,
|
||||||
|
UpperCasePatternSelected = UpperCasePatternSelected
|
||||||
|
});
|
||||||
|
MessengerInstance.Send(new PasswordGeneratedMessage { Password = Password });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -13,7 +13,6 @@ namespace ModernKeePass.ViewModels
|
|||||||
public class SetCredentialsVm : ViewModelBase
|
public class SetCredentialsVm : ViewModelBase
|
||||||
{
|
{
|
||||||
private readonly IMediator _mediator;
|
private readonly IMediator _mediator;
|
||||||
private readonly ICredentialsProxy _credentials;
|
|
||||||
private readonly IResourceProxy _resource;
|
private readonly IResourceProxy _resource;
|
||||||
private readonly IFileProxy _file;
|
private readonly IFileProxy _file;
|
||||||
|
|
||||||
@@ -48,10 +47,9 @@ namespace ModernKeePass.ViewModels
|
|||||||
get { return _password; }
|
get { return _password; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_password = value;
|
Set(() => Password, ref _password, value);
|
||||||
RaisePropertyChanged(nameof(IsPasswordValid));
|
RaisePropertyChanged(nameof(IsPasswordValid));
|
||||||
RaisePropertyChanged(nameof(IsValid));
|
RaisePropertyChanged(nameof(IsValid));
|
||||||
RaisePropertyChanged(nameof(PasswordComplexityIndicator));
|
|
||||||
GenerateCredentialsCommand.RaiseCanExecuteChanged();
|
GenerateCredentialsCommand.RaiseCanExecuteChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,7 +58,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
get { return _confirmPassword; }
|
get { return _confirmPassword; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_confirmPassword = value;
|
Set(() => ConfirmPassword, ref _confirmPassword, value);
|
||||||
RaisePropertyChanged(nameof(IsPasswordValid));
|
RaisePropertyChanged(nameof(IsPasswordValid));
|
||||||
RaisePropertyChanged(nameof(IsValid));
|
RaisePropertyChanged(nameof(IsValid));
|
||||||
GenerateCredentialsCommand.RaiseCanExecuteChanged();
|
GenerateCredentialsCommand.RaiseCanExecuteChanged();
|
||||||
@@ -85,8 +83,6 @@ namespace ModernKeePass.ViewModels
|
|||||||
set { Set(() => KeyFileText, ref _keyFileText, value); }
|
set { Set(() => KeyFileText, ref _keyFileText, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public double PasswordComplexityIndicator => _credentials.EstimatePasswordComplexity(Password);
|
|
||||||
|
|
||||||
public bool IsPasswordValid => HasPassword && Password == ConfirmPassword || !HasPassword;
|
public bool IsPasswordValid => HasPassword && Password == ConfirmPassword || !HasPassword;
|
||||||
public bool IsKeyFileValid => HasKeyFile && !string.IsNullOrEmpty(KeyFilePath) || !HasKeyFile;
|
public bool IsKeyFileValid => HasKeyFile && !string.IsNullOrEmpty(KeyFilePath) || !HasKeyFile;
|
||||||
public bool IsValid => HasPassword && Password == ConfirmPassword || HasKeyFile && !string.IsNullOrEmpty(KeyFilePath) && (HasPassword || HasKeyFile);
|
public bool IsValid => HasPassword && Password == ConfirmPassword || HasKeyFile && !string.IsNullOrEmpty(KeyFilePath) && (HasPassword || HasKeyFile);
|
||||||
@@ -102,10 +98,9 @@ namespace ModernKeePass.ViewModels
|
|||||||
private string _keyFilePath;
|
private string _keyFilePath;
|
||||||
private string _keyFileText;
|
private string _keyFileText;
|
||||||
|
|
||||||
public SetCredentialsVm(IMediator mediator, ICredentialsProxy credentials, IResourceProxy resource, IFileProxy file)
|
public SetCredentialsVm(IMediator mediator, IResourceProxy resource, IFileProxy file)
|
||||||
{
|
{
|
||||||
_mediator = mediator;
|
_mediator = mediator;
|
||||||
_credentials = credentials;
|
|
||||||
_resource = resource;
|
_resource = resource;
|
||||||
_file = file;
|
_file = file;
|
||||||
|
|
||||||
@@ -114,6 +109,12 @@ namespace ModernKeePass.ViewModels
|
|||||||
GenerateCredentialsCommand = new RelayCommand(GenerateCredentials, () => IsValid);
|
GenerateCredentialsCommand = new RelayCommand(GenerateCredentials, () => IsValid);
|
||||||
|
|
||||||
_keyFileText = resource.GetResourceValue("CompositeKeyDefaultKeyFile");
|
_keyFileText = resource.GetResourceValue("CompositeKeyDefaultKeyFile");
|
||||||
|
|
||||||
|
MessengerInstance.Register<PasswordGeneratedMessage>(this, message =>
|
||||||
|
{
|
||||||
|
Password = message.Password;
|
||||||
|
ConfirmPassword = message.Password;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OpenKeyFile()
|
private async Task OpenKeyFile()
|
||||||
|
@@ -68,6 +68,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
SimpleIoc.Default.Register<SetCredentialsVm>();
|
SimpleIoc.Default.Register<SetCredentialsVm>();
|
||||||
SimpleIoc.Default.Register<TopMenuVm>();
|
SimpleIoc.Default.Register<TopMenuVm>();
|
||||||
SimpleIoc.Default.Register<ColorPickerControlVm>();
|
SimpleIoc.Default.Register<ColorPickerControlVm>();
|
||||||
|
SimpleIoc.Default.Register<PasswordGenerationBoxControlVm>();
|
||||||
SimpleIoc.Default.Register<NewVm>();
|
SimpleIoc.Default.Register<NewVm>();
|
||||||
SimpleIoc.Default.Register<OpenVm>();
|
SimpleIoc.Default.Register<OpenVm>();
|
||||||
SimpleIoc.Default.Register<RecentVm>();
|
SimpleIoc.Default.Register<RecentVm>();
|
||||||
@@ -84,6 +85,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
public SetCredentialsVm SetCredentials => ServiceLocator.Current.GetInstance<SetCredentialsVm>(Guid.NewGuid().ToString());
|
public SetCredentialsVm SetCredentials => ServiceLocator.Current.GetInstance<SetCredentialsVm>(Guid.NewGuid().ToString());
|
||||||
public TopMenuVm TopMenu => ServiceLocator.Current.GetInstance<TopMenuVm>(Guid.NewGuid().ToString());
|
public TopMenuVm TopMenu => ServiceLocator.Current.GetInstance<TopMenuVm>(Guid.NewGuid().ToString());
|
||||||
public ColorPickerControlVm ColorPicker => ServiceLocator.Current.GetInstance<ColorPickerControlVm>(Guid.NewGuid().ToString());
|
public ColorPickerControlVm ColorPicker => ServiceLocator.Current.GetInstance<ColorPickerControlVm>(Guid.NewGuid().ToString());
|
||||||
|
public PasswordGenerationBoxControlVm PasswordGenerationBox => ServiceLocator.Current.GetInstance<PasswordGenerationBoxControlVm>(Guid.NewGuid().ToString());
|
||||||
public NewVm New => ServiceLocator.Current.GetInstance<NewVm>(Guid.NewGuid().ToString());
|
public NewVm New => ServiceLocator.Current.GetInstance<NewVm>(Guid.NewGuid().ToString());
|
||||||
public OpenVm Open => ServiceLocator.Current.GetInstance<OpenVm>(Guid.NewGuid().ToString());
|
public OpenVm Open => ServiceLocator.Current.GetInstance<OpenVm>(Guid.NewGuid().ToString());
|
||||||
public RecentVm Recent => ServiceLocator.Current.GetInstance<RecentVm>(Guid.NewGuid().ToString());
|
public RecentVm Recent => ServiceLocator.Current.GetInstance<RecentVm>(Guid.NewGuid().ToString());
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Messages\EntryFieldValueChangedMessage.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Messages\EntryFieldValueChangedMessage.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Messages\FileNotFoundMessage.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Messages\FileNotFoundMessage.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Messages\NavigateToPageMessage.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Messages\NavigateToPageMessage.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Messages\PasswordGeneratedMessage.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Messages\SaveErrorMessage.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Messages\SaveErrorMessage.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\AboutVm.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\AboutVm.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\Items\EntryFieldVm.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\Items\EntryFieldVm.cs" />
|
||||||
@@ -50,6 +51,7 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\Settings\GeneralVm.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\Settings\GeneralVm.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\Settings\SecurityVm.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\Settings\SecurityVm.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\UserControls\ColorPickerControlVm.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\UserControls\ColorPickerControlVm.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\UserControls\PasswordGenerationBoxControlVm.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\ViewModelLocatorCommon.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\ViewModelLocatorCommon.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\Items\ListMenuItemVm.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\Items\ListMenuItemVm.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\Items\MainMenuItemVm.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)ViewModels\Items\MainMenuItemVm.cs" />
|
||||||
|
Reference in New Issue
Block a user