Пример #1
0
        public FrmDataBaseQuery(ServerTag serverTag, string strDbName, string strDefaultSql, bool blnAutoRun)
        {
            InitializeComponent();

            txtSql.ShowEOLMarkers                = false;
            txtSql.ShowHRuler                    = false;
            txtSql.ShowInvalidLines              = false;
            txtSql.ShowMatchingBracket           = true;
            txtSql.ShowSpaces                    = false;
            txtSql.ShowTabs                      = false;
            txtSql.ShowVRuler                    = false;
            txtSql.AllowCaretBeyondEOL           = false;
            txtSql.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("SQL");
            txtSql.Encoding                      = Encoding.GetEncoding("GB2312");

            bckWorker.WorkerReportsProgress = true;
            this.m_dtDbName  = serverTag.ServerDBNames;
            this.m_strServer = serverTag.Server;
            this.m_strDbName = strDbName;
            this.m_serverTag = serverTag;
            this.Text        = m_strDbName + @"查询";
            ComboboxHelper.BindCombobox(cboDbName, serverTag.ServerDBNames, "name", "name", false);
            this.cboDbName.Text             = m_strDbName;
            cboDbName.SelectedIndexChanged += cboDbName_SelectedIndexChanged;
            if (strDefaultSql != string.Empty)
            {
                txtSql.Text = strDefaultSql;
                if (blnAutoRun)
                {
                    cmdRun_Click(null, null);
                }
            }
        }
Пример #2
0
        public void SetMemento(Properties memento)
        {
            Properties properties = (Properties)memento;

            textAreaControl.ActiveTextAreaControl.Caret.Position = textAreaControl.Document.OffsetToPosition(Math.Min(textAreaControl.Document.TextLength, Math.Max(0, properties.Get("CaretOffset", textAreaControl.ActiveTextAreaControl.Caret.Offset))));
//			textAreaControl.SetDesiredColumn();

            if (textAreaControl.Document.HighlightingStrategy.Name != properties.Get("HighlightingLanguage", textAreaControl.Document.HighlightingStrategy.Name))
            {
                IHighlightingStrategy highlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(properties.Get("HighlightingLanguage", textAreaControl.Document.HighlightingStrategy.Name));
                if (highlightingStrategy != null)
                {
                    textAreaControl.Document.HighlightingStrategy = highlightingStrategy;
                }
            }
            textAreaControl.ActiveTextAreaControl.TextArea.TextView.FirstVisibleLine = properties.Get("VisibleLine", 0);

            textAreaControl.Document.FoldingManager.DeserializeFromString(properties.Get("Foldings", ""));
//			// insane check for cursor position, may be required for document reload.
//			int lineNr = textAreaControl.Document.GetLineNumberForOffset(textAreaControl.Document.Caret.Offset);
//			LineSegment lineSegment = textAreaControl.Document.GetLineSegment(lineNr);
//			textAreaControl.Document.Caret.Offset = Math.Min(lineSegment.Offset + lineSegment.Length, textAreaControl.Document.Caret.Offset);
//
//			textAreaControl.OptionsChanged();
//			textAreaControl.Refresh();
        }
Пример #3
0
        private void btnValidateSql_Click(object sender, EventArgs e)
        {
            List <ParseErrorInfo> errors;

            ContextMenu contextMenu;

            DataViewDB dvDB;

            SqlParser.Instance().Parse(this.textEditorControl.Document.TextContent, 0, out dvDB, out errors, out contextMenu);

            this.textEditorControl_Output.Document.HighlightingStrategy =
                HighlightingStrategyFactory.CreateHighlightingStrategy("TSQL");

            textEditorControl_Output.Document.TextContent = null;

            if (dvDB != null)
            {
                OnError(dvDB.Errors);

                dvDB.InitOption();

                dvDB.Context.Wise(null);
                var builder = new StringBuilder();
                dvDB.Context.Render(builder);
                this.textEditorControl_Output.Text = builder.ToString();
                this.textEditorControl_Output.Invalidate();
                textEditorControl_Output.Refresh();
            }
        }
Пример #4
0
        public void SetHighlighting(string mode)
        {
            IHighlightingStrategy strategy = HighlightingStrategyFactory.CreateHighlightingStrategy(mode);

            //IHighlightingStrategy strategy = HighlightingManager.Manager.FindHighlighter(mode);
            Document.HighlightingStrategy = strategy;
        }
Пример #5
0
 private void FinalText_Load(object sender, EventArgs e)
 {
     DealData.SetFParameter();
     //textEditorControl1.Text = DALText();
     //textEditorControl1.Text = EntityText();
     if (Singleton <Condition> .Instance.ResultType == ResultType.DAL)
     {
         if (string.IsNullOrEmpty(Singleton <Condition> .Instance.DALAccessType))
         {
             Singleton <Condition> .Instance.DALAccessType = "public";
         }
         textEditorControl1.Text = DALText.FinalDAL();
     }
     else if (Singleton <Condition> .Instance.ResultType == ResultType.Entity)
     {
         if (string.IsNullOrEmpty(Singleton <Condition> .Instance.EntityAccessType))
         {
             Singleton <Condition> .Instance.EntityAccessType = "public";
         }
         //textEditorControl1.Text = FinalTexts.EntityTexts();
         textEditorControl1.Text = EntityText.FinalEntity();
     }
     else
     {
         //textEditorControl1.Text = FinalTexts.ProcTexts();
     }
     //if (ActiveEditor != null)
     //{
     //    ActiveEditor.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy(miThis.Tag as string);
     //}
     textEditorControl1.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("C#");
 }
Пример #6
0
        public void LoadFromFile(string fileName)
        {
            TextArea area = editor.ActiveTextAreaControl.TextArea;

            editor.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile(fileName);
            try
            {
                using (StreamReader sr = new StreamReader(fileName))
                {
                    editor.Document.TextContent = sr.ReadToEnd();
                    sr.Close();
                }
                area.Caret.Position = new Point(0, 0);
                if (watcher == null)
                {
                    watcher = new FileSystemWatcher();
                    watcher.NotifyFilter = System.IO.NotifyFilters.LastWrite;
                    FileInfo info = new FileInfo(fileName);
                    watcher.Path     = info.DirectoryName;
                    watcher.Filter   = info.Name;
                    watcher.Changed += new FileSystemEventHandler(WatcherChanged);
                }
                watcher.EnableRaisingEvents = true;
            }
            catch (Exception ex)
            {
                form.LogError = ex.Message;
            }
        }
Пример #7
0
        public ShowCodeFrm()
        {
            InitializeComponent();

            this.textEditorControl1.Document.HighlightingStrategy =
                HighlightingStrategyFactory.CreateHighlightingStrategy("C#");
        }
        public void NewDocument(string filename)
        {
            if (_documents.ContainsKey(filename))
            {
                return;
            }


            if (File.Exists(filename))
            {
                Document = new DocumentFactory().CreateFromFile(filename);
                /////Text = File.ReadAllText(filename);

                Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("VS-C#");
            }
            else
            {
                Document = new DocumentFactory().CreateDocument();

                Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("VS-C#");
            }

            _documents.Add(filename, Document);

            ///// InitDocument();
            UltraSuperRefreshMethod();
        }
Пример #9
0
        private static void SetDarkTheme()
        {
            IHighlightingStrategy scheme = HighlightingStrategyFactory.CreateHighlightingStrategy("Dark");

            TipGradient = scheme.GetColorFor("TipsGradient");

            SelectedHighlight     = new HighlightColor(Color.White, Color.MediumVioletRed);
            CodeFunctions         = Color.FromArgb(64, 64, 90);
            HighlightError        = Color.Red;
            HighlightIncludeError = Color.Lime;
            IncludeHighlight      = Color.DarkSlateGray;
            TreeNameFunction      = Color.FromArgb(243, 233, 122); //LightKhaki

            Color back = Color.FromArgb(40, 40, 42);

            mainForm.FunctionTreeLeft.BackColor = back;
            mainForm.FunctionTreeLeft.ForeColor = Color.Gainsboro;
            mainForm.FunctionTreeLeft.LineColor = Color.DimGray;

            mainForm.FunctionsTree.BackColor = back;
            mainForm.FunctionsTree.ForeColor = Color.Gainsboro;
            mainForm.FunctionsTree.LineColor = Color.DimGray;

            mainForm.ProcTree.BackColor = back;
            mainForm.ProcTree.ForeColor = Color.Gainsboro;
            mainForm.ProcTree.LineColor = Color.Gray;

            mainForm.VarTree.BackColor = back;
            mainForm.VarTree.ForeColor = Color.Gainsboro;
            mainForm.VarTree.LineColor = Color.Gray;
        }