From 0c1c3f8af8a526f14fcf4e2573884b0180f9c4b2 Mon Sep 17 00:00:00 2001 From: chkam05 Date: Wed, 31 Jan 2024 13:45:49 +0100 Subject: [PATCH] Added support for checking screens info --- SystemController/Screens/Data/ScreenInfo.cs | 22 +- .../Controls/KeyValueViewControl.xaml | 63 ++++ .../Controls/KeyValueViewControl.xaml.cs | 66 ++++ .../Data/Screens/ScreensDataContext.cs | 93 ++++++ .../ScreenSelectInternalMessage.xaml | 10 +- .../ScreenSelectInternalMessage.xaml.cs | 2 +- SystemManager/Pages/ScreensPage.xaml | 211 +++++++++++++ SystemManager/Pages/ScreensPage.xaml.cs | 257 ++++++++++++++++ SystemManager/Pages/ScreenshotPage.xaml.cs | 2 +- .../ViewModels/Screens/ScreenInfoViewModel.cs | 288 ++++++++++++++++++ SystemManager/Windows/MainWindow.xaml.cs | 8 + 11 files changed, 1010 insertions(+), 12 deletions(-) create mode 100644 SystemManager/Controls/KeyValueViewControl.xaml create mode 100644 SystemManager/Controls/KeyValueViewControl.xaml.cs create mode 100644 SystemManager/Data/Screens/ScreensDataContext.cs create mode 100644 SystemManager/Pages/ScreensPage.xaml create mode 100644 SystemManager/Pages/ScreensPage.xaml.cs create mode 100644 SystemManager/ViewModels/Screens/ScreenInfoViewModel.cs diff --git a/SystemController/Screens/Data/ScreenInfo.cs b/SystemController/Screens/Data/ScreenInfo.cs index 4f5e074..2737976 100644 --- a/SystemController/Screens/Data/ScreenInfo.cs +++ b/SystemController/Screens/Data/ScreenInfo.cs @@ -115,9 +115,14 @@ public bool IsInVirtualRange(int x, int y) /// Map virtual area to oryignal area. /// Virtual area react. /// Area mapped to oryginal area. - public Rectangle MapToOryginalSize(Rectangle virtualRect) + public Rectangle MapToOryginalSize(Rectangle virtualRect, bool onlySize = false) { - return MapToOryginalSize(virtualRect.X, virtualRect.Y, virtualRect.Width, virtualRect.Height); + return MapToOryginalSize( + virtualRect.X, + virtualRect.Y, + virtualRect.Width, + virtualRect.Height, + onlySize); } // -------------------------------------------------------------------------------- @@ -127,13 +132,14 @@ public Rectangle MapToOryginalSize(Rectangle virtualRect) /// Width. /// Height. /// Area mapped to oryginal area. - public Rectangle MapToOryginalSize(double x, double y, double width, double height) + public Rectangle MapToOryginalSize(double x, double y, double width, double height, bool onlySize = false) { return MapToOryginalSize( Convert.ToInt32(x), Convert.ToInt32(y), Convert.ToInt32(width), - Convert.ToInt32(height)); + Convert.ToInt32(height), + onlySize); } // -------------------------------------------------------------------------------- @@ -143,9 +149,13 @@ public Rectangle MapToOryginalSize(double x, double y, double width, double heig /// Width. /// Height. /// Area mapped to oryginal area. - public Rectangle MapToOryginalSize(int x, int y, int width, int height) + public Rectangle MapToOryginalSize(int x, int y, int width, int height, bool onlySize = false) { - return new Rectangle(ScaleX(x), ScaleY(y), ScaleX(width), ScaleY(height)); + return new Rectangle( + onlySize ? x :ScaleX(x), + onlySize ? y : ScaleY(y), + ScaleX(width), + ScaleY(height)); } // -------------------------------------------------------------------------------- diff --git a/SystemManager/Controls/KeyValueViewControl.xaml b/SystemManager/Controls/KeyValueViewControl.xaml new file mode 100644 index 0000000..2f02102 --- /dev/null +++ b/SystemManager/Controls/KeyValueViewControl.xaml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SystemManager/Controls/KeyValueViewControl.xaml.cs b/SystemManager/Controls/KeyValueViewControl.xaml.cs new file mode 100644 index 0000000..68c7477 --- /dev/null +++ b/SystemManager/Controls/KeyValueViewControl.xaml.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace SystemManager.Controls +{ + public partial class KeyValueViewControl : UserControl + { + + // DEPENDENCY PROPERTIES + + public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register( + nameof(Header), + typeof(string), + typeof(KeyValueViewControl), + new PropertyMetadata("")); + + public static readonly DependencyProperty ValueProperty = DependencyProperty.Register( + nameof(Value), + typeof(string), + typeof(KeyValueViewControl), + new PropertyMetadata("")); + + + // GETTERS & SETTERS + + public string Header + { + get { return (string)GetValue(HeaderProperty); } + set { SetValue(HeaderProperty, value); } + } + + public string Value + { + get { return (string)GetValue(HeaderProperty); } + set { SetValue(HeaderProperty, value); } + } + + + // METHODS + + #region CLASS METHODS + + // -------------------------------------------------------------------------------- + /// KeyValueViewControl class constructor. + public KeyValueViewControl() + { + // Initialize user interface. + InitializeComponent(); + } + + #endregion CLASS METHODS + + } +} diff --git a/SystemManager/Data/Screens/ScreensDataContext.cs b/SystemManager/Data/Screens/ScreensDataContext.cs new file mode 100644 index 0000000..d9191e7 --- /dev/null +++ b/SystemManager/Data/Screens/ScreensDataContext.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SystemController.Screens; +using SystemController.Screens.Data; +using SystemManager.ViewModels.Base; +using SystemManager.ViewModels.Screens; + +namespace SystemManager.Data.Screens +{ + public class ScreensDataContext : BaseViewModel + { + + // VARIABLES + + private ObservableCollection _screensCollection = new ObservableCollection(); + private ScreenInfoViewModel _selectedScreen; + + + // GETTERS & SETTERS + + public ObservableCollection ScreensCollection + { + get => _screensCollection; + set + { + UpdateProperty(ref _screensCollection, value); + _screensCollection.CollectionChanged += ScreensCollectionChanged; + } + } + + public ScreenInfoViewModel SelectedScreen + { + get => _selectedScreen; + set => UpdateProperty(ref _selectedScreen, value); + } + + + // METHODS + + #region CLASS METHODS + + // -------------------------------------------------------------------------------- + /// ScreensDataContext class constructor. + public ScreensDataContext() + { + ReloadScreens(); + } + + #endregion CLASS METHODS + + #region PROPERITES CHANGED METHODS + + // -------------------------------------------------------------------------------- + /// Method invoked after Screens collection changed. + /// Object that invoked the method. + /// Notify Collection Changed Event Arguments. + private void ScreensCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) + { + OnPropertyChanged(nameof(ScreensCollection)); + } + + #endregion PROPERITES CHANGED METHODS + + #region SCREENS MANAGEMENT METHODS + + // -------------------------------------------------------------------------------- + /// Reload screens. + public void ReloadScreens() + { + ScreensCollection = new ObservableCollection( + ScreenManager.GetAllScreens().Select(s => new ScreenInfoViewModel(s))); + } + + // -------------------------------------------------------------------------------- + /// Select screen. + /// Screen device name. + public void SelectScreen(string deviceName) + { + var screen = ScreensCollection.FirstOrDefault(s => s.DeviceName == deviceName); + + if (screen != null) + SelectedScreen = screen; + } + + #endregion SCREENS MANAGEMENT METHODS + + } +} diff --git a/SystemManager/InternalMessages/ScreenSelectInternalMessage.xaml b/SystemManager/InternalMessages/ScreenSelectInternalMessage.xaml index de721de..bda69c4 100644 --- a/SystemManager/InternalMessages/ScreenSelectInternalMessage.xaml +++ b/SystemManager/InternalMessages/ScreenSelectInternalMessage.xaml @@ -15,7 +15,7 @@ Background="{Binding ThemeBackgroundBrush, Source={StaticResource AppearanceConfig}, Mode=OneWay}" BorderBrush="{Binding AccentColorBrush, Source={StaticResource AppearanceConfig}, Mode=OneWay}" BottomBackground="{Binding ThemeShadeBackgroundBrush, Source={StaticResource AppearanceConfig}, Mode=OneWay}" - BottomBorderBrush="{Binding AccentColorBrush, Source={StaticResource AppearanceConfig}, Mode=OneWay}" + BottomBorderBrush="{Binding ThemeShadeBackgroundBrush, Source={StaticResource AppearanceConfig}, Mode=OneWay}" BottomPadding="8" ButtonBackground="{Binding AccentColorBrush, Source={StaticResource AppearanceConfig}, Mode=OneWay}" ButtonBorderBrush="{Binding AccentColorBrush, Source={StaticResource AppearanceConfig}, Mode=OneWay}" @@ -55,14 +55,16 @@ + VerticalScrollBarVisibility="Auto"> + x:Name="_canvas" + HorizontalAlignment="Center" + VerticalAlignment="Center"/> diff --git a/SystemManager/InternalMessages/ScreenSelectInternalMessage.xaml.cs b/SystemManager/InternalMessages/ScreenSelectInternalMessage.xaml.cs index 06dd48c..12ac315 100644 --- a/SystemManager/InternalMessages/ScreenSelectInternalMessage.xaml.cs +++ b/SystemManager/InternalMessages/ScreenSelectInternalMessage.xaml.cs @@ -20,7 +20,7 @@ public partial class ScreenSelectInternalMessage : StandardInternalMessageEx // CONST - private const double SCALING = 0.25d; + private const double SCALING = 0.10d; // VARIABLES diff --git a/SystemManager/Pages/ScreensPage.xaml b/SystemManager/Pages/ScreensPage.xaml new file mode 100644 index 0000000..cbf0532 --- /dev/null +++ b/SystemManager/Pages/ScreensPage.xaml @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SystemManager/Pages/ScreensPage.xaml.cs b/SystemManager/Pages/ScreensPage.xaml.cs new file mode 100644 index 0000000..9385c79 --- /dev/null +++ b/SystemManager/Pages/ScreensPage.xaml.cs @@ -0,0 +1,257 @@ +using chkam05.Tools.ControlsEx.InternalMessages; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Printing; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using SystemController.Screens.Data; +using SystemManager.Data.Configuration; +using SystemManager.Data.Screens; +using SystemManager.ViewModels.Screens; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrayNotify; + +namespace SystemManager.Pages +{ + public partial class ScreensPage : Page + { + + // CONST + + private const double SCALING = 0.10d; + + + // VARIABLES + + private ScreensDataContext _dataContext; + private InternalMessagesExContainer _imContainer; + private List _screensBorders; + + + // METHODS + + #region CLASS METHODS + + // -------------------------------------------------------------------------------- + /// ScreensPage class constructor. + /// InternalMessageExContainer. + public ScreensPage(InternalMessagesExContainer imContainer) + { + // Setup components. + _dataContext = new ScreensDataContext(); + _dataContext.PropertyChanged += DataContextPropertyUpdate; + _imContainer = imContainer; + _screensBorders = new List(); + + // Initialize user interface. + InitializeComponent(); + + // Set data context. + DataContext = _dataContext; + } + + #endregion CLASS METHODS + + #region COMPONENTS MANAGEMENT METHODS + + // -------------------------------------------------------------------------------- + /// Create screens representation. + private void CreateVisualScreensRepresentation() + { + if (_screensBorders.Any()) + ClearVisualScreensRepresentation(); + + foreach (var screenInfoViewModel in _dataContext.ScreensCollection) + { + var screenBorder = CreateScreenBorder(screenInfoViewModel.ScreenInfo); + var rect = screenInfoViewModel.ScreenInfo.OryginalRect; + + _screensBorders.Add(screenBorder); + _screensCanvas.Children.Add(screenBorder); + + Canvas.SetLeft(screenBorder, rect.X * SCALING); + Canvas.SetTop(screenBorder, rect.Y * SCALING); + } + + _screensScrollVeiwer.ScrollToHorizontalOffset(_screensCanvas.ActualWidth - _screensScrollVeiwer.ViewportWidth / 2); + _screensScrollVeiwer.ScrollToVerticalOffset(_screensCanvas.ActualHeight - _screensScrollVeiwer.ViewportHeight / 2); + } + + // -------------------------------------------------------------------------------- + /// Create border that represents screen. + /// Screen info. + /// Border that represents screen. + private Border CreateScreenBorder(ScreenInfo screenInfo) + { + var appearance = AppearanceConfig.Instance; + var accentColor = appearance.AccentColor; + var backgroundColor = Color.FromArgb(128, accentColor.R, accentColor.G, accentColor.B); + var background = new SolidColorBrush(backgroundColor); + var rect = screenInfo.OryginalRect; + + var border = new Border + { + Background = background, + BorderBrush = appearance.AccentColorBrush, + BorderThickness = new Thickness(1), + Child = CreateScreenText(screenInfo), + CornerRadius = new CornerRadius(8), + Cursor = Cursors.Hand, + Height = rect.Height * SCALING, + Width = rect.Width * SCALING, + }; + + border.MouseEnter += ScreenBorderMouseEnter; + border.MouseLeave += ScreenBorderMouseLeave; + border.PreviewMouseDown += ScreenBorderPreviewMoudeDown; + + return border; + } + + // -------------------------------------------------------------------------------- + /// Method invoked after cursor entered screen border. + /// Object that invoked the method. + /// Mouse Evnet Arguments. + private void ScreenBorderMouseEnter(object? sender, MouseEventArgs e) + { + if (sender is Border border) + { + var appearance = AppearanceConfig.Instance; + var accentColor = appearance.AccentColor; + var mouseOverColor = (appearance.AccentMouseOverBrush as SolidColorBrush)?.Color; + + if (mouseOverColor.HasValue) + { + var backgroundColor = Color.FromArgb(192, accentColor.R, accentColor.G, accentColor.B); + var background = new SolidColorBrush(backgroundColor); + + border.Background = background; + } + } + } + + // -------------------------------------------------------------------------------- + /// Method invoked after cursor leave screen border. + /// Object that invoked the method. + /// Mouse Evnet Arguments. + private void ScreenBorderMouseLeave(object? sender, MouseEventArgs e) + { + if (sender is Border border) + { + var appearance = AppearanceConfig.Instance; + var accentColor = appearance.AccentColor; + var backgroundColor = Color.FromArgb(128, accentColor.R, accentColor.G, accentColor.B); + var background = new SolidColorBrush(backgroundColor); + + border.Background = background; + } + } + + // -------------------------------------------------------------------------------- + /// Method invoked after pressing mouse button inside screen border. + /// Object that invoked the method. + /// Mouse Button Event Arguments. + private void ScreenBorderPreviewMoudeDown(object? sender, MouseButtonEventArgs e) + { + if (sender is Border border) + { + var textBlock = border.Child as TextBlock; + + if (textBlock != null) + _dataContext.SelectScreen(textBlock.Text); + } + } + + // -------------------------------------------------------------------------------- + /// Create text block with screen name. + /// Screen info. + /// TextBlock with screen name. + private TextBlock CreateScreenText(ScreenInfo screenInfo) + { + return new TextBlock() + { + HorizontalAlignment = System.Windows.HorizontalAlignment.Center, + Text = screenInfo.DeviceName, + VerticalAlignment = VerticalAlignment.Center + }; + } + + // -------------------------------------------------------------------------------- + /// Clear screens representation. + private void ClearVisualScreensRepresentation() + { + foreach (var screenBorder in _screensBorders) + { + if (_screensCanvas.Children.Contains(screenBorder)) + _screensCanvas.Children.Remove(screenBorder); + } + + _screensBorders.Clear(); + } + + #endregion COMPONENTS MANAGEMENT METHODS + + #region HEADER BUTTONS METHODS + + // -------------------------------------------------------------------------------- + /// Method invoked after clicking Refresh button. + /// Object that invoked the method. + /// Routed Event Arguments. + private void RefreshButtonExClick(object sender, RoutedEventArgs e) + { + _dataContext.ReloadScreens(); + } + + #endregion HEADER BUTTONS METHODS + + #region PAGE METHODS + + // -------------------------------------------------------------------------------- + /// Method invoked after loading page. + /// Object that invoked the method. + /// Routed Event Arguments. + private void Page_Loaded(object sender, RoutedEventArgs e) + { + CreateVisualScreensRepresentation(); + } + + // -------------------------------------------------------------------------------- + /// Method invoked after unloading page. + /// Object that invoked the method. + /// Routed Event Arguments. + private void Page_Unloaded(object sender, RoutedEventArgs e) + { + // + } + + #endregion PAGE METHODS + + #region PROPERITES CHANGED METHODS + + // -------------------------------------------------------------------------------- + /// Method invoked after updating property in DataContext. + /// Object that invoked the method. + /// Property Changed Event Arguments. + private void DataContextPropertyUpdate(object? sender, PropertyChangedEventArgs e) + { + if (e.PropertyName == nameof(ScreensDataContext.ScreensCollection)) + { + CreateVisualScreensRepresentation(); + } + } + + #endregion PROPERITES CHANGED METHODS + + } +} diff --git a/SystemManager/Pages/ScreenshotPage.xaml.cs b/SystemManager/Pages/ScreenshotPage.xaml.cs index c89dd96..da92b62 100644 --- a/SystemManager/Pages/ScreenshotPage.xaml.cs +++ b/SystemManager/Pages/ScreenshotPage.xaml.cs @@ -82,7 +82,7 @@ private void AreaCaptureButtonExClick(object sender, RoutedEventArgs e) var mappedRegion = selectedRegions.Select(r => r.Key.MapToOryginalSize(r.Value)) .Aggregate(System.Drawing.Rectangle.Union); - var screenBitmapImage = ScreenshotManager.CaptureAreaAsBitmapImage(e.Rectangle); + var screenBitmapImage = ScreenshotManager.CaptureAreaAsBitmapImage(mappedRegion); _dataContext.SetImageSource(screenBitmapImage); } else diff --git a/SystemManager/ViewModels/Screens/ScreenInfoViewModel.cs b/SystemManager/ViewModels/Screens/ScreenInfoViewModel.cs new file mode 100644 index 0000000..54d4365 --- /dev/null +++ b/SystemManager/ViewModels/Screens/ScreenInfoViewModel.cs @@ -0,0 +1,288 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SystemController.Screens.Data; +using SystemManager.ViewModels.Base; + +namespace SystemManager.ViewModels.Screens +{ + public class ScreenInfoViewModel : BaseViewModel + { + + // VARIABLES + + private ScreenInfo _screenInfo; + + + // GETTERS & SETTERS + + public ScreenInfo ScreenInfo + { + get => _screenInfo; + private set + { + UpdateProperty(ref _screenInfo, value); + UpdateProperties(); + } + } + + public int BitsPerPixel + { + get => _screenInfo.BitsPerPixel; + } + + public string? DeviceName + { + get => _screenInfo.DeviceName; + } + + public string? DevicePath + { + get => _screenInfo.DevicePath; + } + + public string? DriverVersion + { + get => _screenInfo.DriverVersion; + } + + public int? Frequency + { + get => _screenInfo.Frequency; + } + + public string? InternalDeviceName + { + get => _screenInfo.InternalDeviceName; + } + + public bool IsMainScreen + { + get => _screenInfo.IsMainScreen; + } + + public int? Orientation + { + get => _screenInfo.Orientation; + } + + public bool HasOryginalDimensions + { + get => _screenInfo.Position != null && _screenInfo.Size != null; + } + + public int PositionX + { + get => _screenInfo.Position?.X ?? _screenInfo.VirtualPosition.X; + } + + public int PositionY + { + get => _screenInfo.Position?.Y ?? _screenInfo.VirtualPosition.Y; + } + + public string PositionXY + { + get => $"{PositionX} x {PositionY}"; + } + + public int SizeWidth + { + get => _screenInfo.Size?.Width ?? _screenInfo.VirtualSize.Width; + } + + public int SizeHeight + { + get => _screenInfo.Size?.Height ?? _screenInfo.VirtualSize.Height; + } + + public string Size + { + get => $"{SizeWidth} x {SizeHeight}"; + } + + public string? SpecVersion + { + get => _screenInfo.SpecVersion; + } + + public int VirtualPositionX + { + get => _screenInfo.VirtualPosition.X; + } + + public int VirtualPositionY + { + get => _screenInfo.VirtualPosition.Y; + } + + public string VirtualPositionXY + { + get => $"{VirtualPositionX} x {VirtualPositionY}"; + } + + public int VirtualSizeWidth + { + get => _screenInfo.VirtualSize.Width; + } + + public int VirtualSizeHeight + { + get => _screenInfo.VirtualSize.Height; + } + + public string VirtualSize + { + get => $"{VirtualSizeWidth} x {VirtualSizeHeight}"; + } + + public bool HasOryginalWorkDimensions + { + get => _screenInfo.WorkPosition != null && _screenInfo.WorkSize != null; + } + + public int WorkPositionX + { + get => _screenInfo.WorkPosition?.X ?? _screenInfo.VirtualWorkPosition.X; + } + + public int WorkPositionY + { + get => _screenInfo.WorkPosition?.Y ?? _screenInfo.VirtualWorkPosition.Y; + } + + public string WorkPositionXY + { + get => $"{WorkPositionX} x {WorkPositionY}"; + } + + public int WorkSizeWidth + { + get => _screenInfo.WorkSize?.Width ?? _screenInfo.VirtualWorkSize.Width; + } + + public int WorkSizeHeight + { + get => _screenInfo.WorkSize?.Height ?? _screenInfo.VirtualWorkSize.Height; + } + + public string WorkSize + { + get => $"{WorkSizeWidth} x {WorkSizeHeight}"; + } + + public int VirtualWorkPositionX + { + get => _screenInfo.VirtualWorkPosition.X; + } + + public int VirtualWorkPositionY + { + get => _screenInfo.VirtualWorkPosition.Y; + } + + public string VirtualWorkPositionXY + { + get => $"{VirtualWorkPositionX} x {VirtualWorkPositionY}"; + } + + public int VirtualWorkSizeWidth + { + get => _screenInfo.VirtualWorkSize.Width; + } + + public int VirtualWorkSizeHeight + { + get => _screenInfo.VirtualWorkSize.Height; + } + + public string VirtualWorkSize + { + get => $"{VirtualWorkSizeWidth} x {VirtualWorkSizeHeight}"; + } + + public float? XScale + { + get => _screenInfo.XScale; + } + + public float? YScale + { + get => _screenInfo.YScale; + } + + public string? Scale + { + get => XScale.HasValue && YScale.HasValue + ? $"{XScale} x {YScale}" : null; + } + + + // METHODS + + #region CLASS METHODS + + // -------------------------------------------------------------------------------- + /// ScreenInfoViewModel class constructor. + /// Screen info. + public ScreenInfoViewModel(ScreenInfo screenInfo) + { + _screenInfo = screenInfo; + + UpdateProperties(); + } + + #endregion CLASS METHODS + + #region PROPERITES CHANGED METHODS + + // -------------------------------------------------------------------------------- + /// Update all properties. + private void UpdateProperties() + { + OnPropertyChanged(nameof(ScreenInfo)); + OnPropertyChanged(nameof(BitsPerPixel)); + OnPropertyChanged(nameof(DeviceName)); + OnPropertyChanged(nameof(DevicePath)); + OnPropertyChanged(nameof(DriverVersion)); + OnPropertyChanged(nameof(Frequency)); + OnPropertyChanged(nameof(InternalDeviceName)); + OnPropertyChanged(nameof(IsMainScreen)); + OnPropertyChanged(nameof(Orientation)); + OnPropertyChanged(nameof(HasOryginalDimensions)); + OnPropertyChanged(nameof(PositionX)); + OnPropertyChanged(nameof(PositionY)); + OnPropertyChanged(nameof(PositionXY)); + OnPropertyChanged(nameof(SizeWidth)); + OnPropertyChanged(nameof(SizeHeight)); + OnPropertyChanged(nameof(Size)); + OnPropertyChanged(nameof(SpecVersion)); + OnPropertyChanged(nameof(VirtualPositionX)); + OnPropertyChanged(nameof(VirtualPositionY)); + OnPropertyChanged(nameof(VirtualPositionXY)); + OnPropertyChanged(nameof(VirtualSizeWidth)); + OnPropertyChanged(nameof(VirtualSizeHeight)); + OnPropertyChanged(nameof(VirtualSize)); + OnPropertyChanged(nameof(HasOryginalWorkDimensions)); + OnPropertyChanged(nameof(WorkPositionX)); + OnPropertyChanged(nameof(WorkPositionY)); + OnPropertyChanged(nameof(WorkPositionXY)); + OnPropertyChanged(nameof(WorkSizeWidth)); + OnPropertyChanged(nameof(WorkSizeHeight)); + OnPropertyChanged(nameof(WorkSize)); + OnPropertyChanged(nameof(VirtualWorkPositionX)); + OnPropertyChanged(nameof(VirtualWorkPositionY)); + OnPropertyChanged(nameof(VirtualWorkPositionXY)); + OnPropertyChanged(nameof(VirtualWorkSizeWidth)); + OnPropertyChanged(nameof(VirtualWorkSizeHeight)); + OnPropertyChanged(nameof(VirtualWorkSize)); + OnPropertyChanged(nameof(XScale)); + OnPropertyChanged(nameof(YScale)); + } + + #endregion PROPERITES CHANGED METHODS + + } +} diff --git a/SystemManager/Windows/MainWindow.xaml.cs b/SystemManager/Windows/MainWindow.xaml.cs index d58aceb..027be28 100644 --- a/SystemManager/Windows/MainWindow.xaml.cs +++ b/SystemManager/Windows/MainWindow.xaml.cs @@ -108,6 +108,13 @@ private void OpenProcessesPageMainMenuItemSelect() PagesControl.LoadPageOrGetLast(new ProcessesPage(IMContainer)); } + // -------------------------------------------------------------------------------- + /// Open screens page main menu item. + private void OpenScreensPageMainMenuItemSelect() + { + PagesControl.LoadPageOrGetLast(new ScreensPage(IMContainer)); + } + // -------------------------------------------------------------------------------- /// Open screenshot page main menu item. private void OpenScreenshotsPageMainMenuItemSelect() @@ -156,6 +163,7 @@ private void SetupMainMenu() { new MainMenuItemViewModel("Macros", "Scripts for automated management", PackIconKind.Code, OpenMacrosPageMainMenuItemSelect), new MainMenuItemViewModel("Processes", "Show running processes", PackIconKind.Memory, OpenProcessesPageMainMenuItemSelect), + new MainMenuItemViewModel("Screens", "Show screens", PackIconKind.Monitors, OpenScreensPageMainMenuItemSelect), new MainMenuItemViewModel("Screenshot", "Make screenshots", PackIconKind.MonitorScreenshot, OpenScreenshotsPageMainMenuItemSelect), new MainMenuItemViewModel("Close", "Shut down application", PackIconKind.Power, CloseApplicationMainMenuItemSelect) };