centralize color definitions; override default control Background setter for ChannelBox;

pull/1/head
Bryan Biedenkapp 11 months ago
parent 3e77dc8579
commit ffd744425c

@ -1175,8 +1175,7 @@ namespace dvmconsole
if (!channel.IsSelected) if (!channel.IsSelected)
{ {
channel.IsSelected = true; channel.IsSelected = true;
channel.Background = channel.IsSelected ? ChannelBox.SELECTED_COLOR : ChannelBox.DESELECTED_COLOR;
channel.Background = channel.IsSelected ? (Brush)new BrushConverter().ConvertFrom("#FF0B004B") : Brushes.Gray;
if (channel.IsSelected) if (channel.IsSelected)
selectedChannelsManager.AddSelectedChannel(channel); selectedChannelsManager.AddSelectedChannel(channel);
@ -1630,9 +1629,9 @@ namespace dvmconsole
channel.LastSrcId = "Last: " + alias; channel.LastSrcId = "Last: " + alias;
if (channel.algId != P25Defines.P25_ALGO_UNENCRYPT) if (channel.algId != P25Defines.P25_ALGO_UNENCRYPT)
channel.Background = (Brush)new BrushConverter().ConvertFrom("#ffdeaf0a"); channel.Background = ChannelBox.RX_ENC_COLOR;
else else
channel.Background = (Brush)new BrushConverter().ConvertFrom("#FF00BC48"); channel.Background = ChannelBox.RX_COLOR;
} }
// Is the call over? // Is the call over?
@ -1641,7 +1640,7 @@ namespace dvmconsole
channel.IsReceiving = false; channel.IsReceiving = false;
TimeSpan callDuration = pktTime - slot.RxStart; TimeSpan callDuration = pktTime - slot.RxStart;
Console.WriteLine($"({system.Name}) P25D: Traffic *CALL END * PEER {e.PeerId} SRC_ID {e.SrcId} TGID {e.DstId} DUR {callDuration} [STREAM ID {e.StreamId}]"); Console.WriteLine($"({system.Name}) P25D: Traffic *CALL END * PEER {e.PeerId} SRC_ID {e.SrcId} TGID {e.DstId} DUR {callDuration} [STREAM ID {e.StreamId}]");
channel.Background = (Brush)new BrushConverter().ConvertFrom("#FF0B004B"); channel.Background = ChannelBox.SELECTED_COLOR;
callHistoryWindow.ChannelUnkeyed(cpgChannel.Name, (int)e.SrcId); callHistoryWindow.ChannelUnkeyed(cpgChannel.Name, (int)e.SrcId);
return; return;
} }

@ -27,9 +27,13 @@ namespace dvmconsole.Controls
/// </summary> /// </summary>
public partial class ChannelBox : UserControl, INotifyPropertyChanged public partial class ChannelBox : UserControl, INotifyPropertyChanged
{ {
private readonly static Brush DESELECTED_COLOR = Brushes.Gray; public readonly static Brush DESELECTED_COLOR = Brushes.Gray;
private readonly static Brush SELECTED_COLOR = (Brush)new BrushConverter().ConvertFrom("#FF0B004B"); public readonly static Brush SELECTED_COLOR = (Brush)new BrushConverter().ConvertFrom("#FF0B004B");
private readonly static Brush PLYBK_SELECTED_COLOR = (Brush)new BrushConverter().ConvertFrom("#FFC90000"); public readonly static Brush PLYBK_SELECTED_COLOR = (Brush)new BrushConverter().ConvertFrom("#FFC90000");
public readonly static Brush RX_COLOR = (Brush)new BrushConverter().ConvertFrom("#FF00BC48");
public readonly static Brush RX_ENC_COLOR = (Brush)new BrushConverter().ConvertFrom("#FFDEAF0A");
private readonly SelectedChannelsManager selectedChannelsManager; private readonly SelectedChannelsManager selectedChannelsManager;
private readonly AudioManager audioManager; private readonly AudioManager audioManager;
@ -89,6 +93,15 @@ namespace dvmconsole.Controls
/// </summary> /// </summary>
public string DstId { get; set; } public string DstId { get; set; }
/// <summary>
/// Gets or sets the <see cref="Brush"/> that fills the area between the bounds of the control border.
/// </summary>
public new Brush Background
{
get => ControlBorder.Background;
set => ControlBorder.Background = value;
}
/* /*
** Events ** Events
*/ */

Loading…
Cancel
Save

Powered by TurnKey Linux.