public frmSample60() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); ServiceFactory.Init(this); // // TODO: Add constructor code after the InitializeComponent() call. // try { if (SessionFactoryManager.CreateSessionFactory() == null) { this.Close(); return; } } catch (Exception e) { var innerMessage = e.InnerException == null? "" : e.InnerException.Message; MessageBox.Show( string.Format( @"Could not create sessions factory. Did you install FireBird database? http://www.firebirdsql.org/. Exception details: {0}, {1}", e.Message, innerMessage)); return; } source = new NHibernatePingData<Track>(SessionFactoryManager.SessionFactory); AddColumns(); this.toolStripStatusLabel1.Text = "Grid not ready"; pingGrid1.DataSource = source; pingGrid1.Columns.StretchToFit(); pingGrid1.VScrollPositionChanged += delegate { UpdateCount(); }; toolStripMenuItem1.Click += this.AddMoreRowsClicked; // we must show form prior calling multi-threaded code this.Show(); if (pingGrid1.DataSource.Count == 0) { AddRows(0, 5000); } InvalidateGrid(); }
public frmSample60() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); ServiceFactory.Init(this); // // TODO: Add constructor code after the InitializeComponent() call. // try { if (SessionFactoryManager.CreateSessionFactory() == null) { this.Close(); return; } } catch (Exception e) { var innerMessage = e.InnerException == null? "" : e.InnerException.Message; MessageBox.Show( string.Format( @"Could not create sessions factory. Did you install FireBird database? http://www.firebirdsql.org/. Exception details: {0}, {1}", e.Message, innerMessage)); return; } source = new NHibernatePingData <Track>(SessionFactoryManager.SessionFactory); AddColumns(); this.toolStripStatusLabel1.Text = "Grid not ready"; pingGrid1.DataSource = source; pingGrid1.Columns.StretchToFit(); pingGrid1.VScrollPositionChanged += delegate { UpdateCount(); }; toolStripMenuItem1.Click += this.AddMoreRowsClicked; // we must show form prior calling multi-threaded code this.Show(); if (pingGrid1.DataSource.Count == 0) { AddRows(0, 5000); } InvalidateGrid(); }