mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-10 18:24:50 +00:00
Removes essentials-framework as a submodule and brings the files back into the main repo
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash.Essentials.Core.PageManagers
|
||||
{
|
||||
/// <summary>
|
||||
/// The PageManager classes are used to bridge a device to subpage
|
||||
/// visibility.
|
||||
/// </summary>
|
||||
public abstract class PageManager
|
||||
{
|
||||
protected List<uint> ActiveJoins = new List<uint>();
|
||||
|
||||
public abstract void Show();
|
||||
|
||||
public abstract void Hide();
|
||||
|
||||
/// <summary>
|
||||
/// For device types 1-49, returns the offset join for subpage management 10100 - 14900
|
||||
/// </summary>
|
||||
/// <param name="deviceType">1 through 49, as defined in some constants somewhere!</param>
|
||||
/// <returns></returns>
|
||||
public uint GetOffsetJoin(uint deviceType)
|
||||
{
|
||||
return 10000 + (deviceType * 100);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A simple class that hides and shows the default subpage for a given source type
|
||||
/// </summary>
|
||||
public class DefaultPageManager : PageManager
|
||||
{
|
||||
BasicTriList TriList;
|
||||
uint BackingPageJoin;
|
||||
|
||||
public DefaultPageManager(IUiDisplayInfo device, BasicTriList trilist)
|
||||
{
|
||||
TriList = trilist;
|
||||
BackingPageJoin = GetOffsetJoin(device.DisplayUiType) + 1;
|
||||
}
|
||||
|
||||
public DefaultPageManager(uint join, BasicTriList trilist)
|
||||
{
|
||||
TriList = trilist;
|
||||
BackingPageJoin = join;
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
TriList.BooleanInput[BackingPageJoin].BoolValue = true;
|
||||
}
|
||||
|
||||
public override void Hide()
|
||||
{
|
||||
TriList.BooleanInput[BackingPageJoin].BoolValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A page manager for a page with backing panel and a switchable side panel
|
||||
/// </summary>
|
||||
public abstract class MediumLeftSwitchablePageManager : PageManager
|
||||
{
|
||||
protected BasicTriListWithSmartObject TriList;
|
||||
protected uint LeftSubpageJoin;
|
||||
protected uint BackingPageJoin;
|
||||
protected uint[] AllLeftSubpages;
|
||||
protected uint DisplayUiType;
|
||||
|
||||
protected MediumLeftSwitchablePageManager(uint displayUiType)
|
||||
{
|
||||
DisplayUiType = displayUiType;
|
||||
}
|
||||
|
||||
protected void InterlockLeftSubpage(uint join)
|
||||
{
|
||||
join = join + GetOffsetJoin();
|
||||
ClearLeftInterlock();
|
||||
TriList.BooleanInput[join].BoolValue = true;
|
||||
LeftSubpageJoin = join;
|
||||
}
|
||||
|
||||
protected void ClearLeftInterlock()
|
||||
{
|
||||
foreach (var p in AllLeftSubpages)
|
||||
TriList.BooleanInput[GetOffsetJoin() + p].BoolValue = false;
|
||||
}
|
||||
|
||||
protected uint GetOffsetJoin()
|
||||
{
|
||||
return GetOffsetJoin(DisplayUiType);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user