diff --git a/WhackerLinkConsoleV2/App.xaml b/WhackerLinkConsoleV2/App.xaml
index 59a1e4a..bcd3856 100644
--- a/WhackerLinkConsoleV2/App.xaml
+++ b/WhackerLinkConsoleV2/App.xaml
@@ -1,9 +1,9 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/WhackerLinkConsoleV2/App.xaml.cs b/WhackerLinkConsoleV2/App.xaml.cs
index bed38dc..6f584cf 100644
--- a/WhackerLinkConsoleV2/App.xaml.cs
+++ b/WhackerLinkConsoleV2/App.xaml.cs
@@ -1,14 +1,14 @@
-using System.Configuration;
-using System.Data;
-using System.Windows;
-
-namespace WhackerLinkConsoleV2
-{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : Application
- {
- }
-
-}
+using System.Configuration;
+using System.Data;
+using System.Windows;
+
+namespace WhackerLinkConsoleV2
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+
+}
diff --git a/WhackerLinkConsoleV2/AssemblyInfo.cs b/WhackerLinkConsoleV2/AssemblyInfo.cs
index b0ec827..372e037 100644
--- a/WhackerLinkConsoleV2/AssemblyInfo.cs
+++ b/WhackerLinkConsoleV2/AssemblyInfo.cs
@@ -1,10 +1,10 @@
-using System.Windows;
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/WhackerLinkConsoleV2/ChannelBox.xaml b/WhackerLinkConsoleV2/ChannelBox.xaml
index e013952..908d130 100644
--- a/WhackerLinkConsoleV2/ChannelBox.xaml
+++ b/WhackerLinkConsoleV2/ChannelBox.xaml
@@ -1,22 +1,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WhackerLinkConsoleV2/ChannelBox.xaml.cs b/WhackerLinkConsoleV2/ChannelBox.xaml.cs
index 509985d..73d4fc7 100644
--- a/WhackerLinkConsoleV2/ChannelBox.xaml.cs
+++ b/WhackerLinkConsoleV2/ChannelBox.xaml.cs
@@ -1,85 +1,85 @@
-/*
-* WhackerLink - WhackerLinkConsoleV2
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*
-* Copyright (C) 2024 Caleb, K4PHP
-*
-*/
-
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-
-namespace WhackerLinkConsoleV2.Controls
-{
- public partial class ChannelBox : UserControl
- {
- public string ChannelName { get; set; }
- public string SystemName { get; set; }
- public string TGID { get; set; }
-
- public ChannelBox()
- {
- InitializeComponent();
- DataContext = this;
-
- MouseMove += ChannelBox_MouseMove;
- MouseDown += ChannelBox_MouseDown;
- MouseUp += ChannelBox_MouseUp;
- }
-
- public ChannelBox(string channelName, string systemName, string tgid) : this()
- {
- ChannelName = $"{channelName}";
- SystemName = $"System: {systemName}";
- TGID = $"TGID: {tgid}";
- }
-
- private Point _dragStartPoint;
- private bool _isDragging;
-
- private void ChannelBox_MouseDown(object sender, MouseButtonEventArgs e)
- {
- _dragStartPoint = e.GetPosition(null);
- _isDragging = false;
- }
-
- private void ChannelBox_MouseMove(object sender, MouseEventArgs e)
- {
- if (e.LeftButton == MouseButtonState.Pressed)
- {
- Point currentPosition = e.GetPosition(null);
-
- if (!_isDragging && (Math.Abs(currentPosition.X - _dragStartPoint.X) > SystemParameters.MinimumHorizontalDragDistance ||
- Math.Abs(currentPosition.Y - _dragStartPoint.Y) > SystemParameters.MinimumVerticalDragDistance))
- {
- _isDragging = true;
- DataObject data = new DataObject("ChannelBox", this);
- DragDrop.DoDragDrop(this, data, DragDropEffects.Move);
- }
- }
- }
-
- private void ChannelBox_MouseUp(object sender, MouseButtonEventArgs e)
- {
- _isDragging = false;
- }
-
- private void PTTButton_Click(object sender, RoutedEventArgs e)
- {
- MessageBox.Show($"Imagine you were talking on {ChannelName} rn");
- }
- }
-}
+/*
+* WhackerLink - WhackerLinkConsoleV2
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*
+* Copyright (C) 2024 Caleb, K4PHP
+*
+*/
+
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+
+namespace WhackerLinkConsoleV2.Controls
+{
+ public partial class ChannelBox : UserControl
+ {
+ public string ChannelName { get; set; }
+ public string SystemName { get; set; }
+ public string TGID { get; set; }
+
+ public ChannelBox()
+ {
+ InitializeComponent();
+ DataContext = this;
+
+ MouseMove += ChannelBox_MouseMove;
+ MouseDown += ChannelBox_MouseDown;
+ MouseUp += ChannelBox_MouseUp;
+ }
+
+ public ChannelBox(string channelName, string systemName, string tgid) : this()
+ {
+ ChannelName = $"{channelName}";
+ SystemName = $"System: {systemName}";
+ TGID = $"TGID: {tgid}";
+ }
+
+ private Point _dragStartPoint;
+ private bool _isDragging;
+
+ private void ChannelBox_MouseDown(object sender, MouseButtonEventArgs e)
+ {
+ _dragStartPoint = e.GetPosition(null);
+ _isDragging = false;
+ }
+
+ private void ChannelBox_MouseMove(object sender, MouseEventArgs e)
+ {
+ if (e.LeftButton == MouseButtonState.Pressed)
+ {
+ Point currentPosition = e.GetPosition(null);
+
+ if (!_isDragging && (Math.Abs(currentPosition.X - _dragStartPoint.X) > SystemParameters.MinimumHorizontalDragDistance ||
+ Math.Abs(currentPosition.Y - _dragStartPoint.Y) > SystemParameters.MinimumVerticalDragDistance))
+ {
+ _isDragging = true;
+ DataObject data = new DataObject("ChannelBox", this);
+ DragDrop.DoDragDrop(this, data, DragDropEffects.Move);
+ }
+ }
+ }
+
+ private void ChannelBox_MouseUp(object sender, MouseButtonEventArgs e)
+ {
+ _isDragging = false;
+ }
+
+ private void PTTButton_Click(object sender, RoutedEventArgs e)
+ {
+ MessageBox.Show($"Imagine you were talking on {ChannelName} rn");
+ }
+ }
+}
diff --git a/WhackerLinkConsoleV2/ChannelPosition.cs b/WhackerLinkConsoleV2/ChannelPosition.cs
index ee3eeac..1af6ab0 100644
--- a/WhackerLinkConsoleV2/ChannelPosition.cs
+++ b/WhackerLinkConsoleV2/ChannelPosition.cs
@@ -1,28 +1,28 @@
-/*
-* WhackerLink - WhackerLinkConsoleV2
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*
-* Copyright (C) 2024 Caleb, K4PHP
-*
-*/
-
-namespace WhackerLinkConsoleV2
-{
- public class ChannelPosition
- {
- public double X { get; set; }
- public double Y { get; set; }
- }
-}
+/*
+* WhackerLink - WhackerLinkConsoleV2
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*
+* Copyright (C) 2024 Caleb, K4PHP
+*
+*/
+
+namespace WhackerLinkConsoleV2
+{
+ public class ChannelPosition
+ {
+ public double X { get; set; }
+ public double Y { get; set; }
+ }
+}
diff --git a/WhackerLinkConsoleV2/MainWindow.xaml b/WhackerLinkConsoleV2/MainWindow.xaml
index a701cb1..8349410 100644
--- a/WhackerLinkConsoleV2/MainWindow.xaml
+++ b/WhackerLinkConsoleV2/MainWindow.xaml
@@ -1,20 +1,53 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WhackerLinkConsoleV2/MainWindow.xaml.cs b/WhackerLinkConsoleV2/MainWindow.xaml.cs
index b080135..ea5886f 100644
--- a/WhackerLinkConsoleV2/MainWindow.xaml.cs
+++ b/WhackerLinkConsoleV2/MainWindow.xaml.cs
@@ -1,242 +1,250 @@
-/*
-* WhackerLink - WhackerLinkConsoleV2
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*
-* Copyright (C) 2024 Caleb, K4PHP
-*
-*/
-
-using Microsoft.Win32;
-using System;
-using System.IO;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-using WhackerLinkLib.Models.Radio;
-using YamlDotNet.Serialization;
-using YamlDotNet.Serialization.NamingConventions;
-using WhackerLinkConsoleV2.Controls;
-using System.Collections.Generic;
-
-namespace WhackerLinkConsoleV2
-{
- public partial class MainWindow : Window
- {
- public Codeplug Codeplug { get; set; }
- private bool isEditMode = false;
-
- private UIElement _draggedElement;
- private Point _startPoint;
- private double _offsetX;
- private double _offsetY;
- private bool _isDragging;
-
- private SettingsManager _settingsManager = new SettingsManager();
-
- public MainWindow()
- {
- InitializeComponent();
- _settingsManager.LoadSettings();
- Loaded += MainWindow_Loaded;
- }
-
- private void OpenCodeplug_Click(object sender, RoutedEventArgs e)
- {
- OpenFileDialog openFileDialog = new OpenFileDialog
- {
- Filter = "Codeplug Files (*.yml)|*.yml|All Files (*.*)|*.*",
- Title = "Open Codeplug"
- };
- if (openFileDialog.ShowDialog() == true)
- {
- LoadCodeplug(openFileDialog.FileName);
-
- _settingsManager.LastCodeplugPath = openFileDialog.FileName;
- _settingsManager.SaveSettings();
- }
- }
-
- private void ResetSettings_Click(object sender, RoutedEventArgs e)
- {
- if (File.Exists("UserSettings.json"))
- File.Delete("UserSettings.json");
- }
-
- private void LoadCodeplug(string filePath)
- {
- try
- {
- var deserializer = new DeserializerBuilder()
- .WithNamingConvention(CamelCaseNamingConvention.Instance)
- .Build();
-
- var yaml = File.ReadAllText(filePath);
- Codeplug = deserializer.Deserialize(yaml);
-
- GenerateChannelWidgets();
- }
- catch (Exception ex)
- {
- MessageBox.Show($"Error loading codeplug: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
- }
- }
-
- private void GenerateChannelWidgets()
- {
- ChannelsCanvas.Children.Clear();
- double offsetX = 20;
- double offsetY = 20;
-
- if (_settingsManager.ShowSystemStatus && Codeplug != null)
- {
- foreach (var system in Codeplug.Systems)
- {
- var systemStatusBox = new SystemStatusBox(system.Name, system.Address, system.Port);
-
- Canvas.SetLeft(systemStatusBox, offsetX);
- Canvas.SetTop(systemStatusBox, offsetY);
-
- systemStatusBox.MouseLeftButtonDown += SystemStatusBox_MouseLeftButtonDown;
- systemStatusBox.MouseMove += SystemStatusBox_MouseMove;
- systemStatusBox.MouseRightButtonDown += SystemStatusBox_MouseRightButtonDown;
-
- ChannelsCanvas.Children.Add(systemStatusBox);
-
- offsetX += 220;
- if (offsetX + 200 > ChannelsCanvas.ActualWidth)
- {
- offsetX = 20;
- offsetY += 140;
- }
- }
- }
-
- if (_settingsManager.ShowChannels && Codeplug != null)
- {
- foreach (var zone in Codeplug.Zones)
- {
- foreach (var channel in zone.Channels)
- {
- var channelBox = new ChannelBox(channel.Name, channel.System, channel.Tgid);
-
- if (_settingsManager.ChannelPositions.TryGetValue(channel.Name, out var position))
- {
- Canvas.SetLeft(channelBox, position.X);
- Canvas.SetTop(channelBox, position.Y);
- }
- else
- {
- Canvas.SetLeft(channelBox, offsetX);
- Canvas.SetTop(channelBox, offsetY);
- }
-
- channelBox.MouseLeftButtonDown += ChannelBox_MouseLeftButtonDown;
- channelBox.MouseMove += ChannelBox_MouseMove;
- channelBox.MouseRightButtonDown += ChannelBox_MouseRightButtonDown;
- ChannelsCanvas.Children.Add(channelBox);
-
- offsetX += 220;
- if (offsetX + 200 > ChannelsCanvas.ActualWidth)
- {
- offsetX = 20;
- offsetY += 140;
- }
- }
- }
- }
- }
-
- private void SelectWidgets_Click(object sender, RoutedEventArgs e)
- {
- var widgetSelectionWindow = new WidgetSelectionWindow();
- widgetSelectionWindow.Owner = this;
- if (widgetSelectionWindow.ShowDialog() == true)
- {
- _settingsManager.ShowSystemStatus = widgetSelectionWindow.ShowSystemStatus;
- _settingsManager.ShowChannels = widgetSelectionWindow.ShowChannels;
- GenerateChannelWidgets();
- _settingsManager.SaveSettings();
- }
- }
-
- private void ChannelBox_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- if (!isEditMode || !(sender is UIElement element)) return;
-
- _draggedElement = element;
- _startPoint = e.GetPosition(ChannelsCanvas);
- _offsetX = _startPoint.X - Canvas.GetLeft(_draggedElement);
- _offsetY = _startPoint.Y - Canvas.GetTop(_draggedElement);
- _isDragging = true;
-
- element.CaptureMouse();
- }
-
- private void ChannelBox_MouseMove(object sender, MouseEventArgs e)
- {
- if (!isEditMode || !_isDragging || _draggedElement == null) return;
-
- Point currentPosition = e.GetPosition(ChannelsCanvas);
- double newLeft = Math.Max(0, Math.Min(currentPosition.X - _offsetX, ChannelsCanvas.ActualWidth - _draggedElement.RenderSize.Width));
- double newTop = Math.Max(0, Math.Min(currentPosition.Y - _offsetY, ChannelsCanvas.ActualHeight - _draggedElement.RenderSize.Height));
-
- Canvas.SetLeft(_draggedElement, newLeft);
- Canvas.SetTop(_draggedElement, newTop);
-
- if (_draggedElement is ChannelBox channelBox)
- {
- _settingsManager.UpdateChannelPosition(channelBox.ChannelName, newLeft, newTop);
- }
- }
-
- private void ChannelBox_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
- {
- if (!isEditMode || !_isDragging || _draggedElement == null) return;
-
- _isDragging = false;
- _draggedElement.ReleaseMouseCapture();
- _draggedElement = null;
- }
-
- private void SystemStatusBox_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) => ChannelBox_MouseLeftButtonDown(sender, e);
- private void SystemStatusBox_MouseMove(object sender, MouseEventArgs e) => ChannelBox_MouseMove(sender, e);
- private void SystemStatusBox_MouseRightButtonDown(object sender, MouseButtonEventArgs e) => ChannelBox_MouseRightButtonDown(sender, e);
-
- private void ToggleEditMode_Click(object sender, RoutedEventArgs e)
- {
- isEditMode = !isEditMode;
- var menuItem = (MenuItem)sender;
- menuItem.Header = isEditMode ? "Disable Edit Mode" : "Enable Edit Mode";
- }
-
- protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
- {
- _settingsManager.SaveSettings();
- base.OnClosing(e);
- }
-
- private void MainWindow_Loaded(object sender, RoutedEventArgs e)
- {
- if (!string.IsNullOrEmpty(_settingsManager.LastCodeplugPath) && File.Exists(_settingsManager.LastCodeplugPath))
- {
- LoadCodeplug(_settingsManager.LastCodeplugPath);
- }
- else
- {
- GenerateChannelWidgets();
- }
- }
- }
-}
+/*
+* WhackerLink - WhackerLinkConsoleV2
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*
+* Copyright (C) 2024 Caleb, K4PHP
+*
+*/
+
+using Microsoft.Win32;
+using System;
+using System.IO;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using WhackerLinkLib.Models.Radio;
+using YamlDotNet.Serialization;
+using YamlDotNet.Serialization.NamingConventions;
+using WhackerLinkConsoleV2.Controls;
+using System.Collections.Generic;
+
+namespace WhackerLinkConsoleV2
+{
+ public partial class MainWindow : Window
+ {
+ public Codeplug Codeplug { get; set; }
+ private bool isEditMode = false;
+
+ private UIElement _draggedElement;
+ private Point _startPoint;
+ private double _offsetX;
+ private double _offsetY;
+ private bool _isDragging;
+
+ private SettingsManager _settingsManager = new SettingsManager();
+
+ public MainWindow()
+ {
+ InitializeComponent();
+ _settingsManager.LoadSettings();
+ Loaded += MainWindow_Loaded;
+ }
+
+ private void OpenCodeplug_Click(object sender, RoutedEventArgs e)
+ {
+ OpenFileDialog openFileDialog = new OpenFileDialog
+ {
+ Filter = "Codeplug Files (*.yml)|*.yml|All Files (*.*)|*.*",
+ Title = "Open Codeplug"
+ };
+ if (openFileDialog.ShowDialog() == true)
+ {
+ LoadCodeplug(openFileDialog.FileName);
+
+ _settingsManager.LastCodeplugPath = openFileDialog.FileName;
+ _settingsManager.SaveSettings();
+ }
+ }
+
+ private void ResetSettings_Click(object sender, RoutedEventArgs e)
+ {
+ if (File.Exists("UserSettings.json"))
+ File.Delete("UserSettings.json");
+ }
+
+ private void LoadCodeplug(string filePath)
+ {
+ try
+ {
+ var deserializer = new DeserializerBuilder()
+ .WithNamingConvention(CamelCaseNamingConvention.Instance)
+ .Build();
+
+ var yaml = File.ReadAllText(filePath);
+ Codeplug = deserializer.Deserialize(yaml);
+
+ GenerateChannelWidgets();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show($"Error loading codeplug: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ }
+ }
+
+ private void GenerateChannelWidgets()
+ {
+ ChannelsCanvas.Children.Clear();
+ double offsetX = 20;
+ double offsetY = 20;
+
+ if (_settingsManager.ShowSystemStatus && Codeplug != null)
+ {
+ foreach (var system in Codeplug.Systems)
+ {
+ var systemStatusBox = new SystemStatusBox(system.Name, system.Address, system.Port);
+
+ Canvas.SetLeft(systemStatusBox, offsetX);
+ Canvas.SetTop(systemStatusBox, offsetY);
+
+ systemStatusBox.MouseLeftButtonDown += SystemStatusBox_MouseLeftButtonDown;
+ systemStatusBox.MouseMove += SystemStatusBox_MouseMove;
+ systemStatusBox.MouseRightButtonDown += SystemStatusBox_MouseRightButtonDown;
+
+ ChannelsCanvas.Children.Add(systemStatusBox);
+
+ offsetX += 220;
+ if (offsetX + 200 > ChannelsCanvas.ActualWidth)
+ {
+ offsetX = 20;
+ offsetY += 140;
+ }
+ }
+ }
+
+ if (_settingsManager.ShowChannels && Codeplug != null)
+ {
+ foreach (var zone in Codeplug.Zones)
+ {
+ foreach (var channel in zone.Channels)
+ {
+ var channelBox = new ChannelBox(channel.Name, channel.System, channel.Tgid);
+
+ if (_settingsManager.ChannelPositions.TryGetValue(channel.Name, out var position))
+ {
+ Canvas.SetLeft(channelBox, position.X);
+ Canvas.SetTop(channelBox, position.Y);
+ }
+ else
+ {
+ Canvas.SetLeft(channelBox, offsetX);
+ Canvas.SetTop(channelBox, offsetY);
+ }
+
+ channelBox.MouseLeftButtonDown += ChannelBox_MouseLeftButtonDown;
+ channelBox.MouseMove += ChannelBox_MouseMove;
+ channelBox.MouseRightButtonDown += ChannelBox_MouseRightButtonDown;
+ ChannelsCanvas.Children.Add(channelBox);
+
+ offsetX += 220;
+ if (offsetX + 200 > ChannelsCanvas.ActualWidth)
+ {
+ offsetX = 20;
+ offsetY += 140;
+ }
+ }
+ }
+ }
+ }
+
+ private void SelectWidgets_Click(object sender, RoutedEventArgs e)
+ {
+ var widgetSelectionWindow = new WidgetSelectionWindow();
+ widgetSelectionWindow.Owner = this;
+ if (widgetSelectionWindow.ShowDialog() == true)
+ {
+ _settingsManager.ShowSystemStatus = widgetSelectionWindow.ShowSystemStatus;
+ _settingsManager.ShowChannels = widgetSelectionWindow.ShowChannels;
+ GenerateChannelWidgets();
+ _settingsManager.SaveSettings();
+ }
+ }
+
+ private void ChannelBox_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ if (!isEditMode || !(sender is UIElement element)) return;
+
+ _draggedElement = element;
+ _startPoint = e.GetPosition(ChannelsCanvas);
+ _offsetX = _startPoint.X - Canvas.GetLeft(_draggedElement);
+ _offsetY = _startPoint.Y - Canvas.GetTop(_draggedElement);
+ _isDragging = true;
+
+ element.CaptureMouse();
+ }
+
+ private void ChannelBox_MouseMove(object sender, MouseEventArgs e)
+ {
+ if (!isEditMode || !_isDragging || _draggedElement == null) return;
+
+ Point currentPosition = e.GetPosition(ChannelsCanvas);
+ double newLeft = Math.Max(0, Math.Min(currentPosition.X - _offsetX, ChannelsCanvas.ActualWidth - _draggedElement.RenderSize.Width));
+ double newTop = Math.Max(0, Math.Min(currentPosition.Y - _offsetY, ChannelsCanvas.ActualHeight - _draggedElement.RenderSize.Height));
+
+ Canvas.SetLeft(_draggedElement, newLeft);
+ Canvas.SetTop(_draggedElement, newTop);
+
+ if (_draggedElement is ChannelBox channelBox)
+ {
+ _settingsManager.UpdateChannelPosition(channelBox.ChannelName, newLeft, newTop);
+ }
+ }
+
+ private void ChannelBox_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ if (!isEditMode || !_isDragging || _draggedElement == null) return;
+
+ _isDragging = false;
+ _draggedElement.ReleaseMouseCapture();
+ _draggedElement = null;
+ }
+
+ private void SystemStatusBox_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) => ChannelBox_MouseLeftButtonDown(sender, e);
+ private void SystemStatusBox_MouseMove(object sender, MouseEventArgs e) => ChannelBox_MouseMove(sender, e);
+ private void SystemStatusBox_MouseRightButtonDown(object sender, MouseButtonEventArgs e) => ChannelBox_MouseRightButtonDown(sender, e);
+
+ private void ToggleEditMode_Click(object sender, RoutedEventArgs e)
+ {
+ isEditMode = !isEditMode;
+ var menuItem = (MenuItem)sender;
+ menuItem.Header = isEditMode ? "Disable Edit Mode" : "Enable Edit Mode";
+ }
+
+ protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
+ {
+ _settingsManager.SaveSettings();
+ base.OnClosing(e);
+ }
+
+ private void MainWindow_Loaded(object sender, RoutedEventArgs e)
+ {
+ if (!string.IsNullOrEmpty(_settingsManager.LastCodeplugPath) && File.Exists(_settingsManager.LastCodeplugPath))
+ {
+ LoadCodeplug(_settingsManager.LastCodeplugPath);
+ }
+ else
+ {
+ GenerateChannelWidgets();
+ }
+ }
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+ if (sender is Button button)
+ {
+ string buttonContent = button.Content.ToString();
+ MessageBox.Show($"Beep boop {buttonContent}");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/WhackerLinkConsoleV2/SettingsManager.cs b/WhackerLinkConsoleV2/SettingsManager.cs
index 343149e..51ff0ad 100644
--- a/WhackerLinkConsoleV2/SettingsManager.cs
+++ b/WhackerLinkConsoleV2/SettingsManager.cs
@@ -1,85 +1,85 @@
-/*
-* WhackerLink - WhackerLinkConsoleV2
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*
-* Copyright (C) 2024 Caleb, K4PHP
-*
-*/
-
-using System.IO;
-using Newtonsoft.Json;
-
-namespace WhackerLinkConsoleV2
-{
- public class SettingsManager
- {
- private const string SettingsFilePath = "UserSettings.json";
-
- public bool ShowSystemStatus { get; set; } = true;
- public bool ShowChannels { get; set; } = true;
- public string LastCodeplugPath { get; set; } = null;
-
- public Dictionary ChannelPositions { get; set; } = new Dictionary();
-
- public void LoadSettings()
- {
- if (!File.Exists(SettingsFilePath)) return;
-
- try
- {
- var json = File.ReadAllText(SettingsFilePath);
- var loadedSettings = JsonConvert.DeserializeObject(json);
-
- if (loadedSettings != null)
- {
- ShowSystemStatus = loadedSettings.ShowSystemStatus;
- ShowChannels = loadedSettings.ShowChannels;
- LastCodeplugPath = loadedSettings.LastCodeplugPath;
- ChannelPositions = loadedSettings.ChannelPositions ?? new Dictionary();
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine($"Error loading settings: {ex.Message}");
- }
- }
-
- public void SaveSettings()
- {
- try
- {
- var json = JsonConvert.SerializeObject(this, Formatting.Indented);
- File.WriteAllText(SettingsFilePath, json);
- }
- catch (Exception ex)
- {
- Console.WriteLine($"Error saving settings: {ex.Message}");
- }
- }
-
- public void UpdateChannelPosition(string channelName, double x, double y)
- {
- if (ChannelPositions.ContainsKey(channelName))
- {
- ChannelPositions[channelName].X = x;
- ChannelPositions[channelName].Y = y;
- }
- else
- {
- ChannelPositions[channelName] = new ChannelPosition { X = x, Y = y };
- }
- }
- }
-}
+/*
+* WhackerLink - WhackerLinkConsoleV2
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*
+* Copyright (C) 2024 Caleb, K4PHP
+*
+*/
+
+using System.IO;
+using Newtonsoft.Json;
+
+namespace WhackerLinkConsoleV2
+{
+ public class SettingsManager
+ {
+ private const string SettingsFilePath = "UserSettings.json";
+
+ public bool ShowSystemStatus { get; set; } = true;
+ public bool ShowChannels { get; set; } = true;
+ public string LastCodeplugPath { get; set; } = null;
+
+ public Dictionary ChannelPositions { get; set; } = new Dictionary();
+
+ public void LoadSettings()
+ {
+ if (!File.Exists(SettingsFilePath)) return;
+
+ try
+ {
+ var json = File.ReadAllText(SettingsFilePath);
+ var loadedSettings = JsonConvert.DeserializeObject(json);
+
+ if (loadedSettings != null)
+ {
+ ShowSystemStatus = loadedSettings.ShowSystemStatus;
+ ShowChannels = loadedSettings.ShowChannels;
+ LastCodeplugPath = loadedSettings.LastCodeplugPath;
+ ChannelPositions = loadedSettings.ChannelPositions ?? new Dictionary();
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Error loading settings: {ex.Message}");
+ }
+ }
+
+ public void SaveSettings()
+ {
+ try
+ {
+ var json = JsonConvert.SerializeObject(this, Formatting.Indented);
+ File.WriteAllText(SettingsFilePath, json);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Error saving settings: {ex.Message}");
+ }
+ }
+
+ public void UpdateChannelPosition(string channelName, double x, double y)
+ {
+ if (ChannelPositions.ContainsKey(channelName))
+ {
+ ChannelPositions[channelName].X = x;
+ ChannelPositions[channelName].Y = y;
+ }
+ else
+ {
+ ChannelPositions[channelName] = new ChannelPosition { X = x, Y = y };
+ }
+ }
+ }
+}
diff --git a/WhackerLinkConsoleV2/SystemStatusBox.xaml b/WhackerLinkConsoleV2/SystemStatusBox.xaml
index a989463..b9d5a70 100644
--- a/WhackerLinkConsoleV2/SystemStatusBox.xaml
+++ b/WhackerLinkConsoleV2/SystemStatusBox.xaml
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/WhackerLinkConsoleV2/SystemStatusBox.xaml.cs b/WhackerLinkConsoleV2/SystemStatusBox.xaml.cs
index 546390c..07671d3 100644
--- a/WhackerLinkConsoleV2/SystemStatusBox.xaml.cs
+++ b/WhackerLinkConsoleV2/SystemStatusBox.xaml.cs
@@ -1,43 +1,43 @@
-/*
-* WhackerLink - WhackerLinkConsoleV2
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*
-* Copyright (C) 2024 Caleb, K4PHP
-*
-*/
-
-using System.Windows.Controls;
-
-namespace WhackerLinkConsoleV2.Controls
-{
- public partial class SystemStatusBox : UserControl
- {
- public string SystemName { get; set; }
- public string AddressPort { get; set; }
- public string ConnectionState { get; set; } = "Disconnected";
-
- public SystemStatusBox()
- {
- InitializeComponent();
- DataContext = this;
- }
-
- public SystemStatusBox(string systemName, string address, int port) : this()
- {
- SystemName = systemName;
- AddressPort = $"Address: {address}:{port}";
- }
- }
-}
+/*
+* WhackerLink - WhackerLinkConsoleV2
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*
+* Copyright (C) 2024 Caleb, K4PHP
+*
+*/
+
+using System.Windows.Controls;
+
+namespace WhackerLinkConsoleV2.Controls
+{
+ public partial class SystemStatusBox : UserControl
+ {
+ public string SystemName { get; set; }
+ public string AddressPort { get; set; }
+ public string ConnectionState { get; set; } = "Disconnected";
+
+ public SystemStatusBox()
+ {
+ InitializeComponent();
+ DataContext = this;
+ }
+
+ public SystemStatusBox(string systemName, string address, int port) : this()
+ {
+ SystemName = systemName;
+ AddressPort = $"Address: {address}:{port}";
+ }
+ }
+}
diff --git a/WhackerLinkConsoleV2/WhackerLinkConsoleV2.csproj b/WhackerLinkConsoleV2/WhackerLinkConsoleV2.csproj
index 4227b9e..e3ee7c2 100644
--- a/WhackerLinkConsoleV2/WhackerLinkConsoleV2.csproj
+++ b/WhackerLinkConsoleV2/WhackerLinkConsoleV2.csproj
@@ -1,19 +1,27 @@
-
-
-
- WinExe
- net8.0-windows7.0
- disable
- enable
- true
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ WinExe
+ net8.0-windows7.0
+ disable
+ enable
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WhackerLinkConsoleV2/WidgetSelectionWindow.xaml b/WhackerLinkConsoleV2/WidgetSelectionWindow.xaml
index 982a981..291989e 100644
--- a/WhackerLinkConsoleV2/WidgetSelectionWindow.xaml
+++ b/WhackerLinkConsoleV2/WidgetSelectionWindow.xaml
@@ -1,11 +1,11 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/WhackerLinkConsoleV2/WidgetSelectionWindow.xaml.cs b/WhackerLinkConsoleV2/WidgetSelectionWindow.xaml.cs
index 263d0c8..be4b827 100644
--- a/WhackerLinkConsoleV2/WidgetSelectionWindow.xaml.cs
+++ b/WhackerLinkConsoleV2/WidgetSelectionWindow.xaml.cs
@@ -1,43 +1,43 @@
-/*
-* WhackerLink - WhackerLinkConsoleV2
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*
-* Copyright (C) 2024 Caleb, K4PHP
-*
-*/
-
-using System.Windows;
-
-namespace WhackerLinkConsoleV2
-{
- public partial class WidgetSelectionWindow : Window
- {
- public bool ShowSystemStatus { get; private set; } = true;
- public bool ShowChannels { get; private set; } = true;
-
- public WidgetSelectionWindow()
- {
- InitializeComponent();
- }
-
- private void ApplyButton_Click(object sender, RoutedEventArgs e)
- {
- ShowSystemStatus = SystemStatusCheckBox.IsChecked ?? false;
- ShowChannels = ChannelCheckBox.IsChecked ?? false;
- DialogResult = true;
- Close();
- }
- }
-}
+/*
+* WhackerLink - WhackerLinkConsoleV2
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*
+* Copyright (C) 2024 Caleb, K4PHP
+*
+*/
+
+using System.Windows;
+
+namespace WhackerLinkConsoleV2
+{
+ public partial class WidgetSelectionWindow : Window
+ {
+ public bool ShowSystemStatus { get; private set; } = true;
+ public bool ShowChannels { get; private set; } = true;
+
+ public WidgetSelectionWindow()
+ {
+ InitializeComponent();
+ }
+
+ private void ApplyButton_Click(object sender, RoutedEventArgs e)
+ {
+ ShowSystemStatus = SystemStatusCheckBox.IsChecked ?? false;
+ ShowChannels = ChannelCheckBox.IsChecked ?? false;
+ DialogResult = true;
+ Close();
+ }
+ }
+}