Esempio n. 1
0
        public static void BindBsonData(this ICSharpCode.TextEditor.TextEditorControl txt, TaskData data)
        {
            var index = 0;
            var sb    = new StringBuilder();



            if (data.Result.Count > 0)
            {
                foreach (var value in data.Result)
                {
                    if (data.Result?.Count > 1)
                    {
                        sb.AppendLine($"/* {index++ + 1} */");
                    }

                    sb.Append(JsonConvert.SerializeObject(value));
                    sb.AppendLine();
                }

                if (data.LimitExceeded)
                {
                    sb.AppendLine();
                    sb.AppendLine("/* Limit exceeded */");
                }
            }
            else
            {
                sb.AppendLine("no result");
            }

            txt.SetHighlighting("JSON");
            txt.Text = sb.ToString();
        }
Esempio n. 2
0
        private void ApplySyntax(ref ICSharpCode.TextEditor.TextEditorControl editorSource)
        {
            string theme = settingsManager.getSettingValue("Theme");

            if (tabControl1.TabPages.Count > 0)
            {
                editorSource.SetHighlighting("Lua_" + theme);
            }
        }
Esempio n. 3
0
 internal static void SetTextBoxStyle(ICSharpCode.TextEditor.TextEditorControl Editor)
 {
     Editor.ShowEOLMarkers      = false;
     Editor.ShowHRuler          = false;
     Editor.ShowInvalidLines    = false;
     Editor.ShowSpaces          = false;
     Editor.ShowTabs            = false;
     Editor.ShowMatchingBracket = true;
     Editor.AllowCaretBeyondEOL = false;
     Editor.ShowVRuler          = false;
     Editor.ImeMode             = ImeMode.On;
     Editor.SetHighlighting("TSQL");
 }
Esempio n. 4
0
        public static void BindBsonData(this ICSharpCode.TextEditor.TextEditorControl txt, TaskData data)
        {
            var index = 0;
            var sb    = new StringBuilder();

            using (var writer = new StringWriter(sb))
            {
                var json = new JsonWriter(writer)
                {
                    Pretty = true,
                    Indent = 2
                };

                if (data.Result.Count > 0)
                {
                    foreach (var value in data.Result)
                    {
                        if (data.Result?.Count > 1)
                        {
                            sb.AppendLine($"/* {index++ + 1} */");
                        }

                        json.Serialize(value);
                        sb.AppendLine();
                    }

                    if (data.LimitExceeded)
                    {
                        sb.AppendLine();
                        sb.AppendLine("/* Limit exceeded */");
                    }
                }
                else
                {
                    sb.AppendLine("no result");
                }
            }

            txt.SetHighlighting("JSON");
            txt.Text = sb.ToString();
        }
Esempio n. 5
0
        public static void BindParameter(this ICSharpCode.TextEditor.TextEditorControl txt, TaskData data)
        {
            txt.SuspendLayout();
            txt.Clear();
            txt.SetHighlighting("JSON");

            var sb = new StringBuilder();

            using (var writer = new StringWriter(sb))
            {
                var w = new JsonWriter(writer)
                {
                    Pretty = true,
                    Indent = 2
                };

                w.Serialize(data.Parameters ?? BsonValue.Null);
            }

            txt.Text = sb.ToString();
            txt.ResumeLayout();
        }