Skip to content

Commit fd82a4e

Browse files
committed
Fixed 'AppHang' issue, updated libs, refactorings and improvements
1 parent a3b401f commit fd82a4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2473
-10916
lines changed

AK.Abr/AK.Abr.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
55
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -26,6 +26,7 @@
2626
<WarningLevel>4</WarningLevel>
2727
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
2828
<LangVersion>latest</LangVersion>
29+
<Prefer32Bit>false</Prefer32Bit>
2930
</PropertyGroup>
3031
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3132
<DebugType>pdbonly</DebugType>
@@ -34,6 +35,7 @@
3435
<DefineConstants>TRACE</DefineConstants>
3536
<ErrorReport>prompt</ErrorReport>
3637
<WarningLevel>4</WarningLevel>
38+
<Prefer32Bit>false</Prefer32Bit>
3739
</PropertyGroup>
3840
<ItemGroup>
3941
<Reference Include="MiscUtil">
@@ -52,8 +54,8 @@
5254
<Compile Include="AbrReader.cs" />
5355
<Compile Include="AbrReaderFactory.cs" />
5456
<Compile Include="BrushImageReadyEventArgs.cs" />
55-
<Compile Include="CachedAbrReader.cs" />
56-
<Compile Include="CachedAbrReaderFactory.cs" />
57+
<Compile Include="CachingAbrReader.cs" />
58+
<Compile Include="CachingAbrReaderFactory.cs" />
5759
<Compile Include="FileAbrSource.cs" />
5860
<Compile Include="IAbrReader.cs" />
5961
<Compile Include="IAbrReaderFactory.cs" />

AK.Abr/CachedAbrReader.cs renamed to AK.Abr/CachingAbrReader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
namespace AK.Abr
88
{
9-
public class CachedAbrReader : IAbrReader, IDisposable
9+
public class CachingAbrReader : IAbrReader, IDisposable
1010
{
1111
private readonly IAbrReader _reader;
1212
private readonly IBitmapCache _cache;
1313

1414
public IAbrSource Source => _reader.Source;
1515

16-
public CachedAbrReader(IAbrReader reader, IBitmapCache cache) {
16+
public CachingAbrReader(IAbrReader reader, IBitmapCache cache) {
1717
_cache = cache ?? throw new ArgumentNullException(nameof(cache));
1818

1919
_reader = reader ?? throw new ArgumentNullException(nameof(reader));
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
namespace AK.Abr
22
{
3-
public class CachedAbrReaderFactory : IAbrReaderFactory
3+
public class CachingAbrReaderFactory : IAbrReaderFactory
44
{
55
private readonly IAbrReaderFactory _factory;
66
private readonly IBitmapCache _cache;
77

8-
public CachedAbrReaderFactory(IAbrReaderFactory factory, IBitmapCache cache) {
8+
public CachingAbrReaderFactory(IAbrReaderFactory factory, IBitmapCache cache) {
99
_factory = factory;
1010
_cache = cache;
1111
}
1212

1313
public IAbrReader GetReader(IAbrSource source) {
14-
return new CachedAbrReader(_factory.GetReader(source), _cache);
14+
return new CachingAbrReader(_factory.GetReader(source), _cache);
1515
}
1616

1717
public override string ToString() {
18-
return $"CachedAbrReaderFactory [Cache={_cache.ToString()}]";
18+
return $"CachingAbrReaderFactory [Cache={_cache.ToString()}]";
1919
}
2020
}
2121
}

AK.Abr/MemoryBitmapCache.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ public void PutBitmap(string key, long timestamp, int index, BitmapSource bitmap
100100
}
101101

102102
private int GetItemsCount() {
103-
lock (_sync) {
104-
return _cache.Keys.Select(key => _cache[key].Elements.Count).Sum();
105-
}
103+
return _cache.Keys.Select(key => _cache[key].Elements.Count).Sum();
106104
}
107105

108106
public override string ToString() {
109-
return $"MemoryCache ({GetItemsCount()}/{_capacity})";
107+
lock (_sync) {
108+
return $"MemoryCache ({_cache.Keys.Count}:{GetItemsCount()}/{_capacity})";
109+
}
110110
}
111111

112112
public void Dispose() {

AK.Abr/Properties/Resources.Designer.cs

Lines changed: 53 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AK.Abr/Properties/Settings.Designer.cs

Lines changed: 16 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AbrViewer.sln

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

2-
Microsoft Visual Studio Solution File, Format Version 11.00
3-
# Visual Studio 2010
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.28307.1267
5+
MinimumVisualStudioVersion = 10.0.40219.1
46
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbrViewer", "AbrViewer\AbrViewer.csproj", "{6C502DE0-4D12-494C-90C7-58B7B22051AE}"
57
EndProject
68
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AK.Abr", "AK.Abr\AK.Abr.csproj", "{5BAEF14C-17BB-4E1C-8233-A2BA5ABDDD27}"
@@ -9,37 +11,31 @@ Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|Any CPU = Debug|Any CPU
1113
Debug|Mixed Platforms = Debug|Mixed Platforms
12-
Debug|x86 = Debug|x86
1314
Release|Any CPU = Release|Any CPU
1415
Release|Mixed Platforms = Release|Mixed Platforms
15-
Release|x86 = Release|x86
1616
EndGlobalSection
1717
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18-
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Debug|Any CPU.ActiveCfg = Debug|x86
19-
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
20-
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Debug|Mixed Platforms.Build.0 = Debug|x86
21-
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Debug|x86.ActiveCfg = Debug|x86
22-
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Debug|x86.Build.0 = Debug|x86
23-
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Release|Any CPU.ActiveCfg = Release|x86
24-
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Release|Mixed Platforms.ActiveCfg = Release|x86
25-
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Release|Mixed Platforms.Build.0 = Release|x86
26-
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Release|x86.ActiveCfg = Release|x86
27-
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Release|x86.Build.0 = Release|x86
18+
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
21+
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
22+
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Release|Any CPU.Build.0 = Release|Any CPU
24+
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
25+
{6C502DE0-4D12-494C-90C7-58B7B22051AE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
2826
{5BAEF14C-17BB-4E1C-8233-A2BA5ABDDD27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2927
{5BAEF14C-17BB-4E1C-8233-A2BA5ABDDD27}.Debug|Any CPU.Build.0 = Debug|Any CPU
3028
{5BAEF14C-17BB-4E1C-8233-A2BA5ABDDD27}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
3129
{5BAEF14C-17BB-4E1C-8233-A2BA5ABDDD27}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
32-
{5BAEF14C-17BB-4E1C-8233-A2BA5ABDDD27}.Debug|x86.ActiveCfg = Debug|Any CPU
3330
{5BAEF14C-17BB-4E1C-8233-A2BA5ABDDD27}.Release|Any CPU.ActiveCfg = Release|Any CPU
3431
{5BAEF14C-17BB-4E1C-8233-A2BA5ABDDD27}.Release|Any CPU.Build.0 = Release|Any CPU
3532
{5BAEF14C-17BB-4E1C-8233-A2BA5ABDDD27}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
3633
{5BAEF14C-17BB-4E1C-8233-A2BA5ABDDD27}.Release|Mixed Platforms.Build.0 = Release|Any CPU
37-
{5BAEF14C-17BB-4E1C-8233-A2BA5ABDDD27}.Release|x86.ActiveCfg = Release|Any CPU
3834
EndGlobalSection
3935
GlobalSection(SolutionProperties) = preSolution
4036
HideSolutionNode = FALSE
4137
EndGlobalSection
4238
GlobalSection(ExtensibilityGlobals) = postSolution
43-
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35
39+
SolutionGuid = {BDC6B8A1-6474-4C9A-9801-2C47D64857C8}
4440
EndGlobalSection
4541
EndGlobal

AbrViewer.sln.DotSettings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=AbrViewer_002EAnnotations/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

AbrViewer/AboutWindow.xaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
<Window x:Class="AbrViewer.AboutWindow"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:AbrViewer="clr-namespace:AbrViewer" Title="About" SizeToContent="Height" UseLayoutRounding="True"
4+
xmlns:support="clr-namespace:AbrViewer.Support"
5+
Title="About" SizeToContent="Height" UseLayoutRounding="True"
56
WindowStartupLocation="CenterOwner" ResizeMode="NoResize" ShowInTaskbar="False" Width="480" MouseDown="Window_MouseDown">
67
<Grid Height="200">
78
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
8-
<TextBlock HorizontalAlignment="Center" FontWeight="Bold"><Run Text="{x:Static AbrViewer:ApplicationInfo.ProductName}" /></TextBlock>
9-
<TextBlock HorizontalAlignment="Center" FontWeight="Bold">Version <Run Text="{x:Static AbrViewer:ApplicationInfo.Version}" /></TextBlock>
10-
<TextBlock HorizontalAlignment="Center"><Run Text="{x:Static AbrViewer:ApplicationInfo.Copyright}" /></TextBlock>
11-
<GroupBox Header="Configuration" BorderBrush="LightGray" BorderThickness="1">
9+
<Image Source="App.ico" Stretch="Uniform" Width="64" />
10+
<TextBlock HorizontalAlignment="Center" Margin="4" FontSize="16" FontWeight="Bold"><Run Text="{x:Static support:ApplicationInfo.ProductName}" /></TextBlock>
11+
<TextBlock HorizontalAlignment="Center" FontWeight="Bold">Version <Run Text="{x:Static support:ApplicationInfo.Version}" /></TextBlock>
12+
<TextBlock HorizontalAlignment="Center"><Run Text="{x:Static support:ApplicationInfo.Copyright}" /></TextBlock>
13+
<GroupBox Header="Configuration" BorderBrush="LightGray" BorderThickness="1" Padding="8">
1214
<TextBlock Text="{Binding ConfigInfo}" TextWrapping="Wrap" />
1315
</GroupBox>
1416
</StackPanel>

0 commit comments

Comments
 (0)