コード例 #1
0
        protected void FrmDillenSQLManagementStudio_Load(object sender, EventArgs e)
        {
            this.Opacity = 0;

            //Show Splash
            FrmSplash frmSplash = new FrmSplash();

            frmSplash.Show();
            frmSplash.FormClosed += (s, args) => this.AuxSplashClosed(frmSplash);

            this.TryConnWithMyDtbs(true);

            //mySQLConnection
            this.mySqlCon = new MySqlConnection(this.user);

            //INICIALIZE RICHTEXT BOX
            this.sqlRchtxtbx = new SqlRichTextBox(ref this.rchtxtCode, this, this.mySqlCon, false);
            this.sqlRchtxtbx.SetNewEvents(new System.EventHandler(this.newRchtxtCode_TextChanged),
                                          new System.Windows.Forms.PreviewKeyDownEventHandler(this.newRchtxtCode_PreviewKeyDown));
            this.sqlRchtxtbx.SQLRichTextBox.KeyPress += new KeyPressEventHandler(this.newRchtxtCode_KeyPress);

            //opacity to darken the rest of the Form except the Menu
            this.opaquePanel.BringToFront();

            //panel in first place
            this.pnlFile.BringToFront();
            this.pnlEdit.BringToFront();
            this.pnlExecuteAs.BringToFront();
            this.pnlVPNConfiguration.BringToFront();

            //splash can close
            frmSplash.CanClose(this.user != null);
        }
コード例 #2
0
        //INICIALIZE
        public FrmCommandExplanation(int codCmd, User user, MySqlConnection mySqlCon)
        {
            InitializeComponent();
            //set font to TableName's Cell in grvSelect
            this.grvSelectTry.TopLeftHeaderCell.Style.Font = new Font(new FontFamily("Modern No. 20"), 10.0F, FontStyle.Bold);

            if (!user.IsConnected())
            {
                throw new Exception("Unicamp VPN was disconnected! This resource is not available anymore!");
            }

            this.mySqlConn = mySqlCon;
            this.codCmd    = codCmd;

            //name
            this.command = new CultureInfo("en-US", false).TextInfo.ToTitleCase(user.CommandFromCod(codCmd));
            //fisrt letters of all words in upper case
            this.Text = this.command;

            //explanation
            user.GetExplanationSqlCommand(codCmd, ref this.titles, ref this.cmdExplanations,
                                          ref this.textsUserTry);

            //INICIALIZE RICHTEXT BOX
            this.sqlRchtxtbx = new SqlRichTextBox(ref this.rchtxtTryCode, this, mySqlCon);

            //Inicialize MulticolorLabel
            this.multicolorLabel = new MulticolorLabel(new Point(0, 0), 0, 0, this, new Font(new FontFamily("Courier New"), 12.0F),
                                                       Color.Black, SystemColors.Control);
        }
コード例 #3
0
        public static string AllCodes(SqlRichTextBox sqlRchtxtbx, ref Queue <int> linesNoEvenQuotMarks)
        {
            RichTextBox rchtxtCode = sqlRchtxtbx.SQLRichTextBox;
            //or this.rchtxtCode

            //put txtCode.Items in a String (with spaces between each line)
            string allCodes = "";

            //if there's nothing selected
            if (rchtxtCode.SelectionLength <= 0)
            {
                for (int i = 0; i < rchtxtCode.Lines.Length; i++)
                {
                    string currLine = rchtxtCode.Lines[i];

                    //if there're even
                    if (SqlExecuteProcedures.RealCodeLine(ref currLine))
                    {
                        allCodes += " " + currLine;
                    }
                    else
                    {
                        linesNoEvenQuotMarks.Enqueue(i);
                    }
                }
            }
            else
            //there's something selected
            {
                int qtdOtherChars1 = 0;
                int indexFirstLine = sqlRchtxtbx.IndexOfLine(rchtxtCode.SelectionStart, ref qtdOtherChars1);
                int qtdOtherChars2 = 0;
                int indexLastLine  = sqlRchtxtbx.IndexOfLine(rchtxtCode.SelectionStart + rchtxtCode.SelectionLength,
                                                             ref qtdOtherChars2);

                for (int i = indexFirstLine; i <= indexLastLine; i++)
                {
                    string line;
                    if (i == indexFirstLine)
                    {
                        int final;
                        if (indexFirstLine == indexLastLine)
                        {
                            final = rchtxtCode.SelectionStart + rchtxtCode.SelectionLength - qtdOtherChars1;
                        }
                        else
                        {
                            final = rchtxtCode.Lines[i].Length;
                        }

                        int start = rchtxtCode.SelectionStart - qtdOtherChars1;

                        line = rchtxtCode.Lines[i].Substring(start, final - start);
                    }
                    else
                    if (i == indexLastLine)
                    {
                        line = rchtxtCode.Lines[i].Substring(0, rchtxtCode.SelectionStart + rchtxtCode.SelectionLength - qtdOtherChars2);
                    }
                    else
                    if (i < indexLastLine)
                    {
                        line = rchtxtCode.Lines[i];
                    }
                    else
                    {
                        break;
                    }

                    //if there're even
                    if (SqlExecuteProcedures.RealCodeLine(ref line))
                    {
                        allCodes += " " + line;
                    }
                    else
                    {
                        linesNoEvenQuotMarks.Enqueue(i);
                    }
                }
            }

            return(allCodes);
        }