-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for checking screens info
- Loading branch information
Showing
11 changed files
with
1,010 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<UserControl | ||
x:Class="SystemManager.Controls.KeyValueViewControl" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:cex="clr-namespace:chkam05.Tools.ControlsEx;assembly=chkam05.Tools.ControlsEx" | ||
xmlns:cfg="clr-namespace:SystemManager.Data.Configuration" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:SystemManager.Controls" | ||
mc:Ignorable="d" | ||
|
||
Background="{x:Null}" | ||
BorderBrush="{x:Null}" | ||
BorderThickness="0" | ||
Foreground="{Binding ThemeForegroundBrush, Source={StaticResource AppearanceConfig}, Mode=OneWay}"> | ||
|
||
<UserControl.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="../Themes/Generic.xaml"/> | ||
</ResourceDictionary.MergedDictionaries> | ||
|
||
<!-- STATIC --> | ||
|
||
<x:Static x:Key="AppearanceConfig" Member="cfg:AppearanceConfig.Instance"/> | ||
<x:Static x:Key="ConfigManager" Member="cfg:ConfigManager.Instance"/> | ||
|
||
</ResourceDictionary> | ||
</UserControl.Resources> | ||
|
||
<Border | ||
Background="{Binding ThemeShadeBackgroundBrush, Source={StaticResource AppearanceConfig}, Mode=OneWay}" | ||
BorderBrush="{Binding ThemeShadeBackgroundBrush, Source={StaticResource AppearanceConfig}, Mode=OneWay}" | ||
BorderThickness="1" | ||
CornerRadius="8" | ||
Padding="8"> | ||
|
||
<Grid | ||
VerticalAlignment="Center"> | ||
|
||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="160"/> | ||
<ColumnDefinition Width="160"/> | ||
</Grid.ColumnDefinitions> | ||
|
||
<TextBlock | ||
Grid.Column="0" | ||
HorizontalAlignment="Left" | ||
Text="{Binding Header, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType=UserControl}}" | ||
VerticalAlignment="Center"/> | ||
|
||
<cex:TextBoxEx | ||
Grid.Column="1" | ||
HorizontalAlignment="Stretch" | ||
IsReadOnly="True" | ||
Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType=UserControl}}" | ||
VerticalAlignment="Center"/> | ||
|
||
</Grid> | ||
|
||
</Border> | ||
|
||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
||
// -------------------------------------------------------------------------------- | ||
/// <summary> KeyValueViewControl class constructor. </summary> | ||
public KeyValueViewControl() | ||
{ | ||
// Initialize user interface. | ||
InitializeComponent(); | ||
} | ||
|
||
#endregion CLASS METHODS | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ScreenInfoViewModel> _screensCollection = new ObservableCollection<ScreenInfoViewModel>(); | ||
private ScreenInfoViewModel _selectedScreen; | ||
|
||
|
||
// GETTERS & SETTERS | ||
|
||
public ObservableCollection<ScreenInfoViewModel> 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 | ||
|
||
// -------------------------------------------------------------------------------- | ||
/// <summary> ScreensDataContext class constructor. </summary> | ||
public ScreensDataContext() | ||
{ | ||
ReloadScreens(); | ||
} | ||
|
||
#endregion CLASS METHODS | ||
|
||
#region PROPERITES CHANGED METHODS | ||
|
||
// -------------------------------------------------------------------------------- | ||
/// <summary> Method invoked after Screens collection changed. </summary> | ||
/// <param name="sender"> Object that invoked the method. </param> | ||
/// <param name="e"> Notify Collection Changed Event Arguments. </param> | ||
private void ScreensCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) | ||
{ | ||
OnPropertyChanged(nameof(ScreensCollection)); | ||
} | ||
|
||
#endregion PROPERITES CHANGED METHODS | ||
|
||
#region SCREENS MANAGEMENT METHODS | ||
|
||
// -------------------------------------------------------------------------------- | ||
/// <summary> Reload screens. </summary> | ||
public void ReloadScreens() | ||
{ | ||
ScreensCollection = new ObservableCollection<ScreenInfoViewModel>( | ||
ScreenManager.GetAllScreens().Select(s => new ScreenInfoViewModel(s))); | ||
} | ||
|
||
// -------------------------------------------------------------------------------- | ||
/// <summary> Select screen. </summary> | ||
/// <param name="deviceName"> Screen device name. </param> | ||
public void SelectScreen(string deviceName) | ||
{ | ||
var screen = ScreensCollection.FirstOrDefault(s => s.DeviceName == deviceName); | ||
|
||
if (screen != null) | ||
SelectedScreen = screen; | ||
} | ||
|
||
#endregion SCREENS MANAGEMENT METHODS | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.