Entry icons now correctly show up

Auto create new recycle bin works correctly
This commit is contained in:
Geoffroy BONNEVILLE
2020-04-08 20:02:13 +02:00
parent 752e96884d
commit 14fd4634db
5 changed files with 13 additions and 8 deletions

View File

@@ -47,7 +47,7 @@ namespace ModernKeePass.Infrastructure.KeePass
{ {
get get
{ {
if (_pwDatabase.RecycleBinEnabled) if (_pwDatabase.RecycleBinEnabled && !_pwDatabase.RecycleBinUuid.Equals(PwUuid.Zero))
{ {
return _pwDatabase.RecycleBinUuid.ToHexString(); return _pwDatabase.RecycleBinUuid.ToHexString();
} }
@@ -56,7 +56,7 @@ namespace ModernKeePass.Infrastructure.KeePass
} }
set set
{ {
_pwDatabase.RecycleBinUuid = BuildIdFromString(value); _pwDatabase.RecycleBinUuid = value != null ? BuildIdFromString(value) : PwUuid.Zero;
_pwDatabase.RecycleBinChanged = _dateTime.Now; _pwDatabase.RecycleBinChanged = _dateTime.Now;
} }
} }
@@ -331,7 +331,7 @@ namespace ModernKeePass.Infrastructure.KeePass
if (disposing) if (disposing)
{ {
_pwDatabase.Close(); _pwDatabase?.Close();
} }
_disposed = true; _disposed = true;

View File

@@ -47,7 +47,7 @@ namespace ModernKeePass
public App() public App()
{ {
#if DEBUG #if DEBUG
HockeyClient.Current.Configure("2fe83672887b4910b9de93a4398d0f8f"); HockeyClient.Current.Configure("2fe83672-887b-4910-b9de-93a4398d0f8f");
#else #else
HockeyClient.Current.Configure("9eb5fbb79b484fbd8daf04635e975c84"); HockeyClient.Current.Configure("9eb5fbb79b484fbd8daf04635e975c84");
#endif #endif
@@ -85,6 +85,7 @@ namespace ModernKeePass
if (realException is SaveException) if (realException is SaveException)
{ {
unhandledExceptionEventArgs.Handled = true; unhandledExceptionEventArgs.Handled = true;
HockeyClient.Current.TrackException(realException.InnerException);
await MessageDialogHelper.ShowActionDialog(_resource.GetResourceValue("MessageDialogSaveErrorTitle"), await MessageDialogHelper.ShowActionDialog(_resource.GetResourceValue("MessageDialogSaveErrorTitle"),
realException.InnerException.Message, realException.InnerException.Message,
_resource.GetResourceValue("MessageDialogSaveErrorButtonSaveAs"), _resource.GetResourceValue("MessageDialogSaveErrorButtonSaveAs"),

View File

@@ -71,7 +71,10 @@ namespace ModernKeePass.ViewModels
public IEntityVm SelectedRecycleBin public IEntityVm SelectedRecycleBin
{ {
get { return Groups.FirstOrDefault(g => g.Id == _database.RecycleBinId); } get { return Groups.FirstOrDefault(g => g.Id == _database.RecycleBinId); }
set { _mediator.Send(new SetRecycleBinCommand { RecycleBinId = value.Id}).Wait(); } set
{
if (!IsNewRecycleBin) _mediator.Send(new SetRecycleBinCommand { RecycleBinId = value.Id}).Wait();
}
} }
public SettingsDatabaseVm() : this(App.Services.GetService<IMediator>()) { } public SettingsDatabaseVm() : this(App.Services.GetService<IMediator>()) { }

View File

@@ -49,8 +49,8 @@ namespace ModernKeePass.ViewModels
_recent = recent; _recent = recent;
ClearAllCommand = new RelayCommand(ClearAll); ClearAllCommand = new RelayCommand(ClearAll);
RecentItems = new ObservableCollection<RecentItemVm>(_recent.GetAll().GetAwaiter().GetResult() var recentItems = _recent.GetAll().GetAwaiter().GetResult().Select(r => new RecentItemVm(r));
.Select(r => new RecentItemVm(r))); RecentItems = new ObservableCollection<RecentItemVm>(recentItems);
if (RecentItems.Count > 0) if (RecentItems.Count > 0)
SelectedItem = RecentItems[0]; SelectedItem = RecentItems[0];
} }

View File

@@ -17,6 +17,7 @@
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter"/> <converters:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/> <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter"/> <converters:InverseBooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter"/>
<converters:IconToSymbolConverter x:Key="IconToSymbolConverter"/>
</Page.Resources> </Page.Resources>
<Page.DataContext> <Page.DataContext>
<viewModels:GroupDetailVm /> <viewModels:GroupDetailVm />
@@ -103,7 +104,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 Icon}" Foreground="{StaticResource TextColor}" /> <SymbolIcon Symbol="{Binding Icon, Converter={StaticResource IconToSymbolConverter}}" 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" >