89 lines
2.5 KiB
C#
89 lines
2.5 KiB
C#
using Krypton.Toolkit;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace SamaPager_Client
|
|
{
|
|
public partial class Form1 : Krypton.Toolkit.KryptonForm
|
|
{
|
|
IPAddress DestinationIP = IPAddress.Loopback;
|
|
Client pageClient { get; set; }
|
|
|
|
public Form1()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void StartClient()
|
|
{
|
|
pageClient = new Client(DestinationIP, 2000);
|
|
statusTxt.Text = "STATUS: " + pageClient.StartClient();
|
|
}
|
|
|
|
private void Form1_Load(object sender, EventArgs e)
|
|
{
|
|
StartClient();
|
|
}
|
|
|
|
private void changeDestinationAddressToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
KryptonMessageBox.Show("WIP");
|
|
}
|
|
|
|
private void restartUDPClientToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
statusTxt.Text = "STATUS: Restarting UdpClient";
|
|
StartClient();
|
|
}
|
|
|
|
|
|
private void cmdLst_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
logLst.Items.Add(pageClient.SendCommand(cmdLst.Text));
|
|
cmdLst.Text = String.Empty;
|
|
}
|
|
|
|
private void sendBtn_Click_1(object sender, EventArgs e)
|
|
{
|
|
if(keyTxt.Text == string.Empty)
|
|
{
|
|
KryptonMessageBox.Show("Inserire una chiave");
|
|
}
|
|
else if (messageTxt.Text == string.Empty)
|
|
{
|
|
KryptonMessageBox.Show("Inserire un messaggio");
|
|
}
|
|
else
|
|
{
|
|
pageClient.SendEncryptedMessage(messageTxt.Text, keyTxt.Text);
|
|
logLst.Items.Add($"Sent: {messageTxt.Text}");
|
|
messageTxt.Text = String.Empty;
|
|
}
|
|
}
|
|
|
|
private void sendWithoutEncryptionToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
if (messageTxt.Text == string.Empty)
|
|
{
|
|
KryptonMessageBox.Show("Inserire un messaggio");
|
|
}
|
|
else
|
|
{
|
|
pageClient.SendMessage(messageTxt.Text);
|
|
logLst.Items.Add($"Sent: {messageTxt.Text}");
|
|
messageTxt.Text = String.Empty;
|
|
}
|
|
}
|
|
}
|
|
}
|