private bool IsNotificationEnabled(IntPtr windowHandle, string?windowTitle, string?windowClass) { var titles = TextBoxTitles.GetLines(); var classes = TextBoxClasses.GetLines(); return(windowHandle != IntPtr.Zero && !_skipped.Exists(windowHandle) && (titles.Length == 0 && classes.Length == 0 || HasLineMatching(windowTitle, titles) || HasLineMatching(windowClass, classes)));
protected override void OnClosed(EventArgs e) { base.OnClosed(e); if (_hwndSource != null) { Win32.DeregisterShellHookWindow(_hwndSource.Handle); _hwndSource.RemoveHook(MessageHookProc); } _notifyWindow?.Close(); FileStorage.Store(new WindowData { Titles = TextBoxTitles.GetLines(), Classes = TextBoxClasses.GetLines() }); }
protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); var winData = FileStorage.Load <WindowData>(); if (winData != null) { TextBoxTitles.SetLines(winData.Titles); TextBoxClasses.SetLines(winData.Classes); } _hwndSource = PresentationSource.FromVisual(this) as HwndSource; if (_hwndSource != null) { _hwndSource.AddHook(MessageHookProc); Win32.RegisterShellHookWindow(_hwndSource.Handle); SetValue(_isDisabledPropertyKey, false); } }