Skip to content

Commit 660e787

Browse files
committed
Dynamic Height
Fixes: #247 #275
1 parent 17041da commit 660e787

3 files changed

Lines changed: 189 additions & 123 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows.Data;
4+
5+
namespace SimpleDnsCrypt.Converters
6+
{
7+
public class HeightConverter : IValueConverter
8+
{
9+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
10+
{
11+
try
12+
{
13+
var actualHeight = (double)value;
14+
if (actualHeight > 700)
15+
{
16+
switch ((string)parameter)
17+
{
18+
case "Resolvers":
19+
return actualHeight - 400;
20+
case "QueryLog":
21+
return actualHeight - 200;
22+
case "DomainBlockLog":
23+
return actualHeight - 200;
24+
default:
25+
return actualHeight - 200;
26+
}
27+
}
28+
return actualHeight;
29+
}
30+
catch
31+
{
32+
return 0;
33+
}
34+
}
35+
36+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
37+
{
38+
throw new NotImplementedException();
39+
}
40+
}
41+
}

SimpleDnsCrypt/SimpleDnsCrypt.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
<Compile Include="Converters\BoolToVisibilityConverter.cs" />
146146
<Compile Include="Converters\BoolToVisibilityCollapsedConverter.cs" />
147147
<Compile Include="Converters\EnumToCollectionConverter.cs" />
148+
<Compile Include="Converters\HeightConverter.cs" />
148149
<Compile Include="Converters\IntegerBoolToVisibilityConverter.cs" />
149150
<Compile Include="Converters\IntegerToBoolConverter.cs" />
150151
<Compile Include="Converters\IntegerToVisibilityConverter.cs" />

0 commit comments

Comments
 (0)