mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Changed default icon from IntToSymbolConverter to a parameter
Filtered symbol list from drop down list to only show actually settable symbols
This commit is contained in:
@@ -99,7 +99,7 @@ namespace ModernKeePass
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (System.Diagnostics.Debugger.IsAttached)
|
if (System.Diagnostics.Debugger.IsAttached)
|
||||||
{
|
{
|
||||||
DebugSettings.EnableFrameRateCounter = true;
|
//DebugSettings.EnableFrameRateCounter = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -75,6 +75,7 @@ namespace ModernKeePass.Converters
|
|||||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||||
{
|
{
|
||||||
var symbol = (Symbol) value;
|
var symbol = (Symbol) value;
|
||||||
|
var defaultIcon = (int?) parameter ?? -1;
|
||||||
switch (symbol)
|
switch (symbol)
|
||||||
{
|
{
|
||||||
case Symbol.Delete: return (int)PwIcon.TrashBin;
|
case Symbol.Delete: return (int)PwIcon.TrashBin;
|
||||||
@@ -123,7 +124,7 @@ namespace ModernKeePass.Converters
|
|||||||
case Symbol.ZeroBars: return (int) PwIcon.Energy;
|
case Symbol.ZeroBars: return (int) PwIcon.Energy;
|
||||||
case Symbol.FourBars: return (int) PwIcon.EnergyCareful;
|
case Symbol.FourBars: return (int) PwIcon.EnergyCareful;
|
||||||
case Symbol.Scan: return (int) PwIcon.Scanner;
|
case Symbol.Scan: return (int) PwIcon.Scanner;
|
||||||
default: return (int) PwIcon.Key;
|
default: return defaultIcon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,6 @@
|
|||||||
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter" />
|
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter" />
|
||||||
<converters:ProgressBarLegalValuesConverter x:Key="ProgressBarLegalValuesConverter" />
|
<converters:ProgressBarLegalValuesConverter x:Key="ProgressBarLegalValuesConverter" />
|
||||||
<converters:DoubleToSolidColorBrushConverter x:Key="DoubleToForegroungBrushComplexityConverter" />
|
<converters:DoubleToSolidColorBrushConverter x:Key="DoubleToForegroungBrushComplexityConverter" />
|
||||||
<converters:NullToBooleanConverter x:Key="NullToBooleanConverter" />
|
|
||||||
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter" />
|
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter" />
|
||||||
<converters:IntToSymbolConverter x:Key="IntToSymbolConverter" />
|
<converters:IntToSymbolConverter x:Key="IntToSymbolConverter" />
|
||||||
<Style TargetType="PasswordBox" x:Name="PasswordBoxWithButtonStyle">
|
<Style TargetType="PasswordBox" x:Name="PasswordBoxWithButtonStyle">
|
||||||
@@ -499,7 +498,7 @@
|
|||||||
<RowDefinition Height="20" />
|
<RowDefinition Height="20" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Viewbox MaxHeight="30" Width="50" Grid.Column="0" Grid.Row="0" Visibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}">
|
<Viewbox MaxHeight="30" Width="50" Grid.Column="0" Grid.Row="0" Visibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
<userControls:SymbolPickerUserControl Width="80" Height="40" SelectedSymbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}, Mode=TwoWay}" />
|
<userControls:SymbolPickerUserControl Width="80" Height="40" SelectedSymbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}, ConverterParameter=0, Mode=TwoWay}" />
|
||||||
</Viewbox>
|
</Viewbox>
|
||||||
<Viewbox MaxHeight="30" Width="50" Grid.Column="0" Grid.Row="0" Visibility="{Binding IsEditMode, Converter={StaticResource InverseBooleanToVisibilityConverter}}">
|
<Viewbox MaxHeight="30" Width="50" Grid.Column="0" Grid.Row="0" Visibility="{Binding IsEditMode, Converter={StaticResource InverseBooleanToVisibilityConverter}}">
|
||||||
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Width="80" Height="40" />
|
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Width="80" Height="40" />
|
||||||
|
@@ -105,7 +105,7 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Border Grid.Column="0" Background="{Binding BackgroundColor, ConverterParameter={StaticResource MainColor}, Converter={StaticResource ColorToBrushConverter}}">
|
<Border Grid.Column="0" Background="{Binding BackgroundColor, ConverterParameter={StaticResource MainColor}, Converter={StaticResource ColorToBrushConverter}}">
|
||||||
<Viewbox MaxHeight="50" Width="100">
|
<Viewbox MaxHeight="50" Width="100">
|
||||||
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Foreground="{StaticResource TextColor}" />
|
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}, ConverterParameter=0}" Foreground="{StaticResource TextColor}" />
|
||||||
</Viewbox>
|
</Viewbox>
|
||||||
</Border>
|
</Border>
|
||||||
<StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,10,0,0" >
|
<StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="10,10,0,0" >
|
||||||
@@ -207,7 +207,7 @@
|
|||||||
<RowDefinition Height="20" />
|
<RowDefinition Height="20" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Viewbox MaxHeight="30" Width="50" Grid.Column="0" Grid.Row="0" Visibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}">
|
<Viewbox MaxHeight="30" Width="50" Grid.Column="0" Grid.Row="0" Visibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||||
<userControls:SymbolPickerUserControl Width="80" Height="40" SelectedSymbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}, Mode=TwoWay}" />
|
<userControls:SymbolPickerUserControl Width="80" Height="40" SelectedSymbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}, ConverterParameter=48, Mode=TwoWay}" />
|
||||||
</Viewbox>
|
</Viewbox>
|
||||||
<Viewbox MaxHeight="30" Width="50" Grid.Column="0" Grid.Row="0" Visibility="{Binding IsEditMode, Converter={StaticResource InverseBooleanToVisibilityConverter}}">
|
<Viewbox MaxHeight="30" Width="50" Grid.Column="0" Grid.Row="0" Visibility="{Binding IsEditMode, Converter={StaticResource InverseBooleanToVisibilityConverter}}">
|
||||||
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Width="80" Height="40" />
|
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Width="80" Height="40" />
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
<x:Double x:Key="HamburgerMenuSize">300</x:Double>
|
<x:Double x:Key="HamburgerMenuSize">300</x:Double>
|
||||||
<DataTemplate x:Name="IsSpecial">
|
<DataTemplate x:Name="IsSpecial">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Margin="7,15,0,15">
|
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}, ConverterParameter=48}" Margin="7,15,0,15">
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
<ToolTip Content="{Binding Path={Binding DisplayMemberPath, ElementName=UserControl}}" />
|
<ToolTip Content="{Binding Path={Binding DisplayMemberPath, ElementName=UserControl}}" />
|
||||||
</ToolTipService.ToolTip>
|
</ToolTipService.ToolTip>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate x:Name="IsNormal">
|
<DataTemplate x:Name="IsNormal">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Margin="7,15,0,15">
|
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}, ConverterParameter=48}" Margin="7,15,0,15">
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
<ToolTip Content="{Binding Path={Binding DisplayMemberPath, ElementName=UserControl}}" />
|
<ToolTip Content="{Binding Path={Binding DisplayMemberPath, ElementName=UserControl}}" />
|
||||||
</ToolTipService.ToolTip>
|
</ToolTipService.ToolTip>
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
|
using ModernKeePass.Converters;
|
||||||
|
|
||||||
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
|
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
|
||||||
|
|
||||||
@@ -9,7 +11,7 @@ namespace ModernKeePass.Views.UserControls
|
|||||||
{
|
{
|
||||||
public sealed partial class SymbolPickerUserControl
|
public sealed partial class SymbolPickerUserControl
|
||||||
{
|
{
|
||||||
public Symbol[] Symbols { get; }
|
public IEnumerable<Symbol> Symbols { get; }
|
||||||
|
|
||||||
public Symbol SelectedSymbol
|
public Symbol SelectedSymbol
|
||||||
{
|
{
|
||||||
@@ -26,8 +28,8 @@ namespace ModernKeePass.Views.UserControls
|
|||||||
public SymbolPickerUserControl()
|
public SymbolPickerUserControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
var converter = new IntToSymbolConverter();
|
||||||
Symbols = (Symbol[])Enum.GetValues(typeof(Symbol));
|
Symbols = Enum.GetValues(typeof(Symbol)).Cast<Symbol>().Where(s => (int)converter.ConvertBack(s, null, null, string.Empty) != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ComboBox_OnLoaded(object sender, RoutedEventArgs e)
|
private void ComboBox_OnLoaded(object sender, RoutedEventArgs e)
|
||||||
|
Reference in New Issue
Block a user