mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-15 05:27:16 +00:00
chore: move all files to file-scoped namespace
This commit is contained in:
parent
aaa5b0532b
commit
3ece4f0b7b
522 changed files with 39628 additions and 45678 deletions
|
|
@ -2,135 +2,95 @@
|
|||
using System.Collections.Generic;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
namespace PepperDash.Essentials.Devices.Common.Displays;
|
||||
|
||||
public class MockDisplayInputs : ISelectableItems<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a MockDisplayInputs
|
||||
/// </summary>
|
||||
public class MockDisplayInputs : ISelectableItems<string>
|
||||
private Dictionary<string, ISelectableItem> _items;
|
||||
|
||||
public Dictionary<string, ISelectableItem> Items
|
||||
{
|
||||
private Dictionary<string, ISelectableItem> _items;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the collection of selectable items
|
||||
/// </summary>
|
||||
public Dictionary<string, ISelectableItem> Items
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
return _items;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_items == value)
|
||||
return;
|
||||
|
||||
_items = value;
|
||||
|
||||
ItemsUpdated?.Invoke(this, null);
|
||||
}
|
||||
return _items;
|
||||
}
|
||||
|
||||
private string _currentItem;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the currently selected item
|
||||
/// </summary>
|
||||
public string CurrentItem
|
||||
set
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentItem;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_currentItem == value)
|
||||
return;
|
||||
if (_items == value)
|
||||
return;
|
||||
|
||||
_currentItem = value;
|
||||
_items = value;
|
||||
|
||||
CurrentItemChanged?.Invoke(this, null);
|
||||
}
|
||||
ItemsUpdated?.Invoke(this, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the items collection is updated
|
||||
/// </summary>
|
||||
public event EventHandler ItemsUpdated;
|
||||
/// <summary>
|
||||
/// Occurs when the current item changes
|
||||
/// </summary>
|
||||
public event EventHandler CurrentItemChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MockDisplayInput
|
||||
/// </summary>
|
||||
public class MockDisplayInput : ISelectableItem
|
||||
private string _currentItem;
|
||||
|
||||
public string CurrentItem
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentItem;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_currentItem == value)
|
||||
return;
|
||||
|
||||
_currentItem = value;
|
||||
|
||||
CurrentItemChanged?.Invoke(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler ItemsUpdated;
|
||||
public event EventHandler CurrentItemChanged;
|
||||
}
|
||||
|
||||
public class MockDisplayInput : ISelectableItem
|
||||
{
|
||||
private MockDisplay _parent;
|
||||
|
||||
private bool _isSelected;
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
private MockDisplay _parent;
|
||||
|
||||
private bool _isSelected;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this input is selected
|
||||
/// </summary>
|
||||
public bool IsSelected
|
||||
get
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isSelected;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_isSelected == value)
|
||||
return;
|
||||
|
||||
_isSelected = value;
|
||||
|
||||
ItemUpdated?.Invoke(this, null);
|
||||
}
|
||||
return _isSelected;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Key
|
||||
/// </summary>
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when this item is updated
|
||||
/// </summary>
|
||||
public event EventHandler ItemUpdated;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MockDisplayInput class
|
||||
/// </summary>
|
||||
/// <param name="key">The input key</param>
|
||||
/// <param name="name">The input name</param>
|
||||
/// <param name="parent">The parent mock display</param>
|
||||
public MockDisplayInput(string key, string name, MockDisplay parent)
|
||||
set
|
||||
{
|
||||
Key = key;
|
||||
Name = name;
|
||||
_parent = parent;
|
||||
if (_isSelected == value)
|
||||
return;
|
||||
|
||||
_isSelected = value;
|
||||
|
||||
ItemUpdated?.Invoke(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Select method
|
||||
/// </summary>
|
||||
public void Select()
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Key { get; set; }
|
||||
|
||||
public event EventHandler ItemUpdated;
|
||||
|
||||
public MockDisplayInput(string key, string name, MockDisplay parent)
|
||||
{
|
||||
Key = key;
|
||||
Name = name;
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public void Select()
|
||||
{
|
||||
if (!_parent.PowerIsOnFeedback.BoolValue) _parent.PowerOn();
|
||||
|
||||
foreach(var input in _parent.Inputs.Items)
|
||||
{
|
||||
if (!_parent.PowerIsOnFeedback.BoolValue) _parent.PowerOn();
|
||||
|
||||
foreach (var input in _parent.Inputs.Items)
|
||||
{
|
||||
input.Value.IsSelected = input.Key == this.Key;
|
||||
}
|
||||
input.Value.IsSelected = input.Key == this.Key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue