Added CodeAnalysis package

Better entry history handling
Changing icon now adds an history entry
This commit is contained in:
BONNEVILLE Geoffroy
2018-07-24 17:52:44 +02:00
parent d6765904a1
commit 9863195684
7 changed files with 101 additions and 15 deletions

View File

@@ -391,6 +391,30 @@
<HintPath>..\packages\Portable.BouncyCastle.1.8.2\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath> <HintPath>..\packages\Portable.BouncyCastle.1.8.2\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.Common.1.3.1\lib\portable-net45+win8\Microsoft.CodeAnalysis.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.1.3.1\lib\portable-net45+win8\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.3.1\lib\portable-net45+win8\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.VisualBasic, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.VisualBasic.1.3.1\lib\portable-net45+win8\Microsoft.CodeAnalysis.VisualBasic.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.VisualBasic.Workspaces.1.3.1\lib\portable-net45+win8\Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.3.1\lib\portable-net45+win8\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.HockeyApp.Core45, Version=4.1.6.1005, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="Microsoft.HockeyApp.Core45, Version=4.1.6.1005, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\HockeySDK.Core.4.1.6\lib\portable-net45+win8+wp8+wpa81+win81+uap10.0\Microsoft.HockeyApp.Core45.dll</HintPath> <HintPath>..\packages\HockeySDK.Core.4.1.6\lib\portable-net45+win8+wp8+wpa81+win81+uap10.0\Microsoft.HockeyApp.Core45.dll</HintPath>
<Private>True</Private> <Private>True</Private>
@@ -411,10 +435,38 @@
<HintPath>..\packages\Splat.3.0.0\lib\netstandard1.1\Splat.dll</HintPath> <HintPath>..\packages\Splat.3.0.0\lib\netstandard1.1\Splat.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System.Collections.Immutable, Version=1.1.37.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Drawing.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Drawing.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Drawing.Primitives.4.3.0\lib\netstandard1.1\System.Drawing.Primitives.dll</HintPath> <HintPath>..\packages\System.Drawing.Primitives.4.3.0\lib\netstandard1.1\System.Drawing.Primitives.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System.Reflection.Metadata, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.Metadata.1.2.0\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\win8\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath> <HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\win8\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private> <Private>True</Private>
@@ -499,6 +551,10 @@
<Content Include="Assets\Wide310x150Logo.scale-180.png" /> <Content Include="Assets\Wide310x150Logo.scale-180.png" />
<Content Include="Assets\Wide310x150Logo.scale-80.png" /> <Content Include="Assets\Wide310x150Logo.scale-80.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll" />
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" />
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0' "> <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '12.0' ">
<VisualStudioVersion>12.0</VisualStudioVersion> <VisualStudioVersion>12.0</VisualStudioVersion>
</PropertyGroup> </PropertyGroup>

View File

@@ -92,19 +92,33 @@ namespace ModernKeePass.ViewModels
if (_pwEntry?.IconId != null) return (int) _pwEntry?.IconId; if (_pwEntry?.IconId != null) return (int) _pwEntry?.IconId;
return -1; return -1;
} }
set { _pwEntry.IconId = (PwIcon)value; } set
{
HandleBackup();
_pwEntry.IconId = (PwIcon)value;
}
} }
public DateTimeOffset ExpiryDate public DateTimeOffset ExpiryDate
{ {
get { return new DateTimeOffset(_pwEntry.ExpiryTime.Date); } get { return new DateTimeOffset(_pwEntry.ExpiryTime.Date); }
set { if (HasExpirationDate) _pwEntry.ExpiryTime = value.DateTime; } set
{
if (!HasExpirationDate) return;
HandleBackup();
_pwEntry.ExpiryTime = value.DateTime;
}
} }
public TimeSpan ExpiryTime public TimeSpan ExpiryTime
{ {
get { return _pwEntry.ExpiryTime.TimeOfDay; } get { return _pwEntry.ExpiryTime.TimeOfDay; }
set { if (HasExpirationDate) _pwEntry.ExpiryTime = _pwEntry.ExpiryTime.Date.Add(value); } set
{
if (!HasExpirationDate) return;
HandleBackup();
_pwEntry.ExpiryTime = _pwEntry.ExpiryTime.Date.Add(value);
}
} }
public bool IsEditMode public bool IsEditMode
@@ -170,6 +184,7 @@ namespace ModernKeePass.ViewModels
if (value != null) _pwEntry.BackgroundColor = (Color) value; if (value != null) _pwEntry.BackgroundColor = (Color) value;
} }
} }
public Color? ForegroundColor public Color? ForegroundColor
{ {
get { return _pwEntry?.ForegroundColor; } get { return _pwEntry?.ForegroundColor; }
@@ -286,6 +301,14 @@ namespace ModernKeePass.ViewModels
return IsSelected ? _resource.GetResourceValue("EntryCurrent") : _pwEntry.LastModificationTime.ToString("g"); return IsSelected ? _resource.GetResourceValue("EntryCurrent") : _pwEntry.LastModificationTime.ToString("g");
} }
private void HandleBackup()
{
if (_isDirty) return;
_pwEntry?.Touch(true);
_pwEntry?.CreateBackup(null);
_isDirty = true;
}
private string GetEntryValue(string key) private string GetEntryValue(string key)
{ {
return _pwEntry?.Strings.GetSafe(key).ReadString(); return _pwEntry?.Strings.GetSafe(key).ReadString();
@@ -293,13 +316,8 @@ namespace ModernKeePass.ViewModels
private void SetEntryValue(string key, ProtectedString newValue) private void SetEntryValue(string key, ProtectedString newValue)
{ {
if (!_isDirty) HandleBackup();
{
_pwEntry.Touch(true);
_pwEntry?.CreateBackup(null);
}
_pwEntry?.Strings.Set(key, newValue); _pwEntry?.Strings.Set(key, newValue);
_isDirty = true;
} }
} }
} }

View File

@@ -453,11 +453,11 @@
<StackPanel x:Name="EditDesign" Visibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}" Orientation="Horizontal"> <StackPanel x:Name="EditDesign" Visibility="{Binding IsEditMode, Converter={StaticResource BooleanToVisibilityConverter}}" Orientation="Horizontal">
<StackPanel Width="250" HorizontalAlignment="Left"> <StackPanel Width="250" HorizontalAlignment="Left">
<TextBlock x:Uid="EntryBackgroundColor" /> <TextBlock x:Uid="EntryBackgroundColor" />
<userControls:ColorPickerUserControl SelectedColor="{Binding BackgroundColor, Converter={StaticResource ColorToBrushConverter}, Mode=TwoWay}" /> <userControls:ColorPickerUserControl SelectedColor="{Binding BackgroundColor, Converter={StaticResource ColorToBrushConverter}, Mode=TwoWay}" IsEnabled="{Binding IsSelected}" />
</StackPanel> </StackPanel>
<StackPanel Width="250" HorizontalAlignment="Left"> <StackPanel Width="250" HorizontalAlignment="Left">
<TextBlock x:Uid="EntryForegroundColor" /> <TextBlock x:Uid="EntryForegroundColor" />
<userControls:ColorPickerUserControl SelectedColor="{Binding ForegroundColor, Converter={StaticResource ColorToBrushConverter}, Mode=TwoWay}" /> <userControls:ColorPickerUserControl SelectedColor="{Binding ForegroundColor, Converter={StaticResource ColorToBrushConverter}, Mode=TwoWay}" IsEnabled="{Binding IsSelected}" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
@@ -481,7 +481,7 @@
Style="{StaticResource NoBorderButtonStyle}"> Style="{StaticResource NoBorderButtonStyle}">
<SymbolIcon Symbol="Back" /> <SymbolIcon Symbol="Back" />
</Button> </Button>
<Grid Grid.Column="1" > <Grid Grid.Column="1" x:Name="TopGrid">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="60" /> <ColumnDefinition Width="60" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
@@ -497,13 +497,11 @@
<SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Width="80" Height="40" /> <SymbolIcon Symbol="{Binding IconId, Converter={StaticResource IntToSymbolConverter}}" Width="80" Height="40" />
</Viewbox> </Viewbox>
<TextBox Grid.Column="1" Grid.Row="0" <TextBox Grid.Column="1" Grid.Row="0"
x:Name="TitleTextBox"
Text="{Binding Name, Mode=TwoWay}" Text="{Binding Name, Mode=TwoWay}"
Foreground="{ThemeResource DefaultTextForegroundThemeBrush}" Foreground="{ThemeResource DefaultTextForegroundThemeBrush}"
Background="Transparent" Background="Transparent"
SelectionHighlightColor="{StaticResource MainColor}" SelectionHighlightColor="{StaticResource MainColor}"
IsHitTestVisible="{Binding IsEditMode}" IsHitTestVisible="{Binding IsEditMode}"
IsEnabled="{Binding IsSelected}"
BorderThickness="0" BorderThickness="0"
FontSize="20" FontSize="20"
FontWeight="Light" FontWeight="Light"

View File

@@ -70,7 +70,7 @@ namespace ModernKeePass.Views
default: default:
var entry = listView?.SelectedItem as EntryVm; var entry = listView?.SelectedItem as EntryVm;
StackPanel.DataContext = entry; StackPanel.DataContext = entry;
TitleTextBox.DataContext = entry; TopGrid.DataContext = entry;
break; break;
} }
} }

View File

@@ -1,3 +1,4 @@
Improved search box Improved search box
Changing entry icon creates a new history entry
Changing Windows accent color while application is still running changes main color Changing Windows accent color while application is still running changes main color
Corrected startup crash on some versions of Windows Corrected startup crash on some versions of Windows

View File

@@ -1,3 +1,4 @@
Amelioration de la recherche Amelioration de la recherche
Changer l'icone d'une entree cree un historique
Changer la couleur de d'accentuation de Windows pendant que l'app tourne change la couleur de celle-ci Changer la couleur de d'accentuation de Windows pendant que l'app tourne change la couleur de celle-ci
Correction de crash lors du lancement avec certaines versions de Windows Correction de crash lors du lancement avec certaines versions de Windows

View File

@@ -3,6 +3,15 @@
<package id="HockeySDK.Core" version="4.1.6" targetFramework="win81" /> <package id="HockeySDK.Core" version="4.1.6" targetFramework="win81" />
<package id="HockeySDK.WINRT" version="4.1.6" targetFramework="win81" /> <package id="HockeySDK.WINRT" version="4.1.6" targetFramework="win81" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="win81" /> <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="win81" />
<package id="Microsoft.CodeAnalysis" version="1.3.1" targetFramework="win81" />
<package id="Microsoft.CodeAnalysis.Analyzers" version="1.1.0" targetFramework="win81" />
<package id="Microsoft.CodeAnalysis.Common" version="1.3.1" targetFramework="win81" />
<package id="Microsoft.CodeAnalysis.CSharp" version="1.3.1" targetFramework="win81" />
<package id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="1.3.1" targetFramework="win81" />
<package id="Microsoft.CodeAnalysis.VisualBasic" version="1.3.1" targetFramework="win81" />
<package id="Microsoft.CodeAnalysis.VisualBasic.Workspaces" version="1.3.1" targetFramework="win81" />
<package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.3.1" targetFramework="win81" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="win81" />
<package id="Microsoft.NETCore.Platforms" version="2.1.0" targetFramework="win81" /> <package id="Microsoft.NETCore.Platforms" version="2.1.0" targetFramework="win81" />
<package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" /> <package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.2" targetFramework="win81" />
<package id="Microsoft.NETCore.UniversalWindowsPlatform" version="6.1.5" targetFramework="win81" /> <package id="Microsoft.NETCore.UniversalWindowsPlatform" version="6.1.5" targetFramework="win81" />
@@ -12,6 +21,7 @@
<package id="Portable.BouncyCastle" version="1.8.2" targetFramework="win81" /> <package id="Portable.BouncyCastle" version="1.8.2" targetFramework="win81" />
<package id="Splat" version="3.0.0" targetFramework="win81" /> <package id="Splat" version="3.0.0" targetFramework="win81" />
<package id="System.Collections" version="4.3.0" targetFramework="win81" /> <package id="System.Collections" version="4.3.0" targetFramework="win81" />
<package id="System.Collections.Immutable" version="1.1.37" targetFramework="win81" />
<package id="System.Diagnostics.Contracts" version="4.3.0" targetFramework="win81" /> <package id="System.Diagnostics.Contracts" version="4.3.0" targetFramework="win81" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="win81" /> <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="win81" />
<package id="System.Drawing.Primitives" version="4.3.0" targetFramework="win81" /> <package id="System.Drawing.Primitives" version="4.3.0" targetFramework="win81" />
@@ -21,6 +31,8 @@
<package id="System.Net.Requests" version="4.3.0" targetFramework="win81" /> <package id="System.Net.Requests" version="4.3.0" targetFramework="win81" />
<package id="System.Reflection" version="4.3.0" targetFramework="win81" /> <package id="System.Reflection" version="4.3.0" targetFramework="win81" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="win81" /> <package id="System.Reflection.Extensions" version="4.3.0" targetFramework="win81" />
<package id="System.Reflection.Metadata" version="1.2.0" targetFramework="win81" />
<package id="System.Resources.ResourceManager" version="4.0.0" targetFramework="win81" />
<package id="System.Runtime" version="4.3.0" targetFramework="win81" /> <package id="System.Runtime" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="win81" /> <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="win81" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="win81" /> <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="win81" />