Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions LiteDB.Studio/Forms/MainForm.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
using ICSharpCode.TextEditor;
using LiteDB.Engine;
using LiteDB.Studio.Forms;
using LiteDB.Studio.Forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
Expand All @@ -26,8 +20,20 @@ public partial class MainForm : Form
private ConnectionString _connectionString = null;
private SqlCodeCompletion _codeCompletion;

public MainForm(string filename)
public MainForm(string[] args)
{
string filename = null;
bool upgrade = false;

if (args.Length >= 1)
{
filename = args[0];
}
if (args.Length >= 2)
{
bool.TryParse(args[1], out upgrade);
}

InitializeComponent();

// For performance https://stackoverflow.com/questions/4255148/how-to-improve-painting-performance-of-datagridview
Expand All @@ -43,7 +49,7 @@ public MainForm(string filename)
}
else
{
this.Connect(new ConnectionString(filename));
this.Connect(new ConnectionString(filename){Upgrade = upgrade });
}

txtSql.ActiveTextAreaControl.TextArea.Caret.PositionChanged += (s, e) =>
Expand Down
7 changes: 2 additions & 5 deletions LiteDB.Studio/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using ICSharpCode.TextEditor.Util;

Expand All @@ -18,7 +15,7 @@ static void Main(string[] args)
Application.ApplicationExit += OnExit;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm(args.Length == 0 ? null : args[0]));
Application.Run(new MainForm(args));
}

private static void OnExit(object sender, EventArgs eventArgs)
Expand All @@ -27,4 +24,4 @@ private static void OnExit(object sender, EventArgs eventArgs)
AppSettingsManager.PersistData();
}
}
}
}