Updated Ignore form to be a little cleaner, and hyperlinks now work.
This commit is contained in:
@@ -165,6 +165,7 @@ namespace TwitchDesktopNotifications.Core
|
||||
if (!found)
|
||||
{
|
||||
UserData streamer = FetchUserData(x.UserId);
|
||||
UIStreamer.GetCreateStreamer(x.DisplayName);
|
||||
Notification.GetInstance().sendNotification(streamer.DisplayName, "https://twitch.tv/" + streamer.UserName, streamer.ProfileImage, x.ThumbnailImg, x.Title);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,45 +6,45 @@
|
||||
xmlns:local="clr-namespace:TwitchDesktopNotifications"
|
||||
xmlns:core="clr-namespace:TwitchDesktopNotifications.Core"
|
||||
mc:Ignorable="d"
|
||||
Title="Manage Ignored Streamers" Height="435" Width="395" ResizeMode="NoResize">
|
||||
Title="Manage Ignored Streamers" Height="435" Width="395" ResizeMode="CanResizeWithGrip">
|
||||
<Window.DataContext>
|
||||
<core:UIStreamer />
|
||||
</Window.DataContext>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="10" />
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="10" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="10" />
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="10" />
|
||||
<RowDefinition Height="300" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="10" />
|
||||
<RowDefinition Height="25" />
|
||||
<RowDefinition Height="10" />
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid
|
||||
Grid.Column="1" Grid.ColumnSpan="3"
|
||||
Grid.Column="1"
|
||||
Grid.RowSpan="1" Grid.Row="3"
|
||||
x:Name="dgrdIgnore" ItemsSource="{Binding StreamersToIgnore}" AutoGenerateColumns="False">
|
||||
CanUserResizeColumns="False"
|
||||
x:Name="dgrdIgnore" ItemsSource="{Binding StreamersToIgnore}" SelectionChanged="dgrdIgnore_SelectionChanged" AutoGenerateColumns="False" CanUserAddRows="False">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Streamer Name" Binding="{Binding Name}" IsReadOnly="True" />
|
||||
<DataGridHyperlinkColumn Header="Streamer Link" Binding="{Binding Link}" IsReadOnly="True" />
|
||||
<DataGridCheckBoxColumn Header="Ignore" Binding="{Binding IsIgnored}" IsReadOnly="False">
|
||||
<DataGridCheckBoxColumn.CellStyle>
|
||||
<Style>
|
||||
<EventSetter Event="CheckBox.Checked" Handler="OnChecked" />
|
||||
</Style>
|
||||
</DataGridCheckBoxColumn.CellStyle>
|
||||
<DataGridCheckBoxColumn Header="Ignore" Binding="{Binding IsIgnored}" IsReadOnly="False" Width="50">
|
||||
</DataGridCheckBoxColumn>
|
||||
<DataGridTextColumn Header="Streamer Name" Binding="{Binding Name}" IsReadOnly="True" />
|
||||
<DataGridHyperlinkColumn Header="Streamer Link" Binding="{Binding Link}" Width="*">
|
||||
<DataGridHyperlinkColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<EventSetter Event="Hyperlink.Click" Handler="HyperLink_Click"/>
|
||||
</Style>
|
||||
</DataGridHyperlinkColumn.ElementStyle>
|
||||
</DataGridHyperlinkColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Button Content="Close" Grid.Column="3" Grid.Row="5" Click="CloseBtn_Click" />
|
||||
<TextBlock Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3" TextWrapping="Wrap" Text="Changes to the ignore list are automatically saved." VerticalAlignment="Top"/>
|
||||
<TextBlock Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3" TextWrapping="Wrap" Text="If you can't see a streamer Twitch Notify has not seen them." VerticalAlignment="Bottom"/>
|
||||
<Button Content="Close" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" Width="100" Grid.Row="5" Click="CloseBtn_Click" />
|
||||
<TextBlock Grid.Column="1" Grid.Row="1" TextWrapping="Wrap" Text="Changes to the ignore list are automatically saved." VerticalAlignment="Top"/>
|
||||
<TextBlock Grid.Column="1" Grid.Row="1" TextWrapping="Wrap" Text="If you can't see a streamer Twitch Notify has not seen them." VerticalAlignment="Bottom"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
using System.Windows;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Threading;
|
||||
using TwitchDesktopNotifications.Core;
|
||||
|
||||
namespace TwitchDesktopNotifications
|
||||
@@ -9,7 +13,6 @@ namespace TwitchDesktopNotifications
|
||||
/// </summary>
|
||||
public partial class ManageIgnores : Window
|
||||
{
|
||||
private bool updated = false;
|
||||
public ManageIgnores()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -22,9 +25,21 @@ namespace TwitchDesktopNotifications
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void OnChecked(object sender, RoutedEventArgs e)
|
||||
private void dgrdIgnore_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
updated= true;
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => dgrdIgnore.UnselectAll()));
|
||||
}
|
||||
|
||||
private void HyperLink_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string link = ((Hyperlink)e.OriginalSource).NavigateUri.OriginalString;
|
||||
|
||||
var psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = link,
|
||||
UseShellExecute = true
|
||||
};
|
||||
Process.Start(psi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user