Skip to content

Commit

Permalink
Merge pull request #131 from arbmu/bugfix/connection_dialog_fixes
Browse files Browse the repository at this point in the history
Connection dialog fixes
  • Loading branch information
tdanner committed Mar 22, 2018
2 parents f017110 + d6982ef commit 41e0df7
Show file tree
Hide file tree
Showing 7 changed files with 277 additions and 344 deletions.
6 changes: 5 additions & 1 deletion Src/SwqlStudio/ITabsFactory.cs
Expand Up @@ -4,12 +4,16 @@ namespace SwqlStudio
{
internal interface ITabsFactory
{
void AddTextToEditor(string text, ConnectionInfo info);
void OpenQueryTab();

void OpenQueryTab(string text, ConnectionInfo info);

void OpenActivityMonitor(ConnectionInfo connectionInfo);

void OpenInvokeTab(ConnectionInfo connectionInfo, Verb verb);

void OpenCrudTab(CrudOperation operation, ConnectionInfo connectionInfo, Entity entity);

void OpenFiles(string[] files);
}
}
42 changes: 21 additions & 21 deletions Src/SwqlStudio/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 10 additions & 20 deletions Src/SwqlStudio/MainForm.cs
Expand Up @@ -6,7 +6,6 @@
using System.Windows.Forms;
using SolarWinds.InformationService.Contract2;
using SolarWinds.InformationService.InformationServiceClient;
using SwqlStudio.Metadata;
using SwqlStudio.Properties;
using SwqlStudio.Subscriptions;
using SwqlStudio.Utils;
Expand Down Expand Up @@ -118,7 +117,16 @@ private void startTimer_Tick(object sender, EventArgs e)

private void menuFileNew_Click(object sender, EventArgs e)
{
this.filesDock.AddNewQueryTab();
try
{
ConnectionInfo.DoWithExceptionTranslation(() => connectionsManager.CreateConnection());
}
catch (Exception ex)
{
log.Error("Failed to connect", ex);
var msg = $"Unable to connect to Information Service.\n{ex.Message}";
MessageBox.Show(msg, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

private void menuFileOpen_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -245,19 +253,6 @@ private void menuEditPaste_Click(object sender, EventArgs e)

#region Other stuff

private void TextEditorDragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Entity)))
e.Effect = DragDropEffects.Copy;
}

private void TextEditorDragDrop(object sender, DragEventArgs e)
{
Entity entity = e.Data.GetData(typeof(Entity)) as Entity;
if (entity != null)
this.filesDock.GenerateSelectStatement(entity, (e.KeyState & 8) == 8);
}

private void TextEditor_FormClosing(object sender, FormClosingEventArgs e)
{
// Ask user to save changes
Expand Down Expand Up @@ -432,11 +427,6 @@ private void connectionsCombobox_SelectedIndexChanged(object sender, EventArgs e
}
}

private void newConnectionButton_Click(object sender, EventArgs e)
{
this.connectionsManager.CreateConnection();
}

private void disconnectToolButton_Click(object sender, EventArgs e)
{
this.SelectedConnection?.Close();
Expand Down

0 comments on commit 41e0df7

Please sign in to comment.