From 9200fd52814f04e15852443203b8f5d5da05295d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E8=B6=85?= Date: Tue, 25 Nov 2025 14:14:51 +0800 Subject: [PATCH] =?UTF-8?q?1.When=20the=20[Run]=20button=20is=20clicked,?= =?UTF-8?q?=20the=20title=20of=20the=20current=20tab=20automatically=20cha?= =?UTF-8?q?nges=20to=20the=20name=20of=20the=20current=20Collection.=20Thi?= =?UTF-8?q?s=20significantly=20improves=20recognition,=20especially=20when?= =?UTF-8?q?=20there=20are=20many=20unsaved=20query=20pages.=202.In=20addit?= =?UTF-8?q?ion,=20update=20the=20relevant=20reference=20packages=20to=20ne?= =?UTF-8?q?wer=20versions,=20as=20the=20old=20versions=20are=20no=20longer?= =?UTF-8?q?=20available.=201=E3=80=82=E5=BD=93=E7=82=B9=E5=87=BB[=E8=BF=90?= =?UTF-8?q?=E8=A1=8C]=E6=8C=89=E9=92=AE=E5=90=8E=EF=BC=8C=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E6=A0=87=E7=AD=BE=E9=A1=B5=E7=9A=84=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8F=98=E4=B8=BA=E5=BD=93=E5=89=8DCollectio?= =?UTF-8?q?n=E7=9A=84=E5=90=8D=E7=A7=B0=EF=BC=8C=E7=89=B9=E5=88=AB?= =?UTF-8?q?=E6=98=AF=E6=9F=A5=E8=AF=A2=E9=A1=B5=E8=BE=83=E5=A4=9A=E4=B8=94?= =?UTF-8?q?=E6=9C=AA=E4=BF=9D=E5=AD=98=E6=97=B6=EF=BC=8C=E5=A4=A7=E5=A4=A7?= =?UTF-8?q?=E6=8F=90=E9=AB=98=E4=BA=86=E8=BE=A8=E8=AF=86=E5=BA=A6=E3=80=82?= =?UTF-8?q?=202=E3=80=82=E5=8F=A6=E5=A4=96=E5=B0=86=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E5=8C=85=E6=9B=B4=E6=96=B0=E4=B8=BA=E8=BE=83?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E7=89=88=E6=9C=AC=EF=BC=8C=E6=97=A7=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E4=B8=8D=E5=86=8D=E5=8F=AF=E7=94=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitmodules | 2 +- LiteDB.Studio/Forms/MainForm.cs | 17 ++++++-- LiteDB.Studio/LiteDB.Studio.csproj | 64 +++++++++++++++++++++++++----- LiteDB.Studio/packages.config | 16 ++++++-- 4 files changed, 81 insertions(+), 18 deletions(-) diff --git a/.gitmodules b/.gitmodules index b3a6267..d1d3fe6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "LiteDB"] path = LiteDB - url = git@github.com:mbdavid/LiteDB.git + url = https://github.com/mbdavid/LiteDB.git diff --git a/LiteDB.Studio/Forms/MainForm.cs b/LiteDB.Studio/Forms/MainForm.cs index 012d0dc..3040c55 100644 --- a/LiteDB.Studio/Forms/MainForm.cs +++ b/LiteDB.Studio/Forms/MainForm.cs @@ -293,7 +293,7 @@ private void LoadTreeView() col.ContextMenuStrip = ctxMenu; } } - + public string LastExecCollection = string.Empty; private void CreateThread(TaskData task) { while (true) @@ -330,6 +330,7 @@ private void CreateThread(TaskData task) using (var reader = _db.Execute(sql, task.Parameters)) { task.ReadResult(reader); + LastExecCollection = reader.Collection; } } @@ -592,13 +593,22 @@ private void MainForm_KeyDown(object sender, KeyEventArgs e) } } - private void BtnRun_Click(object sender, EventArgs e) + private async void BtnRun_Click(object sender, EventArgs e) { var sql = txtSql.ActiveTextAreaControl.SelectionManager.SelectedText.Length > 0 ? txtSql.ActiveTextAreaControl.SelectionManager.SelectedText : txtSql.Text; - + btnRun.Enabled = false; + LastExecCollection= string.Empty; this.ExecuteSql(sql); + await Task.Factory.StartNew(() => + { + while (LastExecCollection == string.Empty) { + Thread.Sleep(100); + } + }); + btnRun.Enabled = true; + tabSql.SelectedTab.Text = LastExecCollection+ TAB_SPACES; } private void BtnBegin_Click(object sender, EventArgs e) @@ -876,6 +886,7 @@ private void TabSql_DrawItem(object sender, DrawItemEventArgs e) } else { + var size= e.Graphics.MeasureString(tab.Text, font); e.Graphics.DrawString("×", font, Brushes.SlateGray, e.Bounds.Right - 19, e.Bounds.Top - 1); e.Graphics.DrawString(tab.Text, e.Font, Brushes.Black, e.Bounds.Left + 12, e.Bounds.Top + 2); } diff --git a/LiteDB.Studio/LiteDB.Studio.csproj b/LiteDB.Studio/LiteDB.Studio.csproj index a5b957d..5e440c8 100644 --- a/LiteDB.Studio/LiteDB.Studio.csproj +++ b/LiteDB.Studio/LiteDB.Studio.csproj @@ -1,6 +1,6 @@  - + @@ -40,19 +40,67 @@ LiteDB.Studio.ico + + ..\packages\LiteDB.5.0.21\lib\net45\LiteDB.dll + - ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + - + + ..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll + + + ..\packages\System.IO.4.3.0\lib\net462\System.IO.dll + True + True + + + ..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll + True + True + + + ..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll + True + True + + + ..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll + True + True + + + ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll + True + True + + + ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll + True + True + + + ..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll + True + True + + + ..\packages\System.Text.RegularExpressions.4.3.1\lib\net463\System.Text.RegularExpressions.dll + True + True + - @@ -352,12 +400,6 @@ - - - {70e32ff1-6e08-4bf0-9c99-33e1f3711dd7} - LiteDB - - @@ -365,7 +407,7 @@ - + \ No newline at end of file diff --git a/LiteDB.Studio/packages.config b/LiteDB.Studio/packages.config index 5365317..daa4076 100644 --- a/LiteDB.Studio/packages.config +++ b/LiteDB.Studio/packages.config @@ -1,7 +1,17 @@  - - + + - + + + + + + + + + + + \ No newline at end of file