public FormMain(ULvdsCard card) { this.card = card; InitializeComponent(); if (this.card == null) { this.Text = "通用版Lvds卡(演示)"; buttonRecv.Enabled = false; buttonSave.Enabled = false; buttonReg.Enabled = false; } else { this.Text = string.Format("通用版Lvds卡 [{0}]", card.DeviceNumber); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ULvdsCard card = null; FormDevSel formDelSel = new FormDevSel(); if (formDelSel.ShowDialog() == DialogResult.OK) { try { // // 打开板卡 // card = ULvdsCard.Open(formDelSel.DevNum); } catch (Exception ex) { StringBuilder sb = new StringBuilder(); sb.AppendLine("无法打开通用版Lvds卡。错误信息:"); sb.AppendLine(); sb.AppendLine(ex.Message); sb.AppendLine(); sb.AppendLine("是否进入演示模式?"); sb.AppendLine(" 确定 - 演示模式"); sb.AppendLine(" 取消 - 退出程序"); DialogResult r = MessageBox.Show(sb.ToString(), "打开失败", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (r == DialogResult.No) { return; } } try { Application.Run(new FormMain(card)); } catch (System.Exception ex) { MessageBox.Show(ex.ToString(), "程序启动错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public FormReg(ULvdsCard card) { this.card = card; InitializeComponent(); }