/// <summary>
        /// Return false if login user is not DBO.
        /// </summary>
        /// <param name="tpf">a TracePropertiesForm object</param>
        /// <returns>False if login user is not DBO.</returns>
        bool permission(TracePropertiesForm tpf)
        {
            //System.Data.SqlClient.SqlConnection conn;
            //if (tpf.RawConn != null)
            //    conn = new System.Data.SqlClient.SqlConnection(tpf.RawConn);
            //else
            //{
            //    string str_conn = string.Format("Data Source={0};Application Name={1};Database={2};",
            //        tpf.ServerName, "sqlprofilerapp", "master");
            //    if (tpf.Username == string.Empty)
            //        str_conn += string.Format("Integrated Security={0};", true);
            //    else
            //        str_conn += string.Format("User ID={0};Password={1};", tpf.Username, tpf.Password);
            //    conn = new System.Data.SqlClient.SqlConnection(str_conn);
            //}
            //conn.Open();
            //Microsoft.SqlServer.Management.Common.ServerConnection sconn;
            //sconn = new Microsoft.SqlServer.Management.Common.ServerConnection(conn);
            //Microsoft.SqlServer.Management.Smo.Server server;
            //server = new Microsoft.SqlServer.Management.Smo.Server();
            //var a = server.Databases["master"];
            //bool rc = server.Databases["master"].DboLogin;
            //conn.Close();
            //return rc;

            return true;
        }
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TracePropertiesForm tpf = new TracePropertiesForm();
            tpf.StartPosition = FormStartPosition.CenterScreen;

            if(tpf.ShowDialog() == DialogResult.OK)
            {
                if (!permission(tpf))
                    System.Windows.Forms.MessageBox.Show(string.Format("'{0}' has no correct permission.", tpf.Username),
                        "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                else
                {
                    Trace trace = _traceManager.RunProfiler(tpf.ServerName, tpf.Username, tpf.Password, tpf.TraceName, tpf.RawConn, tpf.EventProperties, tpf.FilterProperties);

                    TraceViewControl tvc = new TraceViewControl();
                    tvc.Name = "TraceViewControl";
                    tvc.Trace = trace;
                    tvc.Dock = DockStyle.Fill;

                    FATabStripItem item = new FATabStripItem(tvc);
                    item.Title = tpf.TraceName;
                    tabStrip.AddTab(item, true);

                    tabStrip.Enabled = true;
                }
            }
        }