Improve UI

This commit is contained in:
azakhi 2018-08-19 23:01:32 +03:00
parent 961805272d
commit e5209fb459
3 changed files with 19 additions and 3 deletions

View File

@ -58,11 +58,24 @@ namespace Filtration.ViewModels
get get
{ {
string[] commentLines = ItemFilterCommentBlock.Comment.Split(new[] { Environment.NewLine }, StringSplitOptions.None); string[] commentLines = ItemFilterCommentBlock.Comment.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
if (commentLines[0].StartsWith(@"============") || commentLines[0].StartsWith(@"------------")) var titleOffset = 1;
if (commentLines.Length > 1 && (commentLines[0].StartsWith(@"============") || commentLines[0].StartsWith(@"------------")))
{ {
titleOffset = 3;
commentLines[0] = commentLines[1]; commentLines[0] = commentLines[1];
} }
return commentLines[0].TrimStart(' ');
commentLines[0] = commentLines[0].TrimStart(' ');
if (commentLines[0].Length > 80)
{
commentLines[0] = commentLines[0].Substring(0, 80) + " (...)";
}
else if (commentLines.Length > titleOffset)
{
commentLines[0] = commentLines[0] + " (...)";
}
return commentLines[0];
} }
} }

View File

@ -28,6 +28,9 @@ namespace Filtration.ViewModels.ToolPanes
icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/block_group_browser_icon.png"); icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/block_group_browser_icon.png");
icon.EndInit(); icon.EndInit();
IconSource = icon; IconSource = icon;
IsVisible = false;
Messenger.Default.Register<NotificationMessage<bool>>(this, message => Messenger.Default.Register<NotificationMessage<bool>>(this, message =>
{ {
switch (message.Notification) switch (message.Notification)

View File

@ -21,7 +21,7 @@
</ListBox.Resources> </ListBox.Resources>
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate DataType="viewModels:ItemFilterCommentBlockViewModel"> <DataTemplate DataType="viewModels:ItemFilterCommentBlockViewModel">
<TextBlock Text="{Binding Comment, Converter={StaticResource HashSignRemovalConverter}}" ToolTip="{Binding Comment}" /> <TextBlock Text="{Binding Header, Converter={StaticResource HashSignRemovalConverter}}" ToolTip="{Binding Comment}" />
</DataTemplate> </DataTemplate>
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
</ListBox> </ListBox>