FeedbackEventArgs; various test things; few handler changes

This commit is contained in:
Heath Volmer
2018-06-25 11:28:56 -06:00
parent 4686799371
commit f5b589bc2e
9 changed files with 130 additions and 22 deletions

View File

@@ -40,7 +40,7 @@ namespace PepperDash.Essentials.Core
InUseTracker = new InUseTracking();
InUseTracker.InUseFeedback.OutputChange +=new EventHandler<EventArgs>(InUseFeedback_OutputChange);
InUseTracker.InUseFeedback.OutputChange += InUseFeedback_OutputChange; //new EventHandler<EventArgs>();
}
void InUseFeedback_OutputChange(object sender, EventArgs e)

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core
{
public class FeedbackEventArgs : EventArgs
{
public bool BoolValue { get; private set; }
public int IntValue { get; private set; }
public ushort UShortValue
{
get
{
return (ushort)IntValue;
}
}
public string StringValue { get; private set; }
public eFeedbackEventType Type { get; private set; }
public FeedbackEventArgs(bool value)
{
BoolValue = value;
Type = eFeedbackEventType.TypeBool;
}
public FeedbackEventArgs(int value)
{
IntValue = value;
Type = eFeedbackEventType.TypeInt;
}
public FeedbackEventArgs(string value)
{
StringValue = value;
Type = eFeedbackEventType.TypeString;
}
}
public enum eFeedbackEventType
{
TypeBool,
TypeInt,
TypeString
}
}

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
public class FeedbackTest
{
public void doit()
{
var sf = new StringFeedback(() => "Ho");
sf.OutputChange += new EventHandler<FeedbackEventArgs>(sf_OutputChange);
}
void sf_OutputChange(object sender, EventArgs e)
{
throw new NotImplementedException();
}
}
public class Hmmm
{
IBasicCommunication comm;
public Hmmm()
{
comm.TextReceived += new EventHandler<GenericCommMethodReceiveTextArgs>(comm_TextReceived);
var d = new Dictionary<string, EventHandler<GenericCommMethodReceiveTextArgs>>
{
{ "textReceived1", comm_TextReceived}
};
}
void comm_TextReceived(object sender, GenericCommMethodReceiveTextArgs e)
{
throw new NotImplementedException();
}
}
}

View File

@@ -9,7 +9,7 @@ namespace PepperDash.Essentials.Core
{
public abstract class Feedback
{
public event EventHandler<EventArgs> OutputChange;
public event EventHandler<FeedbackEventArgs> OutputChange;
public virtual bool BoolValue { get { return false; } }
public virtual int IntValue { get { return 0; } }
@@ -60,13 +60,29 @@ namespace PepperDash.Essentials.Core
CrestronInvoke.BeginInvoke(o => FireUpdate());
}
/// <summary>
/// Helper method that fires event. Use this intstead of calling OutputChange
/// </summary>
protected void OnOutputChange()
{
if (OutputChange != null) OutputChange(this, EventArgs.Empty);
}
///// <summary>
///// Helper method that fires event. Use this intstead of calling OutputChange
///// </summary>
//protected void OnOutputChange()
//{
// if (OutputChange != null) OutputChange(this, EventArgs.Empty);
//}
protected void OnOutputChange(bool value)
{
if (OutputChange != null) OutputChange(this, new FeedbackEventArgs(value));
}
protected void OnOutputChange(int value)
{
if (OutputChange != null) OutputChange(this, new FeedbackEventArgs(value));
}
protected void OnOutputChange(string value)
{
if (OutputChange != null) OutputChange(this, new FeedbackEventArgs(value));
}
}
/// <summary>
@@ -116,7 +132,7 @@ namespace PepperDash.Essentials.Core
_BoolValue = newValue;
LinkedInputSigs.ForEach(s => UpdateSig(s));
LinkedComplementInputSigs.ForEach(s => UpdateComplementSig(s));
OnOutputChange();
OnOutputChange(newValue);
}
}
@@ -205,7 +221,7 @@ namespace PepperDash.Essentials.Core
{
_IntValue = newValue;
LinkedInputSigs.ForEach(s => UpdateSig(s));
OnOutputChange();
OnOutputChange(newValue);
}
}
@@ -282,7 +298,7 @@ namespace PepperDash.Essentials.Core
{
_StringValue = newValue;
LinkedInputSigs.ForEach(s => UpdateSig(s));
OnOutputChange();
OnOutputChange(newValue);
}
}

View File

@@ -73,7 +73,7 @@
<Reference Include="mscorlib" />
<Reference Include="PepperDash_Core, Version=1.0.1.26313, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll</HintPath>
<HintPath>..\..\..\pepperdash-simplsharp-core\CLZ Builds\PepperDash_Core.dll</HintPath>
</Reference>
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -111,6 +111,8 @@
<Compile Include="Crestron IO\Relay\GenericRelayDevice.cs" />
<Compile Include="Crestron IO\Relay\ISwitchedOutput.cs" />
<Compile Include="Devices\CodecInterfaces.cs" />
<Compile Include="Feedbacks\FeedbackTest.cs" />
<Compile Include="Feedbacks\FeedbackEventArgs.cs" />
<Compile Include="Global\JobTimer.cs" />
<Compile Include="Lighting\Lighting Interfaces.cs" />
<Compile Include="Lighting\LightingBase.cs" />

View File

@@ -57,7 +57,7 @@
<Reference Include="mscorlib" />
<Reference Include="PepperDash_Core, Version=1.0.4.20530, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\PepperDash.Core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll</HintPath>
<HintPath>..\..\..\pepperdash-simplsharp-core\CLZ Builds\PepperDash_Core.dll</HintPath>
</Reference>
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>

View File

@@ -65,7 +65,7 @@
<Reference Include="mscorlib" />
<Reference Include="PepperDash_Core, Version=1.0.4.20530, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\PepperDash.Core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll</HintPath>
<HintPath>..\..\..\pepperdash-simplsharp-core\CLZ Builds\PepperDash_Core.dll</HintPath>
</Reference>
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>

View File

@@ -71,13 +71,9 @@
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="PepperDashCorePortalSync, Version=1.0.0.27069, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\pepperdash-portal-sync\SspPortalSync\SspPortalSync\bin\PepperDashCorePortalSync.dll</HintPath>
</Reference>
<Reference Include="PepperDash_Core, Version=1.0.3.27452, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Release Package\PepperDash_Core.dll</HintPath>
<HintPath>..\..\..\pepperdash-simplsharp-core\CLZ Builds\PepperDash_Core.dll</HintPath>
</Reference>
<Reference Include="PepperDash_Essentials_DM, Version=1.0.0.19343, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -101,7 +97,7 @@
</Reference>
<Reference Include="SimplSharpReflectionInterface, Version=1.0.5583.25238, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />

View File

@@ -67,7 +67,7 @@ namespace PepperDash.Essentials
Room.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange);
Room.OnFeedback.OutputChange += new EventHandler<EventArgs>(OnFeedback_OutputChange);
Room.OnFeedback.OutputChange += OnFeedback_OutputChange;
Room.IsCoolingDownFeedback.OutputChange += new EventHandler<EventArgs>(IsCoolingDownFeedback_OutputChange);
Room.IsWarmingUpFeedback.OutputChange += new EventHandler<EventArgs>(IsWarmingUpFeedback_OutputChange);