Skip to content

Commit

Permalink
Open query panel upon loading database
Browse files Browse the repository at this point in the history
  • Loading branch information
Rekkonnect committed May 28, 2023
1 parent 5b5c8d9 commit cd31fc5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
12 changes: 11 additions & 1 deletion MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ private void LoadDatabase(string fileName, string password)
main.Expand();
treeDb.EndUpdate();
treeDb.SelectedNode = treeDb.Nodes[0];

// Show query panel immediately
btnQuery.Checked = true;
UpdateQueryPanelState();

settings.AddToRecentFiles(fileName);
UpdateRecentFilesMenu();
}
Expand Down Expand Up @@ -358,14 +363,19 @@ private void btnOpen_Click(object sender, EventArgs e)
LoadDatabase(openFileDialog1.FileName);
}

private void btnQuery_Click(object sender, EventArgs e)
private void UpdateQueryPanelState()
{
splitterHorizontal.Panel1Collapsed = splitterHorizontal.IsSplitterFixed = !btnQuery.Checked;
showEditorMenuItem.Checked = btnQuery.Checked;
rtbQuery.Select();
UpdateStatus();
}

private void btnQuery_Click(object sender, EventArgs e)
{
UpdateQueryPanelState();
}

private void mainForm_FormClosing(object sender, FormClosingEventArgs e)
{
SaveSettings();
Expand Down
17 changes: 9 additions & 8 deletions SqlCeDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ You should have received a copy of the GNU General Public License
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Forms;
Expand All @@ -29,15 +30,15 @@ namespace CompactView
{
public class SqlCeDb : SqlCeBase
{
private System.Globalization.CultureInfo culture;
private Dictionary<string, string> tablesDdl = new Dictionary<string, string>();
private Dictionary<string, string> primaryKeysDdl = new Dictionary<string, string>();
private Dictionary<string, string> indexesDdl = new Dictionary<string, string>();
private Dictionary<string, string> foreignKeysDdl = new Dictionary<string, string>();
private CultureInfo culture;
private readonly Dictionary<string, string> tablesDdl = new Dictionary<string, string>();
private readonly Dictionary<string, string> primaryKeysDdl = new Dictionary<string, string>();
private readonly Dictionary<string, string> indexesDdl = new Dictionary<string, string>();
private readonly Dictionary<string, string> foreignKeysDdl = new Dictionary<string, string>();

public SqlCeDb() : base()
{
culture = System.Globalization.CultureInfo.InvariantCulture;
culture = CultureInfo.InvariantCulture;
}

new public bool Open(string databaseFile, string password)
Expand Down Expand Up @@ -271,7 +272,7 @@ private Constraint GetConstraint(ref DbDataReader dr)
return cst;
}

private void AddColumnLine(ref StringBuilder ddl, Column col)
private void AddColumnLine(StringBuilder ddl, Column col)
{
switch (col.DataType)
{
Expand Down Expand Up @@ -363,7 +364,7 @@ private void AddColumnsDdl(ref StringBuilder ddl, string tableName)
first = false;
else
ddl.Append($",{Environment.NewLine}");
AddColumnLine(ref ddl, GetColumn(ref dr));
AddColumnLine(ddl, GetColumn(ref dr));
}
dr.Close();
}
Expand Down

0 comments on commit cd31fc5

Please sign in to comment.