MCAudioSpectrumAnalyzerVS/MCAudioSpectrumAnalyzer/Form1.cs

42 lines
1.1 KiB
C#
Raw Normal View History

2015-10-19 16:04:11 +00:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
2015-10-19 19:06:15 +00:00
using System.Net;
using System.Net.Sockets;
2015-10-19 16:04:11 +00:00
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MCAudioSpectrumAnalyzer
{
public partial class Form1 : Form
{
public static Form1 Instance;
public Form1()
{
InitializeComponent();
2015-10-19 19:06:15 +00:00
Instance = this;
2017-11-10 21:45:30 +00:00
Analyzer = new Analyzer(new ProgressBar(), new ProgressBar(), devicelist);
2015-10-19 16:04:11 +00:00
}
public void Set(List<byte> data)
{
if (data.Count < 16) return;
2017-11-10 21:45:30 +00:00
client.Send(data.ToArray(), data.Count, new IPEndPoint(IPAddress.Loopback, 5896));
2015-10-19 16:04:11 +00:00
}
2017-11-06 21:48:18 +00:00
2015-10-19 19:06:15 +00:00
private UdpClient client = new UdpClient(AddressFamily.InterNetwork);
private Analyzer Analyzer;
2015-10-19 16:04:11 +00:00
private void button1_Click(object sender, EventArgs e)
{
2015-10-19 19:06:15 +00:00
Analyzer.Enable = !Analyzer.Enable;
button1.Text = (Analyzer.Enable ? "Disable" : "Enable");
2015-10-19 16:04:11 +00:00
}
}
}