mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-04 08:00:16 -04:00
Removed an useless converter
Groups in menu now use instead a Template selector (depending on IIsSelected)
This commit is contained in:
@@ -1,20 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Windows.UI.Text;
|
|
||||||
using Windows.UI.Xaml.Data;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Converters
|
|
||||||
{
|
|
||||||
public class BooleanToFontStyleConverter : IValueConverter
|
|
||||||
{
|
|
||||||
public object Convert(object value, Type targetType, object parameter, string language)
|
|
||||||
{
|
|
||||||
var boolean = value is bool ? (bool)value : false;
|
|
||||||
return boolean ? FontStyle.Italic : FontStyle.Normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -117,6 +117,7 @@
|
|||||||
<Compile Include="Interfaces\IRecent.cs" />
|
<Compile Include="Interfaces\IRecent.cs" />
|
||||||
<Compile Include="Interfaces\IRecentItem.cs" />
|
<Compile Include="Interfaces\IRecentItem.cs" />
|
||||||
<Compile Include="Interfaces\IResource.cs" />
|
<Compile Include="Interfaces\IResource.cs" />
|
||||||
|
<Compile Include="TemplateSelectors\SelectableDataTemplateSelector.cs" />
|
||||||
<Compile Include="ViewModels\DonateVm.cs" />
|
<Compile Include="ViewModels\DonateVm.cs" />
|
||||||
<Compile Include="Views\MainPageFrames\DonatePage.xaml.cs">
|
<Compile Include="Views\MainPageFrames\DonatePage.xaml.cs">
|
||||||
<DependentUpon>DonatePage.xaml</DependentUpon>
|
<DependentUpon>DonatePage.xaml</DependentUpon>
|
||||||
@@ -165,7 +166,6 @@
|
|||||||
<Compile Include="Converters\ColorToBrushConverter.cs" />
|
<Compile Include="Converters\ColorToBrushConverter.cs" />
|
||||||
<Compile Include="Converters\DoubleToSolidColorBrushConverter.cs" />
|
<Compile Include="Converters\DoubleToSolidColorBrushConverter.cs" />
|
||||||
<Compile Include="Converters\InverseBooleanToVisibilityConverter.cs" />
|
<Compile Include="Converters\InverseBooleanToVisibilityConverter.cs" />
|
||||||
<Compile Include="Converters\BooleanToFontStyleConverter.cs" />
|
|
||||||
<Compile Include="Converters\PluralizationConverter.cs" />
|
<Compile Include="Converters\PluralizationConverter.cs" />
|
||||||
<Compile Include="Converters\ProgressBarLegalValuesConverter.cs" />
|
<Compile Include="Converters\ProgressBarLegalValuesConverter.cs" />
|
||||||
<Compile Include="Converters\TextToWidthConverter.cs" />
|
<Compile Include="Converters\TextToWidthConverter.cs" />
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
|
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
|
||||||
<Identity Name="wismna.ModernKeePass" Publisher="CN=0719A91A-C322-4EE0-A257-E60733EECF06" Version="1.12.0.31" />
|
<Identity Name="wismna.ModernKeePass" Publisher="CN=0719A91A-C322-4EE0-A257-E60733EECF06" Version="1.12.0.32" />
|
||||||
<Properties>
|
<Properties>
|
||||||
<DisplayName>ModernKeePass</DisplayName>
|
<DisplayName>ModernKeePass</DisplayName>
|
||||||
<PublisherDisplayName>wismna</PublisherDisplayName>
|
<PublisherDisplayName>wismna</PublisherDisplayName>
|
||||||
|
@@ -27,7 +27,6 @@ namespace ModernKeePass.Services
|
|||||||
}
|
}
|
||||||
private readonly PwDatabase _pwDatabase = new PwDatabase();
|
private readonly PwDatabase _pwDatabase = new PwDatabase();
|
||||||
private readonly ISettings _settings;
|
private readonly ISettings _settings;
|
||||||
private readonly IResource _resource;
|
|
||||||
private StorageFile _databaseFile;
|
private StorageFile _databaseFile;
|
||||||
private GroupVm _recycleBin;
|
private GroupVm _recycleBin;
|
||||||
|
|
||||||
|
@@ -0,0 +1,18 @@
|
|||||||
|
using Windows.UI.Xaml;
|
||||||
|
using Windows.UI.Xaml.Controls;
|
||||||
|
using ModernKeePass.Interfaces;
|
||||||
|
|
||||||
|
namespace ModernKeePass.TemplateSelectors
|
||||||
|
{
|
||||||
|
public class SelectableDataTemplateSelector: DataTemplateSelector
|
||||||
|
{
|
||||||
|
public DataTemplate TrueItem { get; set; }
|
||||||
|
public DataTemplate FalseItem { get; set; }
|
||||||
|
|
||||||
|
protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
|
||||||
|
{
|
||||||
|
var isSelectableItem = item as ISelectableModel;
|
||||||
|
return isSelectableItem != null && isSelectableItem.IsSelected ? TrueItem : FalseItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -8,7 +8,6 @@
|
|||||||
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:controls="using:ModernKeePass.Controls"
|
|
||||||
xmlns:templateSelectors="using:ModernKeePass.TemplateSelectors"
|
xmlns:templateSelectors="using:ModernKeePass.TemplateSelectors"
|
||||||
x:Name="PageRoot"
|
x:Name="PageRoot"
|
||||||
x:Class="ModernKeePass.Views.GroupDetailPage"
|
x:Class="ModernKeePass.Views.GroupDetailPage"
|
||||||
@@ -16,7 +15,6 @@
|
|||||||
SizeChanged="GroupDetailPage_OnSizeChanged">
|
SizeChanged="GroupDetailPage_OnSizeChanged">
|
||||||
<Page.Resources>
|
<Page.Resources>
|
||||||
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
|
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
|
||||||
<converters:BooleanToFontStyleConverter x:Key="BooleanToFontStyleConverter"/>
|
|
||||||
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||||
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter"/>
|
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter"/>
|
||||||
<converters:NullToBooleanConverter x:Key="NullToBooleanConverter"/>
|
<converters:NullToBooleanConverter x:Key="NullToBooleanConverter"/>
|
||||||
@@ -126,18 +124,31 @@
|
|||||||
RequestedTheme="Dark"
|
RequestedTheme="Dark"
|
||||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||||
Foreground="{ThemeResource DefaultTextForegroundThemeBrush}">
|
Foreground="{ThemeResource DefaultTextForegroundThemeBrush}">
|
||||||
<ListView.ItemTemplate>
|
<ListView.Resources>
|
||||||
<DataTemplate x:Name="GroupOtherItem">
|
<DataTemplate x:Name="IsRecycleBin">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<SymbolIcon Symbol="{Binding IconSymbol}" Margin="8,0,0,0">
|
<SymbolIcon Symbol="{Binding IconSymbol}" Margin="8,0,0,0">
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
<ToolTip Content="{Binding Name}" />
|
<ToolTip Content="{Binding Name}" />
|
||||||
</ToolTipService.ToolTip>
|
</ToolTipService.ToolTip>
|
||||||
</SymbolIcon>
|
</SymbolIcon>
|
||||||
<TextBlock Text="{Binding Name}" x:Name="GroupTextBlock" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="30,0,20,0" FontStyle="{Binding IsSelected, Converter={StaticResource BooleanToFontStyleConverter}}" />
|
<TextBlock Text="{Binding Name}" x:Name="GroupTextBlock" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="30,0,20,0" FontStyle="Italic" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListView.ItemTemplate>
|
<DataTemplate x:Name="IsNotRecycleBin">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<SymbolIcon Symbol="{Binding IconSymbol}" Margin="8,0,0,0">
|
||||||
|
<ToolTipService.ToolTip>
|
||||||
|
<ToolTip Content="{Binding Name}" />
|
||||||
|
</ToolTipService.ToolTip>
|
||||||
|
</SymbolIcon>
|
||||||
|
<TextBlock Text="{Binding Name}" x:Name="GroupTextBlock" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="30,0,20,0" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListView.Resources>
|
||||||
|
<ListView.ItemTemplateSelector>
|
||||||
|
<templateSelectors:SelectableDataTemplateSelector FalseItem="{StaticResource IsNotRecycleBin}" TrueItem="{StaticResource IsRecycleBin}" />
|
||||||
|
</ListView.ItemTemplateSelector>
|
||||||
<ListView.ItemsSource>
|
<ListView.ItemsSource>
|
||||||
<Binding Source="{StaticResource GroupsViewSource}"/>
|
<Binding Source="{StaticResource GroupsViewSource}"/>
|
||||||
</ListView.ItemsSource>
|
</ListView.ItemsSource>
|
||||||
@@ -162,7 +173,7 @@
|
|||||||
</core:EventTriggerBehavior>
|
</core:EventTriggerBehavior>
|
||||||
</interactivity:Interaction.Behaviors>
|
</interactivity:Interaction.Behaviors>
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<Button Padding="0" Height="50" Margin="0" Style="{StaticResource NoBorderButtonStyle}" Background="Transparent" Foreground="White" BorderThickness="0" Click="CreateGroup_ButtonClick">
|
<Button Padding="0" Height="50" Margin="0" Style="{StaticResource NoBorderButtonStyle}" Background="Transparent" BorderThickness="0" Click="CreateGroup_ButtonClick">
|
||||||
<StackPanel Orientation="Horizontal" Margin="13,0,5,0">
|
<StackPanel Orientation="Horizontal" Margin="13,0,5,0">
|
||||||
<SymbolIcon Symbol="Add">
|
<SymbolIcon Symbol="Add">
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
|
Reference in New Issue
Block a user