C# Класс BrightnessTray.MainWindow

Interaction logic for MainWindow.xaml
Наследование: System.Windows.Window
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
AutostartMenuEventHandler void
CaffieneMenuEventHandler void
ContextMenuPopup void
CreateNotifyIcon void
DesktopPreferenceChangedHandler void
EventWatcher_BrightnessChanged void
Exit void
ExitButton_Click void
ExitMenuEventHandler void
HideWindow void
Hyperlink_Click void
MonitorOffMenuEventHandler void
NotifyIconClick void
ReleaseHandlers void
SetHandlers void
SetNonGlassBorder void
SleepHyperlink_Click void
SleepMenuEventHandler void
Slider_ValueChanged void
Window_Activated void
Window_Closing void
Window_Deactivated void
Window_GotKeyboardFocus void
Window_KeyDown void
Window_KeyUp void
Window_Loaded void
Window_PreviewMouseWheel void
WndProc System.IntPtr

Открытые методы

Метод Описание
MainWindow ( ) : System

Initializes a new instance of the MainWindow class.

UpdateWindowDisplay ( bool activatewindow ) : void

Updates the display (position and appearance) of the window.

UpdateWindowDisplayIfOpen ( bool activatewindow ) : void

Updates the display (position and appearance) of the window if it is currently visible.

Защищенные методы

Метод Описание
OnSourceInitialized ( EventArgs e ) : void

Adds hook to custom DefWindowProc function.

Приватные методы

Метод Описание
AutostartMenuEventHandler ( object sender, EventArgs e ) : void
CaffieneMenuEventHandler ( object sender, EventArgs e ) : void
ContextMenuPopup ( object sender, EventArgs e ) : void
CreateNotifyIcon ( ) : void

Creates notify icon and menu.

DesktopPreferenceChangedHandler ( object sender, Microsoft.Win32.UserPreferenceChangedEventArgs e ) : void

Handler for UserPreferenceChangedEventArgs that updates the window display when the user modifies his or her desktop. Note: This does not detect taskbar changes when the taskbar is set to auto-hide.

EventWatcher_BrightnessChanged ( object sender, EventWatcherAsync e ) : void

Update the slider due to a brightness changed event.

Exit ( ) : void

Close the application.

ExitButton_Click ( object sender, RoutedEventArgs e ) : void

Exit button clicked method.

ExitMenuEventHandler ( object sender, EventArgs e ) : void

Exit menu button (notify icon) clicked method.

HideWindow ( ) : void

Hides the window

Hyperlink_Click ( object sender, RoutedEventArgs e ) : void

Hyperlink clicked method.

MonitorOffMenuEventHandler ( object sender, EventArgs e ) : void
NotifyIconClick ( object sender, System args ) : void

Notify icon clicked or double-clicked method.

ReleaseHandlers ( ) : void

Releases handlers set by SetHandlers().

SetHandlers ( ) : void

Sets handlers for notifying the application of desktop preference changes (taskbar movements, etc.).

SetNonGlassBorder ( bool windowactivated ) : void

Sets the border of the window when the DWM is not enabled. The colour of the border depends on whether the window is active or not.

SleepHyperlink_Click ( object sender, RoutedEventArgs e ) : void

Hyperlink clicked method.

SleepMenuEventHandler ( object sender, EventArgs e ) : void

Sleep menu button clicked method.

Slider_ValueChanged ( object sender, RoutedPropertyChangedEventArgs e ) : void

Change the monitor brightness when the slider value changes.

Window_Activated ( object sender, EventArgs e ) : void

Window activated method. Sets the window border colour if the DWM is disabled.

Window_Closing ( object sender, System e ) : void

Window closing method. Disposes of the notify icon, removes the custom window procedure and releases user preference change handlers.

Window_Deactivated ( object sender, EventArgs e ) : void

Window deactivated method. Hides window if not pinned and sets deactivated border colour if DWM is disabled.

Window_GotKeyboardFocus ( object sender, System.Windows.Input.KeyboardFocusChangedEventArgs e ) : void
Window_KeyDown ( object sender, System.Windows.Input.KeyEventArgs e ) : void
Window_KeyUp ( object sender, System.Windows.Input.KeyEventArgs e ) : void
Window_Loaded ( object sender, RoutedEventArgs e ) : void

Window loaded method. We update the window display before it is made visible, otherwise the user will see its position jump when the notify icon is first clicked.

Window_PreviewMouseWheel ( object sender, System.Windows.Input.MouseWheelEventArgs e ) : void
WndProc ( IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam, bool &handled ) : IntPtr

Custom DefWindowProc function used to disable resize and update the window appearance when the window size is changed or the DWM is enabled/disabled.

Описание методов

MainWindow() публичный Метод

Initializes a new instance of the MainWindow class.
public MainWindow ( ) : System
Результат System

OnSourceInitialized() защищенный Метод

Adds hook to custom DefWindowProc function.
protected OnSourceInitialized ( EventArgs e ) : void
e System.EventArgs OnSourceInitialized EventArgs.
Результат void

UpdateWindowDisplay() публичный Метод

Updates the display (position and appearance) of the window.
public UpdateWindowDisplay ( bool activatewindow ) : void
activatewindow bool True if the window should be activated, false if not.
Результат void

UpdateWindowDisplayIfOpen() публичный Метод

Updates the display (position and appearance) of the window if it is currently visible.
public UpdateWindowDisplayIfOpen ( bool activatewindow ) : void
activatewindow bool True if the window should be activated, false if not.
Результат void