public DialogResult ShowForm(PlinkConfigCollection pconfigs) { if (pconfigs == null) { throw new Exception("配置为空"); } this.plinkconfigs = pconfigs; return(this.ShowDialog()); }
public frmMain() { InitializeComponent(); notifyicon.Text = "ShellForPlink"; notifyicon.Visible = true; notifyicon.ContextMenuStrip = this.contextMenuStrip2; notifyicon.Icon = Properties.Resources.tray_error; this.Icon = Properties.Resources.main; tabControl1.SelectedIndex = 1; plink = new Plink(); Ping = new LoopBackPing(); this.AddEventHandle(); try { if (File.Exists(xmlConfigFileName)) { XmlSerializer serializer = new XmlSerializer(typeof(PlinkConfigCollection)); FileStream fs = File.Open(xmlConfigFileName, FileMode.Open); colPlinkConfig = (PlinkConfigCollection)serializer.Deserialize(fs); fs.Close(); colPlinkConfig.FillConfigDict(); colPlinkConfig.FillCurConfigobj(); this.FillMenuStripCfNameList(); } else { colPlinkConfig = new PlinkConfigCollection(); colPlinkConfig.CreateConfig("Default"); } this.FillConfigControl(); } catch (Exception e) { MessageBox.Show(e.Message); } }