when using editing mode change mouse pointer to move/scroll all while moving channel widgets; properly toggle loading mouse pointer while console loads; continue to tweak coloring;

pull/1/head
Bryan Biedenkapp 11 months ago
parent bd201d1aa8
commit f89bba07e2

@ -30,13 +30,12 @@ namespace dvmconsole.Controls
/// </summary> /// </summary>
public partial class ChannelBox : UserControl, INotifyPropertyChanged public partial class ChannelBox : UserControl, INotifyPropertyChanged
{ {
public readonly static Brush DESELECTED_COLOR = Brushes.Gray; public readonly static LinearGradientBrush GRAY_GRADIENT;
public readonly static Brush SELECTED_COLOR = (Brush)new BrushConverter().ConvertFrom("#FF0B004B"); public readonly static LinearGradientBrush DARK_GRAY_GRADIENT; // Delected/Disconnected Color
public readonly static Brush PLYBK_SELECTED_COLOR = (Brush)new BrushConverter().ConvertFrom("#FFC90000"); public readonly static LinearGradientBrush BLUE_GRADIENT; // Selected Channel Color
public readonly static LinearGradientBrush RED_GRADIENT; // Playback Selected Color
public readonly static Brush RX_COLOR = (Brush)new BrushConverter().ConvertFrom("#FF00BC48"); public readonly static LinearGradientBrush GREEN_GRADIENT; // Clear Rx Color
public readonly static Brush RX_ENC_COLOR = (Brush)new BrushConverter().ConvertFrom("#FFDEAF0A"); public readonly static LinearGradientBrush ORANGE_GRADIENT; // Encrypted Rx Color
private readonly SelectedChannelsManager selectedChannelsManager; private readonly SelectedChannelsManager selectedChannelsManager;
private readonly AudioManager audioManager; private readonly AudioManager audioManager;
@ -49,10 +48,6 @@ namespace dvmconsole.Controls
private double volume = 1.0; private double volume = 1.0;
private bool isSelected; private bool isSelected;
internal LinearGradientBrush grayGradient;
internal LinearGradientBrush redGradient;
internal LinearGradientBrush orangeGradient;
public FlashingBackgroundManager flashingBackgroundManager; public FlashingBackgroundManager flashingBackgroundManager;
public byte[] netLDU1 = new byte[9 * 25]; public byte[] netLDU1 = new byte[9 * 25];
@ -258,6 +253,66 @@ namespace dvmconsole.Controls
** Methods ** Methods
*/ */
/// <summary>
/// Static initialize for the <see cref="ChannelBox" class. />
/// </summary>
static ChannelBox()
{
GRAY_GRADIENT = new LinearGradientBrush
{
StartPoint = new Point(0.5, 0),
EndPoint = new Point(0.5, 1)
};
GRAY_GRADIENT.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#F0F0F0F0"), 0.485));
GRAY_GRADIENT.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#F0C2C2C2"), 0.517));
DARK_GRAY_GRADIENT = new LinearGradientBrush
{
StartPoint = new Point(0.5, 0),
EndPoint = new Point(0.5, 1)
};
DARK_GRAY_GRADIENT.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#F0979797"), 0.485));
DARK_GRAY_GRADIENT.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#F0686767"), 0.517));
BLUE_GRADIENT = new LinearGradientBrush
{
StartPoint = new Point(0.5, 0),
EndPoint = new Point(0.5, 1)
};
BLUE_GRADIENT.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#F0150189"), 0.485));
BLUE_GRADIENT.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#F00B004B"), 0.517));
RED_GRADIENT = new LinearGradientBrush
{
StartPoint = new Point(0.5, 0),
EndPoint = new Point(0.5, 1)
};
RED_GRADIENT.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#F0FF0000"), 0.485));
RED_GRADIENT.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#F0C60000"), 0.517));
GREEN_GRADIENT = new LinearGradientBrush
{
StartPoint = new Point(0.5, 0),
EndPoint = new Point(0.5, 1)
};
GREEN_GRADIENT.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#F000AF00"), 0.485));
GREEN_GRADIENT.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#F0008E00"), 0.517));
ORANGE_GRADIENT = new LinearGradientBrush
{
StartPoint = new Point(0.5, 0),
EndPoint = new Point(0.5, 1)
};
ORANGE_GRADIENT.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#F0FFAF00"), 0.485));
ORANGE_GRADIENT.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#F0C68700"), 0.517));
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ChannelBox"/> class. /// Initializes a new instance of the <see cref="ChannelBox"/> class.
/// </summary> /// </summary>
@ -286,36 +341,9 @@ namespace dvmconsole.Controls
MouseLeftButtonDown += ChannelBox_MouseLeftButtonDown; MouseLeftButtonDown += ChannelBox_MouseLeftButtonDown;
grayGradient = new LinearGradientBrush PttButton.Background = GRAY_GRADIENT;
{ PageSelectButton.Background = GRAY_GRADIENT;
StartPoint = new Point(0.5, 0), ChannelMarkerBtn.Background = GRAY_GRADIENT;
EndPoint = new Point(0.5, 1)
};
grayGradient.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FFF0F0F0"), 0.485));
grayGradient.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FFDCDCDC"), 0.517));
redGradient = new LinearGradientBrush
{
StartPoint = new Point(0.5, 0),
EndPoint = new Point(0.5, 1)
};
redGradient.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FFFF0000"), 0.485));
redGradient.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FFD50000"), 0.517));
orangeGradient = new LinearGradientBrush
{
StartPoint = new Point(0.5, 0),
EndPoint = new Point(0.5, 1)
};
orangeGradient.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FFFFAF00"), 0.485));
orangeGradient.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FFEEA400"), 0.517));
PttButton.Background = grayGradient;
PageSelectButton.Background = grayGradient;
ChannelMarkerBtn.Background = grayGradient;
if (SystemName == MainWindow.PLAYBACKSYS || ChannelName == MainWindow.PLAYBACKCHNAME || DstId == MainWindow.PLAYBACKTG) if (SystemName == MainWindow.PLAYBACKSYS || ChannelName == MainWindow.PLAYBACKCHNAME || DstId == MainWindow.PLAYBACKTG)
{ {
@ -350,7 +378,7 @@ namespace dvmconsole.Controls
return; return;
IsSelected = !IsSelected; IsSelected = !IsSelected;
ControlBorder.Background = IsSelected ? SELECTED_COLOR : DESELECTED_COLOR; ControlBorder.Background = IsSelected ? BLUE_GRADIENT : DARK_GRAY_GRADIENT;
if (IsSelected) if (IsSelected)
selectedChannelsManager.AddSelectedChannel(this); selectedChannelsManager.AddSelectedChannel(this);
@ -367,9 +395,9 @@ namespace dvmconsole.Controls
return; return;
if (PttState) if (PttState)
PttButton.Background = redGradient; PttButton.Background = RED_GRADIENT;
else else
PttButton.Background = grayGradient; PttButton.Background = GRAY_GRADIENT;
} }
/// <summary> /// <summary>
@ -381,9 +409,9 @@ namespace dvmconsole.Controls
return; return;
if (PageState) if (PageState)
PageSelectButton.Background = orangeGradient; PageSelectButton.Background = ORANGE_GRADIENT;
else else
PageSelectButton.Background = grayGradient; PageSelectButton.Background = GRAY_GRADIENT;
} }
private void UpdateHoldColor() private void UpdateHoldColor()
@ -392,9 +420,9 @@ namespace dvmconsole.Controls
return; return;
if (HoldState) if (HoldState)
ChannelMarkerBtn.Background = orangeGradient; ChannelMarkerBtn.Background = ORANGE_GRADIENT;
else else
ChannelMarkerBtn.Background = grayGradient; ChannelMarkerBtn.Background = GRAY_GRADIENT;
} }
/// <summary> /// <summary>
@ -404,11 +432,11 @@ namespace dvmconsole.Controls
{ {
if (SystemName == MainWindow.PLAYBACKSYS || ChannelName == MainWindow.PLAYBACKCHNAME || DstId == MainWindow.PLAYBACKTG) if (SystemName == MainWindow.PLAYBACKSYS || ChannelName == MainWindow.PLAYBACKCHNAME || DstId == MainWindow.PLAYBACKTG)
{ {
ControlBorder.Background = IsSelected ? PLYBK_SELECTED_COLOR : DESELECTED_COLOR; ControlBorder.Background = IsSelected ? RED_GRADIENT : DARK_GRAY_GRADIENT;
return; return;
} }
ControlBorder.Background = IsSelected ? SELECTED_COLOR : DESELECTED_COLOR; ControlBorder.Background = IsSelected ? BLUE_GRADIENT : DARK_GRAY_GRADIENT;
} }
/// <summary> /// <summary>

@ -83,6 +83,8 @@ namespace dvmconsole.Controls
{ {
InitializeComponent(); InitializeComponent();
DataContext = this; DataContext = this;
Background = ChannelBox.DARK_GRAY_GRADIENT;
} }
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="SystemStatusBox"/> class. /// Initializes a new instance of the <see cref="SystemStatusBox"/> class.

@ -36,7 +36,6 @@ using fnecore;
using fnecore.P25; using fnecore.P25;
using fnecore.P25.LC.TSBK; using fnecore.P25.LC.TSBK;
using fnecore.P25.KMM; using fnecore.P25.KMM;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
namespace dvmconsole namespace dvmconsole
{ {
@ -269,6 +268,8 @@ namespace dvmconsole
double offsetX = 20; double offsetX = 20;
double offsetY = 20; double offsetY = 20;
Cursor = Cursors.Wait;
if (Codeplug != null) if (Codeplug != null)
{ {
foreach (var system in Codeplug.Systems) foreach (var system in Codeplug.Systems)
@ -311,18 +312,17 @@ namespace dvmconsole
Trace.WriteLine("FNE Peer connected"); Trace.WriteLine("FNE Peer connected");
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
systemStatusBox.Background = (Brush)new BrushConverter().ConvertFrom("#FF00BC48"); systemStatusBox.Background = ChannelBox.GREEN_GRADIENT;
systemStatusBox.ConnectionState = "Connected"; systemStatusBox.ConnectionState = "Connected";
}); });
}; };
peer.peer.PeerDisconnected += (response) => peer.peer.PeerDisconnected += (response) =>
{ {
Trace.WriteLine("FNE Peer disconnected"); Trace.WriteLine("FNE Peer disconnected");
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
systemStatusBox.Background = new SolidColorBrush(Colors.DarkRed); systemStatusBox.Background = ChannelBox.RED_GRADIENT;
systemStatusBox.ConnectionState = "Disconnected"; systemStatusBox.ConnectionState = "Disconnected";
}); });
}; };
@ -431,6 +431,8 @@ namespace dvmconsole
playbackChannelBox.MouseLeftButtonUp += ChannelBox_MouseLeftButtonUp; playbackChannelBox.MouseLeftButtonUp += ChannelBox_MouseLeftButtonUp;
playbackChannelBox.MouseMove += ChannelBox_MouseMove; playbackChannelBox.MouseMove += ChannelBox_MouseMove;
channelsCanvas.Children.Add(playbackChannelBox); channelsCanvas.Children.Add(playbackChannelBox);
Cursor = Cursors.Arrow;
} }
/// <summary> /// <summary>
@ -715,7 +717,7 @@ namespace dvmconsole
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
//channel.PageState = false; // TODO: Investigate //channel.PageState = false; // TODO: Investigate
channel.PageSelectButton.Background = channel.grayGradient; channel.PageSelectButton.Background = ChannelBox.GRAY_GRADIENT;
}); });
} }
} }
@ -822,7 +824,7 @@ namespace dvmconsole
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
if (forHold) if (forHold)
channel.PttButton.Background = channel.grayGradient; channel.PttButton.Background = ChannelBox.GRAY_GRADIENT;
else else
channel.PageState = false; channel.PageState = false;
}); });
@ -971,6 +973,8 @@ namespace dvmconsole
offsetY = startPoint.Y - Canvas.GetTop(draggedElement); offsetY = startPoint.Y - Canvas.GetTop(draggedElement);
isDragging = true; isDragging = true;
Cursor = Cursors.ScrollAll;
element.CaptureMouse(); element.CaptureMouse();
} }
@ -984,6 +988,8 @@ namespace dvmconsole
if (!isEditMode || !isDragging || draggedElement == null) if (!isEditMode || !isDragging || draggedElement == null)
return; return;
Cursor = Cursors.Arrow;
isDragging = false; isDragging = false;
draggedElement.ReleaseMouseCapture(); draggedElement.ReleaseMouseCapture();
draggedElement = null; draggedElement = null;
@ -1374,7 +1380,7 @@ namespace dvmconsole
{ {
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
btnGlobalPtt.Background = channel.redGradient; btnGlobalPtt.Background = ChannelBox.RED_GRADIENT;
channel.PttState = true; channel.PttState = true;
}); });
@ -1384,7 +1390,7 @@ namespace dvmconsole
{ {
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
btnGlobalPtt.Background = channel.grayGradient; btnGlobalPtt.Background = ChannelBox.GRAY_GRADIENT;
channel.PttState = false; channel.PttState = false;
}); });
@ -1410,7 +1416,7 @@ namespace dvmconsole
Codeplug.Channel cpgChannel = Codeplug.GetChannelByName(channel.ChannelName); Codeplug.Channel cpgChannel = Codeplug.GetChannelByName(channel.ChannelName);
channel.IsSelected = selectAll; channel.IsSelected = selectAll;
channel.Background = channel.IsSelected ? ChannelBox.SELECTED_COLOR : ChannelBox.DESELECTED_COLOR; channel.Background = channel.IsSelected ? ChannelBox.BLUE_GRADIENT : ChannelBox.DARK_GRAY_GRADIENT;
if (channel.IsSelected) if (channel.IsSelected)
selectedChannelsManager.AddSelectedChannel(channel); selectedChannelsManager.AddSelectedChannel(channel);
@ -1877,9 +1883,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 = ChannelBox.RX_ENC_COLOR; channel.Background = ChannelBox.ORANGE_GRADIENT;
else else
channel.Background = ChannelBox.RX_COLOR; channel.Background = ChannelBox.GREEN_GRADIENT;
} }
// Is the call over? // Is the call over?
@ -1888,7 +1894,7 @@ namespace dvmconsole
channel.IsReceiving = false; channel.IsReceiving = false;
TimeSpan callDuration = pktTime - slot.RxStart; TimeSpan callDuration = pktTime - slot.RxStart;
Trace.WriteLine($"({system.Name}) P25D: Traffic *CALL END * PEER {e.PeerId} SRC_ID {e.SrcId} TGID {e.DstId} DUR {callDuration} [STREAM ID {e.StreamId}]"); Trace.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 = ChannelBox.SELECTED_COLOR; channel.Background = ChannelBox.BLUE_GRADIENT;
callHistoryWindow.ChannelUnkeyed(cpgChannel.Name, (int)e.SrcId); callHistoryWindow.ChannelUnkeyed(cpgChannel.Name, (int)e.SrcId);
return; return;
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.