code cleanup; add initial "dark" mode functionality (right now this just swaps the main canvas background to a darker variant, but in the future can be used to change the whole UI between light and dark);

pull/1/head
Bryan Biedenkapp 1 year ago
parent 3ce7e64088
commit 6c91e967d3

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 KiB

Before

Width:  |  Height:  |  Size: 605 KiB

After

Width:  |  Height:  |  Size: 605 KiB

@ -132,6 +132,8 @@ namespace dvmconsole
return outputDevices; return outputDevices;
} }
/** WPF Events */
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

@ -18,34 +18,7 @@ using System.Windows.Media;
namespace dvmconsole namespace dvmconsole
{ {
/// <summary> /// <summary>
/// /// Data structure representing a call entry.
/// </summary>
public class CallHistoryViewModel
{
/*
** Properties
*/
/// <summary>
///
/// </summary>
public ObservableCollection<CallEntry> CallHistory { get; set; }
/*
** Methods
*/
/// <summary>
/// Initializes a new instance of the <see cref="CallHistoryViewModel"/> class.
/// </summary>
public CallHistoryViewModel()
{
CallHistory = new ObservableCollection<CallEntry>();
}
} // public class CallHistoryViewModel
/// <summary>
///
/// </summary> /// </summary>
public class CallEntry : DependencyObject public class CallEntry : DependencyObject
{ {
@ -57,20 +30,20 @@ namespace dvmconsole
*/ */
/// <summary> /// <summary>
/// /// Textual name of channel call was received on.
/// </summary> /// </summary>
public string Channel { get; set; } public string Channel { get; set; }
/// <summary> /// <summary>
/// /// Source ID.
/// </summary> /// </summary>
public int SrcId { get; set; } public int SrcId { get; set; }
/// <summary> /// <summary>
/// /// Destination ID.
/// </summary> /// </summary>
public int DstId { get; set; } public int DstId { get; set; }
/// <summary> /// <summary>
/// /// Background color for call entry.
/// </summary> /// </summary>
public Brush BackgroundColor public Brush BackgroundColor
{ {
@ -79,6 +52,33 @@ namespace dvmconsole
} }
} // public class CallEntry : DependencyObject } // public class CallEntry : DependencyObject
/// <summary>
/// Data view model representing the call history.
/// </summary>
public class CallHistoryViewModel
{
/*
** Properties
*/
/// <summary>
/// Collection of call history entries.
/// </summary>
public ObservableCollection<CallEntry> CallHistory { get; set; }
/*
** Methods
*/
/// <summary>
/// Initializes a new instance of the <see cref="CallHistoryViewModel"/> class.
/// </summary>
public CallHistoryViewModel()
{
CallHistory = new ObservableCollection<CallEntry>();
}
} // public class CallHistoryViewModel
/// <summary> /// <summary>
/// Interaction logic for CallHistoryWindow.xaml. /// Interaction logic for CallHistoryWindow.xaml.
/// </summary> /// </summary>
@ -89,7 +89,7 @@ namespace dvmconsole
*/ */
/// <summary> /// <summary>
/// /// Gets or sets the <see cref="CallHistoryViewModel"/> view model for the window.
/// </summary> /// </summary>
public CallHistoryViewModel ViewModel { get; set; } public CallHistoryViewModel ViewModel { get; set; }

@ -13,7 +13,6 @@
*/ */
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Windows; using System.Windows;
@ -78,15 +77,15 @@ namespace dvmconsole.Controls
*/ */
/// <summary> /// <summary>
/// /// Textual name of channel.
/// </summary> /// </summary>
public string ChannelName { get; set; } public string ChannelName { get; set; }
/// <summary> /// <summary>
/// /// Textual name of system channel belongs to.
/// </summary> /// </summary>
public string SystemName { get; set; } public string SystemName { get; set; }
/// <summary> /// <summary>
/// /// Destination ID.
/// </summary> /// </summary>
public string DstId { get; set; } public string DstId { get; set; }
@ -104,33 +103,33 @@ namespace dvmconsole.Controls
*/ */
/// <summary> /// <summary>
/// /// Event action that handles the PTT button being clicked.
/// </summary> /// </summary>
public event EventHandler<ChannelBox> PTTButtonClicked; public event EventHandler<ChannelBox> PTTButtonClicked;
/// <summary> /// <summary>
/// /// Event action that handles the page button being clicked.
/// </summary> /// </summary>
public event EventHandler<ChannelBox> PageButtonClicked; public event EventHandler<ChannelBox> PageButtonClicked;
/// <summary> /// <summary>
/// /// Event action that handles the hold channel button being clicked.
/// </summary> /// </summary>
public event EventHandler<ChannelBox> HoldChannelButtonClicked; public event EventHandler<ChannelBox> HoldChannelButtonClicked;
/// <summary> /// <summary>
/// /// Event action that occurs when a property changes on this control.
/// </summary> /// </summary>
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
/// <summary> /// <summary>
/// /// Flag indicating whether or not this channel is receiving.
/// </summary> /// </summary>
public bool IsReceiving { get; set; } = false; public bool IsReceiving { get; set; } = false;
/// <summary> /// <summary>
/// /// Flag indicating whether or not this channel is receiving encrypted.
/// </summary> /// </summary>
public bool IsReceivingEncrypted { get; set; } = false; public bool IsReceivingEncrypted { get; set; } = false;
/// <summary> /// <summary>
/// /// Last Source ID received.
/// </summary> /// </summary>
public string LastSrcId public string LastSrcId
{ {
@ -146,7 +145,7 @@ namespace dvmconsole.Controls
} }
/// <summary> /// <summary>
/// /// Flag indicating the current PTT state of this channel.
/// </summary> /// </summary>
public bool PttState public bool PttState
{ {
@ -159,7 +158,7 @@ namespace dvmconsole.Controls
} }
/// <summary> /// <summary>
/// /// Flag indicating the current page state of this channel.
/// </summary> /// </summary>
public bool PageState public bool PageState
{ {
@ -172,7 +171,7 @@ namespace dvmconsole.Controls
} }
/// <summary> /// <summary>
/// /// Flag indicating the hold state of this channel.
/// </summary> /// </summary>
public bool HoldState public bool HoldState
{ {
@ -185,7 +184,7 @@ namespace dvmconsole.Controls
} }
/// <summary> /// <summary>
/// /// Flag indicating the emergency state of this channel.
/// </summary> /// </summary>
public bool Emergency public bool Emergency
{ {
@ -210,12 +209,12 @@ namespace dvmconsole.Controls
public string VoiceChannel { get; set; } public string VoiceChannel { get; set; }
/// <summary> /// <summary>
/// /// Flag indicating whether or not edit mode is enabled.
/// </summary> /// </summary>
public bool IsEditMode { get; set; } public bool IsEditMode { get; set; }
/// <summary> /// <summary>
/// /// Flag indicating whether or not this channel is selected.
/// </summary> /// </summary>
public bool IsSelected public bool IsSelected
{ {
@ -228,7 +227,7 @@ namespace dvmconsole.Controls
} }
/// <summary> /// <summary>
/// /// Current volume for this channel.
/// </summary> /// </summary>
public double Volume public double Volume
{ {
@ -247,7 +246,7 @@ namespace dvmconsole.Controls
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public uint txStreamId { get; internal set; } public uint TxStreamId { get; internal set; }
/* /*
** Methods ** Methods
@ -367,25 +366,6 @@ namespace dvmconsole.Controls
} }
} }
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ChannelBox_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (IsEditMode)
return;
IsSelected = !IsSelected;
ControlBorder.Background = IsSelected ? BLUE_GRADIENT : DARK_GRAY_GRADIENT;
if (IsSelected)
selectedChannelsManager.AddSelectedChannel(this);
else
selectedChannelsManager.RemoveSelectedChannel(this);
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -439,6 +419,36 @@ namespace dvmconsole.Controls
ControlBorder.Background = IsSelected ? BLUE_GRADIENT : DARK_GRAY_GRADIENT; ControlBorder.Background = IsSelected ? BLUE_GRADIENT : DARK_GRAY_GRADIENT;
} }
/// <summary>
///
/// </summary>
/// <param name="propertyName"></param>
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
/** WPF Events */
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ChannelBox_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (IsEditMode)
return;
IsSelected = !IsSelected;
ControlBorder.Background = IsSelected ? BLUE_GRADIENT : DARK_GRAY_GRADIENT;
if (IsSelected)
selectedChannelsManager.AddSelectedChannel(this);
else
selectedChannelsManager.RemoveSelectedChannel(this);
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -481,15 +491,6 @@ namespace dvmconsole.Controls
Volume = e.NewValue; Volume = e.NewValue;
} }
/// <summary>
///
/// </summary>
/// <param name="propertyName"></param>
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

@ -30,16 +30,16 @@ namespace dvmconsole.Controls
*/ */
/// <summary> /// <summary>
/// /// Textual name of the system.
/// </summary> /// </summary>
public string SystemName { get; set; } public string SystemName { get; set; }
/// <summary> /// <summary>
/// /// Address and port of the system.
/// </summary> /// </summary>
public string AddressPort { get; set; } public string AddressPort { get; set; }
/// <summary> /// <summary>
/// /// Connection state.
/// </summary> /// </summary>
public string ConnectionState public string ConnectionState
{ {
@ -68,7 +68,7 @@ namespace dvmconsole.Controls
*/ */
/// <summary> /// <summary>
/// /// Event action that occurs when a property changes on this control.
/// </summary> /// </summary>
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;

@ -29,7 +29,8 @@
<None Remove="Assets\alerttone.png" /> <None Remove="Assets\alerttone.png" />
<None Remove="Assets\AppIcon.ico" /> <None Remove="Assets\AppIcon.ico" />
<None Remove="Assets\audio.png" /> <None Remove="Assets\audio.png" />
<None Remove="Assets\bg_main_hd.png" /> <None Remove="Assets\bg_main_hd_dark.png" />
<None Remove="Assets\bg_main_hd_light.png" />
<None Remove="Assets\channelmarker.png" /> <None Remove="Assets\channelmarker.png" />
<None Remove="Assets\clearemerg.png" /> <None Remove="Assets\clearemerg.png" />
<None Remove="Assets\config.png" /> <None Remove="Assets\config.png" />
@ -62,7 +63,10 @@
<Resource Include="Assets\audio.png"> <Resource Include="Assets\audio.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Resource> </Resource>
<Resource Include="Assets\bg_main_hd.png"> <Resource Include="Assets\bg_main_hd_dark.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\bg_main_hd_light.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Resource> </Resource>
</ItemGroup> </ItemGroup>

@ -20,9 +20,15 @@ namespace dvmconsole
/// </summary> /// </summary>
public partial class DigitalPageWindow : Window public partial class DigitalPageWindow : Window
{ {
public List<Codeplug.System> systems = new List<Codeplug.System>(); private List<Codeplug.System> systems = new List<Codeplug.System>();
/// <summary>
/// Destination ID.
/// </summary>
public string DstId = string.Empty; public string DstId = string.Empty;
/// <summary>
/// System.
/// </summary>
public Codeplug.System RadioSystem = null; public Codeplug.System RadioSystem = null;
/// <summary> /// <summary>
@ -39,6 +45,8 @@ namespace dvmconsole
SystemCombo.SelectedIndex = 0; SystemCombo.SelectedIndex = 0;
} }
/** WPF Events */
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

@ -20,7 +20,7 @@ using dvmconsole.Controls;
namespace dvmconsole namespace dvmconsole
{ {
/// <summary> /// <summary>
/// /// Data structure representing a key status item.
/// </summary> /// </summary>
public class KeyStatusItem public class KeyStatusItem
{ {
@ -29,25 +29,25 @@ namespace dvmconsole
*/ */
/// <summary> /// <summary>
/// /// Textual name of channel key is for.
/// </summary> /// </summary>
public string ChannelName { get; set; } public string ChannelName { get; set; }
/// <summary> /// <summary>
/// /// Algorithm ID.
/// </summary> /// </summary>
public string AlgId { get; set; } public string AlgId { get; set; }
/// <summary> /// <summary>
/// /// Key ID.
/// </summary> /// </summary>
public string KeyId { get; set; } public string KeyId { get; set; }
/// <summary> /// <summary>
/// /// Key status.
/// </summary> /// </summary>
public string KeyStatus { get; set; } public string KeyStatus { get; set; }
} // public class KeyStatusItem } // public class KeyStatusItem
/// <summary> /// <summary>
/// /// Interaction logic for KeyStatusWindow.xaml.
/// </summary> /// </summary>
public partial class KeyStatusWindow : Window public partial class KeyStatusWindow : Window
{ {
@ -59,7 +59,7 @@ namespace dvmconsole
*/ */
/// <summary> /// <summary>
/// /// Collection of key status entries.
/// </summary> /// </summary>
public ObservableCollection<KeyStatusItem> KeyStatusItems { get; private set; } = new ObservableCollection<KeyStatusItem>(); public ObservableCollection<KeyStatusItem> KeyStatusItems { get; private set; } = new ObservableCollection<KeyStatusItem>();

@ -51,13 +51,16 @@
<Separator /> <Separator />
<MenuItem Header="_QuickCall II" Click="ManualPage_Click" x:Name="menuQuickCall2" /> <MenuItem Header="_QuickCall II" Click="ManualPage_Click" x:Name="menuQuickCall2" />
</MenuItem> </MenuItem>
<MenuItem Header="View">
<MenuItem Header="_Dark Mode" IsCheckable="True" Checked="ToggleDarkMode_Click" Unchecked="ToggleDarkMode_Click" x:Name="menuDarkMode" />
</MenuItem>
</Menu> </Menu>
<!-- Channel Widget Canvas --> <!-- Channel Widget Canvas -->
<ScrollViewer x:Name="canvasScrollViewer" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Grid.Row="2" Grid.ColumnSpan="2"> <ScrollViewer x:Name="canvasScrollViewer" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Grid.Row="2" Grid.ColumnSpan="2">
<Canvas x:Name="channelsCanvas" VerticalAlignment="Top"> <Canvas x:Name="channelsCanvas" VerticalAlignment="Top">
<Canvas.Background> <Canvas.Background>
<ImageBrush x:Name="channelsCanvasBg" ImageSource="/dvmconsole;component/Assets/bg_main_hd.png" Stretch="UniformToFill" /> <ImageBrush x:Name="channelsCanvasBg" ImageSource="/dvmconsole;component/Assets/bg_main_hd_light.png" Stretch="UniformToFill" />
</Canvas.Background> </Canvas.Background>
</Canvas> </Canvas>
</ScrollViewer> </ScrollViewer>

File diff suppressed because it is too large Load Diff

@ -20,7 +20,13 @@ namespace dvmconsole
/// </summary> /// </summary>
public partial class QuickCallPage : Window public partial class QuickCallPage : Window
{ {
/// <summary>
/// Tone A.
/// </summary>
public string ToneA; public string ToneA;
/// <summary>
/// Tone B.
/// </summary>
public string ToneB; public string ToneB;
/* /*
@ -35,6 +41,8 @@ namespace dvmconsole
InitializeComponent(); InitializeComponent();
} }
/** WPF Events */
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

@ -82,6 +82,10 @@ namespace dvmconsole
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public bool DarkMode { get; set; } = false;
/// <summary>
///
/// </summary>
public double WindowWidth { get; set; } = MainWindow.MIN_WIDTH; public double WindowWidth { get; set; } = MainWindow.MIN_WIDTH;
/// <summary> /// <summary>
/// ///
@ -128,6 +132,7 @@ namespace dvmconsole
AlertTonePositions = loadedSettings.AlertTonePositions ?? new Dictionary<string, ChannelPosition>(); AlertTonePositions = loadedSettings.AlertTonePositions ?? new Dictionary<string, ChannelPosition>();
ChannelOutputDevices = loadedSettings.ChannelOutputDevices ?? new Dictionary<string, int>(); ChannelOutputDevices = loadedSettings.ChannelOutputDevices ?? new Dictionary<string, int>();
Maximized = loadedSettings.Maximized; Maximized = loadedSettings.Maximized;
DarkMode = loadedSettings.DarkMode;
WindowWidth = loadedSettings.WindowWidth; WindowWidth = loadedSettings.WindowWidth;
if (WindowWidth == 0) if (WindowWidth == 0)
WindowWidth = MainWindow.MIN_WIDTH; WindowWidth = MainWindow.MIN_WIDTH;

@ -25,15 +25,15 @@ namespace dvmconsole
*/ */
/// <summary> /// <summary>
/// /// Flag indicating whether or not the system status widgets appear.
/// </summary> /// </summary>
public bool ShowSystemStatus { get; private set; } = true; public bool ShowSystemStatus { get; private set; } = true;
/// <summary> /// <summary>
/// /// Flag indicating whether or not the channel widgets appear.
/// </summary> /// </summary>
public bool ShowChannels { get; private set; } = true; public bool ShowChannels { get; private set; } = true;
/// <summary> /// <summary>
/// /// Flag indicating whether or not alert tone widgets appear.
/// </summary> /// </summary>
public bool ShowAlertTones { get; private set; } = true; public bool ShowAlertTones { get; private set; } = true;
@ -49,6 +49,8 @@ namespace dvmconsole
InitializeComponent(); InitializeComponent();
} }
/** WPF Events */
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

Loading…
Cancel
Save

Powered by TurnKey Linux.