mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2025-12-13 09:08:34 +00:00
Added events in the update-process
This commit is contained in:
parent
a0a0132ca0
commit
6f2e77b797
24
Devices/Generic/EventArgs/LedsUpdatedEventArgs.cs
Normal file
24
Devices/Generic/EventArgs/LedsUpdatedEventArgs.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace CUE.NET.Devices.Generic.EventArgs
|
||||||
|
{
|
||||||
|
public class LedsUpdatedEventArgs : System.EventArgs
|
||||||
|
{
|
||||||
|
#region Properties & Fields
|
||||||
|
|
||||||
|
public IEnumerable<KeyValuePair<int, CorsairLed>> UpdatedLeds { get; private set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
public LedsUpdatedEventArgs(IEnumerable<KeyValuePair<int, CorsairLed>> updatedLeds)
|
||||||
|
{
|
||||||
|
this.UpdatedLeds = new List<KeyValuePair<int, CorsairLed>>(updatedLeds); // Copy this - we don't want anyone to change the original led list.
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
24
Devices/Generic/EventArgs/LedsUpdatingEventArgs.cs
Normal file
24
Devices/Generic/EventArgs/LedsUpdatingEventArgs.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace CUE.NET.Devices.Generic.EventArgs
|
||||||
|
{
|
||||||
|
public class LedsUpdatingEventArgs : System.EventArgs
|
||||||
|
{
|
||||||
|
#region Properties & Fields
|
||||||
|
|
||||||
|
public ICollection<KeyValuePair<int, CorsairLed>> UpdatingLeds { get; private set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
public LedsUpdatingEventArgs(ICollection<KeyValuePair<int, CorsairLed>> updatingLeds)
|
||||||
|
{
|
||||||
|
this.UpdatingLeds = updatingLeds; // No copy here - before the update changing this is ok.
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
5
Devices/Generic/EventArgs/UpdatedEventArgs.cs
Normal file
5
Devices/Generic/EventArgs/UpdatedEventArgs.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
namespace CUE.NET.Devices.Generic.EventArgs
|
||||||
|
{
|
||||||
|
public class UpdatedEventArgs : System.EventArgs
|
||||||
|
{ }
|
||||||
|
}
|
||||||
5
Devices/Generic/EventArgs/UpdatingEventArgs.cs
Normal file
5
Devices/Generic/EventArgs/UpdatingEventArgs.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
namespace CUE.NET.Devices.Generic.EventArgs
|
||||||
|
{
|
||||||
|
public class UpdatingEventArgs : System.EventArgs
|
||||||
|
{ }
|
||||||
|
}
|
||||||
@ -146,18 +146,9 @@ namespace CUE.NET.Devices.Keyboard
|
|||||||
#region Update
|
#region Update
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates all groups and effects and perform an update for all dirty keys, or all keys if flushLeds is set to true.
|
/// Updates all brushes on the keyboard and on groups.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="flushLeds">Specifies whether all keys (including clean ones) should be updated.</param>
|
protected override void DeviceUpdate()
|
||||||
public override void Update(bool flushLeds = false)
|
|
||||||
{
|
|
||||||
UpdateBrushes();
|
|
||||||
|
|
||||||
// Perform 'real' update
|
|
||||||
base.Update(flushLeds);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateBrushes()
|
|
||||||
{
|
{
|
||||||
if (Brush != null)
|
if (Brush != null)
|
||||||
ApplyBrush(this.ToList(), Brush);
|
ApplyBrush(this.ToList(), Brush);
|
||||||
@ -203,7 +194,7 @@ namespace CUE.NET.Devices.Keyboard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ReSharper disable once CatchAllClause
|
// ReSharper disable once CatchAllClause
|
||||||
catch (Exception ex) { ManageException(ex); }
|
catch (Exception ex) { OnException(ex); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<CorsairLed> GetLeds()
|
public IEnumerable<CorsairLed> GetLeds()
|
||||||
|
|||||||
@ -38,6 +38,7 @@
|
|||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user