private void ViewScript(object sender, EventArgs e)
        {
            ListView callingListView = null;

            if (sender is ToolStripDropDownItem)
            {
                ToolStripDropDownItem x     = (ToolStripDropDownItem)sender;
                ContextMenuStrip      strip = (ContextMenuStrip)x.Owner;
                if (strip.SourceControl is ListView)
                {
                    callingListView = (ListView)strip.SourceControl;
                }
            }
            else if (sender is ListView)
            {
                callingListView = (ListView)sender;
            }

            if (callingListView == null || callingListView.SelectedItems.Count == 0)
            {
                return;
            }

            string fileName = callingListView.SelectedItems[0].Text;

            if (File.Exists(Path.Combine(this.extractedPath, fileName)))
            {
                string            scriptContents = File.ReadAllText(Path.Combine(this.extractedPath, fileName));
                ScriptDisplayForm frmDisp        = new ScriptDisplayForm(scriptContents, "", fileName, Highlighting.SyntaxHightlightType.Sql);
                frmDisp.ShowDialog();
            }
        }
Ejemplo n.º 2
0
        private void viewScriptToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.dgDetail.SelectedCells.Count == 0)
            {
                return;
            }


            SqlSyncBuildData.ScriptRunRow row     = (SqlSyncBuildData.ScriptRunRow)((System.Data.DataRowView) this.dgDetail.SelectedCells[0].OwningRow.DataBoundItem).Row;
            ScriptDisplayForm             frmDisp = new ScriptDisplayForm(row.Results, row.Database, row.FileName);

            frmDisp.ShowDialog();
            frmDisp.Dispose();
        }
        private void viewScriptAsRunOnServerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List <DataGridViewRow> selectedRows = GetSelectedRows(this.dataGridView1);

            if (selectedRows.Count != 1)
            {
                return;
            }

            SqlSync.SqlBuild.ScriptRunLogRow row = (SqlSync.SqlBuild.ScriptRunLogRow)((DataRowView)selectedRows[0].DataBoundItem).Row;
            ScriptDisplayForm frmDisp            = new ScriptDisplayForm(row.ScriptText, this.connData.SQLServerName, row.ScriptFileName);

            frmDisp.ShowDialog();
            frmDisp.Dispose();
        }