You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.1 KiB

using System.Threading.Channels;
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");
}
}
}

Powered by TurnKey Linux.