using System; using System.Drawing; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Windows.Forms; using System.Text.RegularExpressions; using System.IO; using System.Diagnostics; using BCG.Utilities; // using BCG.Utilities.BlueConfiguration; using BCG.Utilities.General; using BCG.Evaluator.DataStreamExpression; // using BCG.Utilities.Win32; namespace BCG { public partial class MainForm : System.Windows.Forms.Form { private bool myChangeStyle = false; private PubSubRoute[] myRoutes = PubSub3Config.instance.getSubRouting(); private PersistWindowState myWindowState; private string myLastFileName; private ViewStream myCurrentStream; private List mySiteItems = new List (); // private string mySite = SitesCore.getMySiteName (); private string mySite = "TODO"; private string myLastClassName = "MyView"; private ViewStream myAllTagsStream; private PubSubConfigureForm myPubSubConForm = new PubSubConfigureForm (); private string myKQ; private TextWriter myConsoleOutput; public MainForm() { InitializeComponent(); // myKQ = ConfigurationRequester.getApplicationQualifier(); myKQ = "TODO"; mySetText(); myWindowState = new PersistWindowState (); myWindowState.parent = this; myWindowState.saveState = false; this.Load += new EventHandler (myLoad); this.Closing += new CancelEventHandler (myClosing); } public string query_text { get { return myQueryTextBox.Text; } set { myQueryTextBox.Text = value; } } private ViewStream myGetAllTagsStream () { return new FilterStream(new PublishedTagsStream(), String.Format("tag~='^{0}'", PubStreamPrefixer.prefix(""))); } private void mySetText () { this.Text = "Data Stream Query Analyzer | Site: " + mySite + (string.IsNullOrEmpty (myKQ) ? string.Empty : " | Key Qualifier: " + myKQ); myToolStripStatusLabelTime.Text = "Ready"; myToolStripStatusLabelRows.Text = string.Empty; } /// /// Gets the data in the form of a multilevel IDictionary /// /// private IDictionary myGetLibraryData () { SortedList retVal = new SortedList(); string[] primitiveNames = PrimitiveManager.instance.getPrimitiveNames (); foreach (string pName in primitiveNames) { string aName = PrimitiveManager.instance.getAssemblyName (pName); ICollection cNames = PrimitiveManager.instance.getConstructorSigns (pName); if (!retVal.Contains (aName)) retVal.Add (aName, new SortedList ()); (retVal[aName] as IDictionary)[pName] = new ArrayList (cNames); } foreach (DictionaryEntry outerDe in retVal) foreach (DictionaryEntry innerDe in (outerDe.Value as IDictionary)) (innerDe.Value as ArrayList).Sort (); return retVal; } private void myLoadAssemblies () { myTreeView.Nodes.Clear (); IDictionary libraryData = myGetLibraryData (); foreach (DictionaryEntry de in libraryData) { TreeNode assemblyNode = new TreeNode (de.Key as String); foreach (DictionaryEntry innerDe in (de.Value as IDictionary)) { TreeNode primitiveNode = new TreeNode (innerDe.Key as string); foreach (string con in (innerDe.Value as ICollection)) primitiveNode.Nodes.Add (con); assemblyNode.Nodes.Add (primitiveNode); } myTreeView.Nodes.Add (assemblyNode); } /* myPrimitivesTextBox.Clear (); ArrayList al = new ArrayList(PrimitiveManager.instance.getPrimitiveNames()); al.Sort(); foreach (string s in al) { myPrimitivesTextBox.Text += "\n" + s + " (from " + PrimitiveManager.instance.getAssemblyName(s) + ")\n"; foreach (string desc in PrimitiveManager.instance.getConstructorSigns(s)) myPrimitivesTextBox.Text += "\t" + desc + "\n"; }*/ } private void myHandleTableListChange (object o) { IBlueRowCollection rows = (o as DataPacket).newRows; myUpdateTableList(); } #region Persistence Keys public int textBoxHeight { get { return myQueryTextBox.Height; } set { myQueryTextBox.Height = value; } } #endregion /// /// The main entry point for the application. /// [STAThread] static void Main(string[] argv) { CoreServicesInit.init(); BCG.Utilities.BlueConfiguration.ConfigurationRequester.enable_config_file_read = true; MainForm mainForm = new MainForm(); if (argv.Length > 0) mainForm.loadFile(argv[0]); Application.Run(mainForm); } private void myTryExpression (string expStr) { myFreezeView (false); // force unfreeze the view DataStreamExpression oldExp = myExp; try { BCG.Evaluator.DataStreamExpression.syntax parser = new BCG.Evaluator.DataStreamExpression.syntax(); DataStreamExpression exp = (DataStreamExpression) parser.Parse(expStr); if (exp == null) throw new Exception("Syntax error. I am afraid I have no further details. Let Pedro know if you are really bothered about it."); myDataGrid.DataSource = null; myTabControl.SelectedIndex = 0; myErrorTextBox.Text = ""; myDataGrid.CaptionText = ""; if (myCurrentStream != null) myCurrentStream.onChange -= new BCG.DataStream.ChangeDelegate(myCallback); myCurrentStream = null; myExp = exp; myCrono = new Crono(); myCrono.start(); (myCurrentStream = myExp.getView(new Hashtable())).onChange += new DataStream.ChangeDelegate(myCallback); myChangeStyle = true; //new SimpleBindableStream(myExp.getView(new Hashtable())).onChange += new DataStream.ChangeDelegate(myCallback); /* if (oldExp != null) oldExp.getView(new Hashtable()).onChange -= new DataStream.ChangeDelegate(myCallback); */ //myQueryTextBox.Text = expStr; } catch (Exception exc) { BCG.Utilities.BlueEventLog.logEvent(exc); myDataGrid.DataSource = null; myTabControl.SelectedIndex = 2; myExp = oldExp; myErrorTextBox.Text = exc.Message + "\n"; if(exc.InnerException != null) myErrorTextBox.Text += "Inner Exception: " + exc.InnerException.Message + "\n"; myErrorTextBox.Text += "\n" + exc.StackTrace; myCSharpText.Text = ""; } } private string myExtractFromClass (TextReader r) { string line = r.ReadLine(); while (line != null && line.IndexOf("*Expression*") == -1) line = r.ReadLine(); if (line == null) throw new Exception ("Unexpected EOF"); r.ReadLine(); string result = ""; line = r.ReadLine(); while (line != null && line.IndexOf("----------------------------------------------------------------------") == -1) { if (line != "") result += line.Substring(" ".Length) + "\n"; line = r.ReadLine(); } if (line == null) throw new Exception ("Unexpected EOF"); return result; } public void loadFile (string fileName) { try { TextReader r = new StreamReader(fileName); try { myQueryTextBox.Text = myExtractFromClass(r); } finally { r.Close(); } myLastFileName = fileName; this.Text = fileName; } catch (Exception exc) { BCG.Utilities.BlueEventLog.logEvent(exc); myDataGrid.DataSource = null; myTabControl.SelectedIndex = 1; myErrorTextBox.Text = exc.Message; myErrorTextBox.Text += "\n" + exc.StackTrace; } } private void myPrintCode(IBlueTableSchema schema, ICollection vars, string code) { myCSharpText.Text = "using System;\n\nnamespace BCG\n{"; myCSharpText.Text +="\n/*"; myCSharpText.Text +="\n ----------------------------------------------------------------------"; myCSharpText.Text +="\n *Expression*"; myCSharpText.Text +="\n ----------------------------------------------------------------------"; foreach (string line in myQueryTextBox.Text.Split('\n')) myCSharpText.Text +="\n " + line; myCSharpText.Text +="\n\n ----------------------------------------------------------------------"; myCSharpText.Text +="\n *Schema*"; myCSharpText.Text +="\n ----------------------------------------------------------------------"; foreach(ColumnInfo ci in schema.columnInfo) myCSharpText.Text +="\n " + ci.colName + new string(' ', Math.Max(32 - ci.colName.Length,1) ) + ci.colType.ToString(); myCSharpText.Text +="\n*/\n"; string lastVar = null; string variableDeclarations = ""; foreach (string var in vars) { variableDeclarations+= " ViewStream " + var + ";\n"; lastVar = var; } myLastClassName = null; if (lastVar != null) myLastClassName = lastVar[0].ToString().ToUpper() + lastVar.Substring(1); else myLastClassName = "MyView"; myCSharpText.Text +="\n\n public class " + myLastClassName + " : ViewStream \n {\n"; myCSharpText.Text += " public " + myLastClassName + "() : this(null) {}\n"; myCSharpText.Text += " public " + myLastClassName + "(ViewStreamDatabase db)\n {\n"; myCSharpText.Text += variableDeclarations; if (lastVar != null) myCSharpText.Text += "\n"; myCSharpText.Text += code + "\n"; if (lastVar != null) myCSharpText.Text += " mySetRealSource(" + lastVar + ");\n"; myCSharpText.Text += " }\n"; myCSharpText.Text += " }\n"; myCSharpText.Text += "}"; } private void myCallback(object o) { DataPacket dp = o as DataPacket; myCrono.stop(); BlueEventLog.logEvent ("Received callback for " + dp.schema.tableName); if (o == null) { System.Windows.Forms.MessageBox.Show (this, "Received a Null Data packet", "Invalid Data", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } BlueEventLog.logEvent(dp.toIncrementalIDString(), BlueEventLevel.Diagnosis); myToolStripStatusLabelTime.Text = "Last update: " + DateTime.Now.ToString ("hh:mm:ss:fff tt"); myToolStripStatusLabelRows.Text = "New = " + dp.newRows.Count + " Added = " + dp.addedRows.Count + " Deleted = " + dp.deletedRows.Count; BlueEventLog.logEvent(Text, BlueEventLevel.Diagnosis); int hscrollval = myChangeStyle ? 0 : myDataGrid.HorizScrollBarValue; myDataGrid.DataSource = new SimpleBindableCollection (dp.newRows.schema, dp.newRows); if (myChangeStyle) { myChangeStyle = false; DataGridTableStyle tabStyle = new DataGridTableStyle (); DataGridColumnStyle colStyle; foreach (ColumnInfo ci in dp.schema.columnInfo) { colStyle = new DataGridTextBoxColumn (); colStyle.MappingName = ci.colName; colStyle.HeaderText = ci.colName; colStyle.Width = Math.Max(ci.colName.Length * 10, 50); if (ci.colType.Equals (typeof(DateTime))) { colStyle.Width = 200; // (colStyle as DataGridTextBoxColumn).Format = // System.Globalization.DateTimeFormatInfo.CurrentInfo.TimeSeparator; } tabStyle.GridColumnStyles.Add (colStyle); } tabStyle.HeaderFont = new Font ("Courier New", 9, FontStyle.Bold); tabStyle.GridLineStyle = System.Windows.Forms.DataGridLineStyle.Solid; tabStyle.GridLineColor = Color.Black; tabStyle.RowHeadersVisible = false; tabStyle.MappingName = "SimpleBindableCollection"; myDataGrid.TableStyles.Clear (); myDataGrid.TableStyles.Add (tabStyle); } myCrono.start(); myDataGrid.CaptionText = myCrono.time.TotalMilliseconds + " ms "; myDataGrid.CaptionText += dp.newRows.Count.ToString () + " records"; myDataGrid.HorizScrollBarValue = hscrollval; ArrayList varNames = new ArrayList(); string code = myExp.print(9,varNames); myPrintCode(dp.schema ,varNames, code); } private Crono myCrono; private DataStreamExpression myExp; private void myTimer_Tick(object sender, System.EventArgs e) { try { ViewStreamDatabase.instance.doWork (); MasterWorker.getInstance(false).doWork(); } catch (Exception exc) { BCG.Utilities.BlueEventLog.logEvent(exc); myDataGrid.DataSource = null; //myTabControl.SelectedIndex = 1; myTabControl.SelectedTab = myErrorTabPage; myErrorTextBox.Text = exc.Message; myErrorTextBox.Text += "\n" + exc.StackTrace; } } class StringWrapper { public StringWrapper(string s) { myTableName = s; } public string tableName { get{return myTableName;} } private string myTableName; } private void MainForm_Closed(object sender, System.EventArgs e) { if (myExp != null) myExp.getView(new Hashtable()).onChange -= new DataStream.ChangeDelegate(myCallback); } private void myMenuItemExecuteQueryClick(object sender, System.EventArgs e) { myQueryTextBox.SelectionStart = myQueryTextBox.Text.Length; myQueryTextBox.SelectionLength = myQueryTextBox.Text.Length; myQueryTextBox.SelectionColor = Color.Black; myQueryTextBox.SelectionLength = 0; myTryExpression(myQueryTextBox.Text); } private void myToolStripMenuItemExecSel_Click (object sender, EventArgs e) { int selstart = myQueryTextBox.SelectionStart; int sellength = myQueryTextBox.SelectionLength; myQueryTextBox.SelectionStart = 0; myQueryTextBox.SelectionLength = myQueryTextBox.Text.Length; myQueryTextBox.SelectionColor = Color.Black; myQueryTextBox.SelectionStart = selstart; myQueryTextBox.SelectionLength = sellength; myQueryTextBox.SelectionColor = Color.Crimson; myTryExpression (myQueryTextBox.SelectedText); myQueryTextBox.SelectionStart = myQueryTextBox.Text.Length; myQueryTextBox.SelectionLength = 0; myQueryTextBox.SelectionColor = Color.Black; } private void myMenuItemOpenClick(object sender, System.EventArgs e) { OpenFileDialog od = new OpenFileDialog(); od.Filter = "C# class (*.cs)|*.cs"; if(od.ShowDialog() == DialogResult.OK) loadFile(od.FileName); } private void mySave(string fileName) { using (TextWriter w = new StreamWriter(fileName)) w.Write(myCSharpText.Text); myLastFileName = fileName; this.Text = fileName; } private void myMenuItemSaveClick(object sender, System.EventArgs e) { if (myLastFileName == null) myMenuItemSaveAsClick(sender,e); else mySave(myLastFileName); } private void myMenuItemSaveAsClick(object sender, System.EventArgs e) { SaveFileDialog sd = new SaveFileDialog(); if (myLastFileName != null) sd.FileName = myLastFileName; else sd.FileName = myLastClassName + ".cs"; if (sd.ShowDialog() == DialogResult.OK) mySave (sd.FileName); } private void myTableListBox_DoubleClick(object sender, System.EventArgs e) { if (myTableListBox.SelectedItem != null) { string tableName = myTableListBox.SelectedItem.ToString (); myQueryTextBox.Text = myQueryTextBox.Text == "" ? tableName : myQueryTextBox.Text + "\n" + tableName; myTryExpression (myQueryTextBox.Text); } } private void myDataGrid_MouseEnter(object sender, System.EventArgs e) { //myDataGrid.TableStyles[0].GridLineColor = Color.LightSteelBlue; if (myDataGrid.TableStyles.Count > 0) myDataGrid.TableStyles[0].HeaderBackColor = Color.LightSteelBlue; } private void myDataGrid_MouseLeave(object sender, System.EventArgs e) { //myDataGrid.TableStyles[0].GridLineColor = Color.Gainsboro; if (myDataGrid.TableStyles.Count > 0) myDataGrid.TableStyles[0].HeaderBackColor = Color.Gainsboro; } private void myCSharpText_MouseEnter(object sender, System.EventArgs e) { myCSharpText.BackColor = Color.Gainsboro; myCSharpText.Font = new Font (myCSharpText.Font.Name, myCSharpText.Font.Size, FontStyle.Bold); } private void myCSharpText_MouseLeave(object sender, System.EventArgs e) { myCSharpText.BackColor = Color.White; myCSharpText.Font = new Font (myCSharpText.Font.Name, myCSharpText.Font.Size, FontStyle.Regular); } private void myTableListBox_MouseEnter(object sender, System.EventArgs e) { myTableListBox.BackColor = Color.Gainsboro; myTableListBox.Font = new Font (myTableListBox.Font.Name, myTableListBox.Font.Size, FontStyle.Bold); } private void myTableListBox_MouseLeave(object sender, System.EventArgs e) { myTableListBox.BackColor = Color.White; myTableListBox.Font = new Font (myTableListBox.Font.Name, myTableListBox.Font.Size, FontStyle.Regular); } private void myLoad (object sender, EventArgs e) { myFreezeView (false); myToolStripMenuItemSite.DropDownItems.Clear (); foreach (var name in SitesCfg.instance.siteNames) { ToolStripMenuItem mi = new ToolStripMenuItem (name); mi.Click += new EventHandler (myMenuItemSiteClick); mySiteItems.Add (mi); mi.Enabled = true; myToolStripMenuItemSite.DropDownItems.Add (mi); if (name == mySite) mi.Checked = true; } myConsoleRichTextBox.ReadOnly = true; myConsoleOutput = new RichTextBoxStreamWriter (myConsoleRichTextBox); Console.SetOut (myConsoleOutput); Console.SetError (myConsoleOutput); if(BCG.Utilities.Win32.WindowsAPI.SetStdHandle(-11, myConsoleRichTextBox.Handle) == 0) // set stdout { var ex = new Win32Exception (); // same as new Win32Exception(Marshal.GetLastWin32Error()) Console.WriteLine (ex.Message); } else { Console.WriteLine ("Set stdout worked."); } if(BCG.Utilities.Win32.WindowsAPI.SetStdHandle(-12, myConsoleRichTextBox.Handle) == 0) // set stderr { var ex = new Win32Exception (); // same as new Win32Exception(Marshal.GetLastWin32Error()) Console.WriteLine (ex.Message); } else { Console.WriteLine ("Set stderr worked."); } Console.WriteLine ("Redirecting console ouput to this window..."); myLoadAssemblies (); ViewStreamDatabase.instance = new ViewStreamDatabase (); myAllTagsStream = myGetAllTagsStream (); myAllTagsStream.onChange += new BCG.DataStream.ChangeDelegate (myHandleTableListChange); myTabControl.SelectedIndex = 3; myTreeView.AfterSelect += new TreeViewEventHandler (myHandleTreeNodeSelect); //do this lazily so we don't have to have bps, etc up to run dsqa //_library = new LibraryForm(this); } private void myMenuItemSiteClick (object sender, System.EventArgs e) { ToolStripMenuItem mi = (ToolStripMenuItem) sender; if (mi.Text != mySite) { mySite = mi.Text; foreach (var m in mySiteItems) m.Checked = false; mi.Checked = true; myAllTagsStream.onChange -= new BCG.DataStream.ChangeDelegate (myHandleTableListChange); myTableListBox.Items.Clear (); SitesCore.setMySiteName (mySite); ViewStreamDatabase.instance = new ViewStreamDatabase (); myAllTagsStream = myGetAllTagsStream (); myAllTagsStream.onChange += new BCG.DataStream.ChangeDelegate (myHandleTableListChange); myDataGrid.DataSource = null; myTabControl.SelectedIndex = 3; mySetText (); } } private void myClosing (object sender, CancelEventArgs e) { } private void myHandleTreeNodeSelect(object sender, TreeViewEventArgs e) { if (myTreeView.SelectedNode != null) { if (myTreeView.SelectedNode.LastNode == null) { string sn = myTreeView.SelectedNode.Parent.Text + "()"; myQueryTextBox.Text = myQueryTextBox.Text == "" ? sn : myQueryTextBox.Text + "\n" + sn; } } } private void myToolStripMenuItemExit_Click (object sender, EventArgs e) { Close (); } private void myToolStripMenuItemFreeze_Click (object sender, EventArgs e) { myFreezeView (myTimer.Enabled); } private void myFreezeView (bool freeze) { myTimer.Enabled = !freeze; myToolStripMenuItemFreeze.Checked = freeze; myToolStripMenuItemStep.Enabled = freeze; } private void myToolStripMenuItemStep_Click (object sender, EventArgs e) { ViewStreamDatabase.instance.doWork (); } private void myToolStripMenuItemLoadAss_Click (object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog (); ofd.ShowReadOnly = true; DialogResult dr = ofd.ShowDialog (this); if (ofd.CheckFileExists && ofd.CheckPathExists && dr == DialogResult.OK) { PrimitiveManager.instance.loadAssembly (ofd.FileName); myLoadAssemblies (); } } private void myToolStripMenuItemTest_Click (object sender, EventArgs e) { if (myCurrentStream != null) { myCurrentStream.onChange -= new DataStream.ChangeDelegate (myCallback); myCurrentStream.onChange += new DataStream.ChangeDelegate (myCallback); } } private void myToolStripMenuItemClearConsole_Click (object sender, EventArgs e) { myConsoleRichTextBox.Clear (); Console.WriteLine ("Redirecting console ouput to this window..."); } private void myTableFilterBox_TextChanged(object sender, EventArgs e) { myUpdateTableList(); } private void myUpdateTableList() { IBlueRowCollection rows = myAllTagsStream.rows; if (rows == null) return; ICollection oldItems = myTableListBox.Items; myTableListBox.BeginUpdate(); int topindex = myTableListBox.TopIndex; string topitem = (myTableListBox.Items.Count > 0) ? myTableListBox.Items[topindex].ToString() : string.Empty; myTableListBox.Items.Clear(); SortedList sl = new SortedList(); if (string.IsNullOrEmpty(myTableFilterBox.Text)) foreach (IBlueRow r in rows) { sl[r["tag"].ToString().Substring(PubStreamPrefixer.prefix("").Length)] = true; } else { Regex tableRegex = new Regex(myTableFilterBox.Text); foreach (IBlueRow r in rows) { string thisTable = r["tag"].ToString().Substring(PubStreamPrefixer.prefix("").Length); if (tableRegex.IsMatch(thisTable)) sl[thisTable] = true; } } string[] list = new string[sl.Keys.Count]; sl.Keys.CopyTo(list, 0); myTableListBox.Items.AddRange(list); int top = sl.IndexOfKey(topitem); if (top >= 0) myTableListBox.TopIndex = top; else myTableListBox.TopIndex = Math.Min(sl.Count - 1, topindex); myTableListBox.EndUpdate(); } private void testGridToolStripMenuItem_Click(object sender, EventArgs e) { HighPerformanceTimer timer = new HighPerformanceTimer(); //while (true) //{ // Random rnd = new Random(DateTime.Now.Millisecond); // List rand_nos = new List(); // for (int i = 0; i < 10000; i++) // rand_nos.Add(rnd.NextDouble()); // timer.start(); // rand_nos.Sort(); // timer.stop(); // BCG.Utilities.BlueEventLog.logEvent(String.Format("nrows = {0} sorting time = {1}", rand_nos.Count, timer.lastIntervalTime), BCG.Utilities.BlueEventLevel.Performance); // System.Threading.Thread.Sleep(10); //} ViewStream s = new LoaderStream(@"P:\Dropbox\Data\spread_md_esoa_cme"); s = new MutableAppendStream(s, s); //s = new MutableAppendStream(s, s); List rows = new List(); foreach (IBlueRow r in s.rows) rows.Add(r); for (int i = 0; i < 100; i++) { timer.start(); rows.Sort(delegate(IBlueRow r1, IBlueRow r2) { return _sort_dicts_index(r1, r2, 5, true); }); timer.stop(); BCG.Utilities.BlueEventLog.logEvent(String.Format("nrows = {0} sorting time = {1}", rows.Count, timer.lastIntervalTime), BCG.Utilities.BlueEventLevel.Performance); } } private static int mySortDictionaries(IBlueRow r1, IBlueRow r2, string column, bool low_to_high) { if (r1.Contains(column) && r2.Contains(column)) return compare_send_dontcare_to_last(r1[column], r2[column], low_to_high); else return 0; } private static int _sort_dicts_index(IBlueRow r1, IBlueRow r2, int col_no, bool low_to_high) { //return compare_send_dontcare_to_last(r1[col_no], r2[col_no], low_to_high); return ((IComparable)r1[col_no]).CompareTo(r2[col_no]); } internal static int compare_send_dontcare_to_last(object o1, object o2, bool low_to_high) { if (myIsDontCare(o1)) return myIsDontCare(o2) ? 0 : 1; else return myIsDontCare(o2) ? -1 : (low_to_high ? ((IComparable)o1).CompareTo(o2) : ((IComparable)o2).CompareTo(o1)); } private static bool myIsDontCare(object o) { return o == null || o == DBNull.Value || o is string && String.IsNullOrEmpty((string)o) || o is double && (Double.IsInfinity((double)o) || Double.IsNaN((double)o)) || o is float && (Single.IsInfinity((float)o) || Single.IsNaN((float)o)); } private void _new_grid_form(object args) { //System.Timers.Timer t = new System.Timers.Timer(); ////t.SynchronizingObject //BCG.Utilities.BlueEventLog.logEvent(String.Format("New BTSTabularGridTestForm created on thread {0}", System.Threading.Thread.CurrentThread.ManagedThreadId), // "Diagnosis"); //ViewStream s = args as ViewStream; //BTSTabularGridTestForm f = new BTSTabularGridTestForm(s); //Application.Run(f); } private void libraryToolStripMenuItem_Click(object sender, EventArgs e) { } } }