Skip to content

Commit

Permalink
minor newsticker enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
Epix37 committed Aug 20, 2015
1 parent 4d2e494 commit db7c30d
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
38 changes: 35 additions & 3 deletions Hearthstone Deck Tracker/MainWindow/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -585,19 +585,51 @@
<ItemsPanelTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
</Grid>
</ItemsPanelTemplate>
</StatusBar.ItemsPanel>
<StatusBarItem Content="NEWS:" Grid.Column="0"/>
<StatusBarItem Grid.Column="1">
<StatusBarItem Name="StatusBarItemNewsIndex" Content="(0/0)" Grid.Column="1"/>
<StatusBarItem Grid.Column="2">
<controls:TransitioningContentControl Name="NewsContentControl" Transition="Right"/>
</StatusBarItem>
<StatusBarItem Grid.Column="2">
<Button Name="BtnCloseNews" VerticalAlignment="Center" Height="24" Width="24" Style="{DynamicResource MetroCircleButtonStyle}" Background="Transparent" BorderThickness="0" Click="BtnCloseNews_OnClick">
<StatusBarItem Grid.Column="3">
<Button Name="BtnClosePrevious" VerticalAlignment="Center" Height="24" Width="24"
Style="{DynamicResource MetroCircleButtonStyle}" Background="Transparent"
BorderThickness="0" Click="BtnNewsPrevious_OnClick" ToolTip="Previous">
<Button.Content>
<Rectangle Width="8" Height="8">
<Rectangle.Fill>
<VisualBrush Visual="{StaticResource appbar_chevron_left_white}" />
</Rectangle.Fill>
</Rectangle>
</Button.Content>
</Button>
</StatusBarItem>
<StatusBarItem Grid.Column="4">
<Button Name="BtnNewsNext" VerticalAlignment="Center" Height="24" Width="24"
Style="{DynamicResource MetroCircleButtonStyle}" Background="Transparent"
BorderThickness="0" Click="BtnNewsNext_OnClick" ToolTip="Next">
<Button.Content>
<Rectangle Width="8" Height="8">
<Rectangle.Fill>
<VisualBrush Visual="{StaticResource appbar_chevron_right_white}" />
</Rectangle.Fill>
</Rectangle>
</Button.Content>
</Button>
</StatusBarItem>
<StatusBarItem Grid.Column="5">
<Button Name="BtnCloseNews" VerticalAlignment="Center" Height="24" Width="24"
Style="{DynamicResource MetroCircleButtonStyle}" Background="Transparent" BorderThickness="0"
Click="BtnCloseNews_OnClick" ToolTip="Close">
<Button.Content>
<Rectangle Width="8" Height="8">
<Rectangle.Fill>
Expand Down
17 changes: 17 additions & 0 deletions Hearthstone Deck Tracker/MainWindow/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,22 @@ private void BtnCloseNews_OnClick(object sender, RoutedEventArgs e)
MinHeight -= StatusBarNewsHeight;
TopRow.Height = new GridLength(0);
}

private void BtnNewsPrevious_OnClick(object sender, RoutedEventArgs e)
{
_newsLine--;
if(_newsLine < 0)
_newsLine = _news.Length - 1;
UpdateNews(_newsLine);
}

private void BtnNewsNext_OnClick(object sender, RoutedEventArgs e)
{
_newsLine++;
if(_newsLine > _news.Length - 1)
_newsLine = 0;
UpdateNews(_newsLine);
}

private async void MenuItemHearthStatsForceFullSync_OnClick(object sender, RoutedEventArgs e)
{
Expand Down Expand Up @@ -1046,6 +1062,7 @@ private void UpdateNews(int newsLine)
_currentNewsLine = _news[newsLine];
NewsContentControl.Content = StringToTextBlock(_currentNewsLine);
}
StatusBarItemNewsIndex.Content = string.Format("({0}/{1})", _newsLine + 1, _news.Length);
_lastNewsUpdate = DateTime.Now;
}

Expand Down
6 changes: 6 additions & 0 deletions Hearthstone Deck Tracker/Resources/Icons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
<Canvas x:Key="appbar_close_white" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
<Path Width="31.6666" Height="31.6667" Canvas.Left="22.1666" Canvas.Top="22.1667" Stretch="Fill" Fill="White" Data="F1 M 26.9166,22.1667L 37.9999,33.25L 49.0832,22.1668L 53.8332,26.9168L 42.7499,38L 53.8332,49.0834L 49.0833,53.8334L 37.9999,42.75L 26.9166,53.8334L 22.1666,49.0833L 33.25,38L 22.1667,26.9167L 26.9166,22.1667 Z "/>
</Canvas>
<Canvas x:Key="appbar_chevron_right_white" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
<Path Width="25.3333" Height="28.5" Canvas.Left="25.1849" Canvas.Top="23.3542" Stretch="Fill" Fill="White" Data="F1 M 39.8307,37.6042L 36.6641,34.4375L 25.1849,23.3542L 35.4766,23.3542L 50.5182,37.6042L 35.4766,51.8542L 25.1849,51.8542L 36.6641,40.7708L 39.8307,37.6042 Z "/>
</Canvas>
<Canvas x:Key="appbar_chevron_left_white" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
<Path Width="25.3333" Height="28.5" Canvas.Left="25.1849" Canvas.Top="23.3542" Stretch="Fill" Fill="White" Data="F1 M 35.8724,37.6042L 39.0391,40.7708L 50.5182,51.8542L 40.2266,51.8542L 25.1849,37.6041L 40.2266,23.3542L 50.5182,23.3542L 39.0391,34.4375L 35.8724,37.6042 Z "/>
</Canvas>
<Canvas x:Key="appbar_close" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
<Path Width="31.6666" Height="31.6667" Canvas.Left="22.1666" Canvas.Top="22.1667" Stretch="Fill" Fill="{DynamicResource TextBrush}" Data="F1 M 26.9166,22.1667L 37.9999,33.25L 49.0832,22.1668L 53.8332,26.9168L 42.7499,38L 53.8332,49.0834L 49.0833,53.8334L 37.9999,42.75L 26.9166,53.8334L 22.1666,49.0833L 33.25,38L 22.1667,26.9167L 26.9166,22.1667 Z "/>
</Canvas>
Expand Down

0 comments on commit db7c30d

Please sign in to comment.