// Event for ItemActivate private void listView1_ItemActivate(object sender, EventArgs e) { SignalOutput SO = new SignalOutput(); SearchRedRat SR = new SearchRedRat(); RedRat3 = SR.FindRedRat(); string newPath = pathClick + "\\" + listView1.FocusedItem.Text; if (File.Exists(newPath))//Checker is folder or file { //MessageBox.Show("File is choice!"); //Process.Start(pathClick); OutputIR = SO.ConvertingBINARYorXMLtoIRsignal(newPath); if (OutputIR != null) { Messages("Выбран файл: " + listView1.FocusedItem.Text); label1.Enabled = true; button3.Enabled = true; textBox1.Enabled = true; label4.Enabled = true; button7.Enabled = true; textBox3.Enabled = true; button2.Enabled = true; } } else { AddFoldersWithFileFromEnterPath(newPath, false); } }
// Кнопка Выбрать сигнал(F3) private void button13_Click(object sender, EventArgs e) { try { SignalOutput SO = new SignalOutput(); OpenFileDialog OFD = new OpenFileDialog(); OFD.InitialDirectory = modelsPath; if (OFD.ShowDialog() == DialogResult.OK) { Messages("Выбран файл: " + OFD.FileName); OutputIR = SO.ConvertingBINARYorXMLtoIRsignal(OFD.FileName); if (OutputIR != null) { label1.Enabled = true; button3.Enabled = true; textBox1.Enabled = true; label4.Enabled = true; button7.Enabled = true; textBox3.Enabled = true; button2.Enabled = true; } } SearchRedRat SR = new SearchRedRat(); RedRat3 = SR.FindRedRat(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public FormTimerOutputIRsignal(IRedRat3 _RedRat3, Int32 _Interval, IRPacket _OutputIR = null, bool _folderOutput = false, string _pathToFolder = "", FileInfo[] _fileInfos = null) { InitializeComponent(); RedRat3 = _RedRat3; interval = _Interval; OutputIR = _OutputIR; folderOutput = _folderOutput; pathToFolder = _pathToFolder; fileInfos = _fileInfos; if (folderOutput == false) { timer1.Interval = interval; timer1.Start(); } else { foreach (FileInfo file in fileInfos) { OutputIR = SO.ConvertingBINARYorXMLtoIRsignal(pathToFolder + "\\" + file.Name); if ((RedRat3 != null) && (OutputIR != null)) { SO.OutputOneIRsignal(RedRat3, OutputIR); Thread.Sleep(interval); } else { MessageBox.Show("Ошибка. Проверьте ввеленные значения интервала, или Подключение RedRat3, или плохо записан сигнал."); } } } }