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 11 months 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;
}
/** WPF Events */
/// <summary>
///
/// </summary>

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

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

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

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

@ -20,9 +20,15 @@ namespace dvmconsole
/// </summary>
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;
/// <summary>
/// System.
/// </summary>
public Codeplug.System RadioSystem = null;
/// <summary>
@ -39,6 +45,8 @@ namespace dvmconsole
SystemCombo.SelectedIndex = 0;
}
/** WPF Events */
/// <summary>
///
/// </summary>

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

@ -51,13 +51,16 @@
<Separator />
<MenuItem Header="_QuickCall II" Click="ManualPage_Click" x:Name="menuQuickCall2" />
</MenuItem>
<MenuItem Header="View">
<MenuItem Header="_Dark Mode" IsCheckable="True" Checked="ToggleDarkMode_Click" Unchecked="ToggleDarkMode_Click" x:Name="menuDarkMode" />
</MenuItem>
</Menu>
<!-- Channel Widget Canvas -->
<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.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>
</ScrollViewer>

File diff suppressed because it is too large Load Diff

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

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

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

Loading…
Cancel
Save

Powered by TurnKey Linux.