using System.Diagnostics; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Forms; using System.Windows.Interop; using System.Windows.Threading; using TwitchDesktopNotifications.Core; namespace TwitchDesktopNotifications { /// /// Interaction logic for ManageIgnores.xaml /// public partial class ManageIgnores : Window { public enum DWMWINDOWATTRIBUTE { DWMWA_NCRENDERING_ENABLED, DWMWA_NCRENDERING_POLICY, DWMWA_TRANSITIONS_FORCEDISABLED, DWMWA_ALLOW_NCPAINT, DWMWA_CAPTION_BUTTON_BOUNDS, DWMWA_NONCLIENT_RTL_LAYOUT, DWMWA_FORCE_ICONIC_REPRESENTATION, DWMWA_FLIP3D_POLICY, DWMWA_EXTENDED_FRAME_BOUNDS, DWMWA_HAS_ICONIC_BITMAP, DWMWA_DISALLOW_PEEK, DWMWA_EXCLUDED_FROM_PEEK, DWMWA_CLOAK, DWMWA_CLOAKED, DWMWA_FREEZE_REPRESENTATION, DWMWA_PASSIVE_UPDATE_MODE, DWMWA_USE_HOSTBACKDROPBRUSH, DWMWA_USE_IMMERSIVE_DARK_MODE = 20, DWMWA_WINDOW_CORNER_PREFERENCE = 33, DWMWA_BORDER_COLOR, DWMWA_CAPTION_COLOR, DWMWA_TEXT_COLOR, DWMWA_VISIBLE_FRAME_BORDER_THICKNESS, DWMWA_SYSTEMBACKDROP_TYPE, DWMWA_LAST } // The DWM_WINDOW_CORNER_PREFERENCE enum for DwmSetWindowAttribute's third parameter, which tells the function // what value of the enum to set. public enum DWM_WINDOW_CORNER_PREFERENCE { DWMWCP_DEFAULT = 0, DWMWCP_DONOTROUND = 1, DWMWCP_ROUND = 2, DWMWCP_ROUNDSMALL = 3 } // Import dwmapi.dll and define DwmSetWindowAttribute in C# corresponding to the native function. [DllImport("dwmapi.dll", CharSet = CharSet.Unicode, SetLastError = true)] private static extern long DwmSetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE attribute, ref uint pvAttribute, uint cbAttribute); public ManageIgnores() { InitializeComponent(); IntPtr hWnd = new WindowInteropHelper(GetWindow(this)).EnsureHandle(); var attribute = DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE; uint preference = 2; DwmSetWindowAttribute(hWnd, attribute, ref preference, sizeof(uint)); var attribute2 = DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE; uint colour = 1; DwmSetWindowAttribute(hWnd, attribute2, ref colour, sizeof(uint)); } List StreamersToIgnore = DataStore.GetInstance().Store.SteamersToIgnore.Streamers; private void CloseBtn_Click(object sender, RoutedEventArgs e) { this.Close(); } 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); } } }