Хочу выполнить функцию DevicesDetect(), я знаю, что объявил её неверно. Windows Forms не позволяет добавить модификаторы private или public к этой функции.
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string[] midiDevices;
int count = 0;
//Здесь нужно решение
DevicesDetect()
{
if (DeviceManager.InputDevices.Count == 0)
{
Status.ForeColor = Color.Red;
Status.Text = "No MIDI devices available";
}
else
{
Status.ForeColor = Color.Lime;
Status.Text = "MIDI devices detected";
foreach (var device in DeviceManager.InputDevices)
{
count++;
midiDevices[count] = device.ToString();
}
}
}
}
public void RBtn_Click(object sender, EventArgs e)
{
DevicesDetect();
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
private string[] DevicesDetect()
{
string[] midiDevices = null;
if (DeviceManager.InputDevices.Count == 0)
{
Status.ForeColor = Color.Red;
Status.Text = "No MIDI devices available";
}
else
{
Status.ForeColor = Color.Lime;
Status.Text = "MIDI devices detected";
midiDevices = new string[DeviceManager.InputDevices.Count];
int count = 0;
foreach (var device in DeviceManager.InputDevices)
{
midiDevices[count++] = device.ToString();
}
}
return midiDevices;
}
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости