private void DownloadWaveFormThread() { SetEnabled(false); try { int emptyNum = 0; string info = string.Empty; foreach (Control control in flowLayoutPanel_Content.Controls) { LabelButtonTextBox lbt = control as LabelButtonTextBox; if (lbt != null) { if (!string.IsNullOrEmpty(lbt.FileName)) { if (File.Exists(lbt.FileName)) { if (!DownloadWaveForm(GetBytesFromWaveFormInfo(lbt.FileName), lbt.HeadNo)) { info += "“" + lbt.LabelHead + "”"; } } else { info += "“" + lbt.LabelHead + "”"; } } else { emptyNum++; } } } if (emptyNum == flowLayoutPanel_Content.Controls.Count) { //如果都为空就不提示下载信息了; return; } if (info == string.Empty) { MessageBox.Show(@"Download Success!"); } else { MessageBox.Show(@"Download Fail!" + info); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { SetEnabled(true); } }
private void button_Open_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog { Filter = @"waveform file|*.wav" }; if (openFileDialog.ShowDialog() == DialogResult.OK) { foreach (Control control in flowLayoutPanel_Content.Controls) { LabelButtonTextBox lbt = control as LabelButtonTextBox; if (lbt != null) { lbt.FileName = openFileDialog.FileName; } } } }
public Waveform_S2840() { InitializeComponent(); _headBoardType = (HEAD_BOARD_TYPE)CoreInterface.get_HeadBoardType(true); int headNum = 0; switch (_headBoardType) { case HEAD_BOARD_TYPE.EPSON_S1600_8H: { if (CoreInterface.IsS_system()) { USER_SET_INFORMATION info = new USER_SET_INFORMATION(); CoreInterface.GetUserSetInfo(ref info); headNum = 8 * info.HeadBoardNum; } else { headNum = 8; } } break; case HEAD_BOARD_TYPE.EPSON_S2840_4H: { if (CoreInterface.IsS_system()) { USER_SET_INFORMATION info = new USER_SET_INFORMATION(); CoreInterface.GetUserSetInfo(ref info); headNum = 4 * info.HeadBoardNum; } else { headNum = 4; } } break; case HEAD_BOARD_TYPE.EPSON_5113_2H: { if (CoreInterface.IsS_system()) { USER_SET_INFORMATION info = new USER_SET_INFORMATION(); CoreInterface.GetUserSetInfo(ref info); headNum = 2 * info.HeadBoardNum; } else { headNum = 2; } } break; case HEAD_BOARD_TYPE.EPSON_5113_8H: { if (CoreInterface.IsS_system()) { USER_SET_INFORMATION info = new USER_SET_INFORMATION(); CoreInterface.GetUserSetInfo(ref info); headNum = 8 * info.HeadBoardNum; } else { headNum = 8; } } break; case HEAD_BOARD_TYPE.EPSON_5113_6H: { if (CoreInterface.IsS_system()) { USER_SET_INFORMATION info = new USER_SET_INFORMATION(); CoreInterface.GetUserSetInfo(ref info); headNum = 6 * info.HeadBoardNum; } else { headNum = 6; } } break; case HEAD_BOARD_TYPE.Ricoh_Gen6_16H: { if (CoreInterface.IsS_system()) { USER_SET_INFORMATION info = new USER_SET_INFORMATION(); CoreInterface.GetUserSetInfo(ref info); headNum = 16 * info.HeadBoardNum; } else { headNum = 16; } } break; default: headNum = 0; //MessageBox.Show(@"Unsupported headboard type!"); break; } for (int i = 0; i < headNum; i++) { LabelButtonTextBox lbt = new LabelButtonTextBox { LabelHead = "H" + (i + 1) + ":", HeadNo = i }; flowLayoutPanel_Content.Controls.Add(lbt); } }