Skip to content

Commit

Permalink
fixed manual mount VFS exceptions catch
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Dimov committed Aug 7, 2015
1 parent 9d7d6e1 commit a11e6f8
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions Sshfs/Sshfs/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,29 @@ void proxyType_SelectedIndexChanged(object sender, EventArgs e) {
}
}

private void tryMountVFS()
{
try
{
virtualDrive.Mount();
}
catch (Exception ex)
{
if (Visible)
{
BeginInvoke(
new MethodInvoker(
() =>
MessageBox.Show(this,
String.Format("{0} could not connect:\n{1}",
"Virtual drive", ex.Message), Text)));
}
else
{
ShowBallon(String.Format("{0} : {1}", "Virtual drive", ex.Message), true);
}
}
}

protected override void OnLoad(EventArgs e)
{
Expand Down Expand Up @@ -101,26 +124,7 @@ protected override void OnLoad(EventArgs e)
virtualDrive.StatusChanged += drive_VFSStatusChanged;

updateVirtualDriveCombo();
try
{
virtualDrive.Mount();
}
catch (Exception ex)
{
if (Visible)
{
BeginInvoke(
new MethodInvoker(
() =>
MessageBox.Show(this,
String.Format("{0} could not connect:\n{1}",
"Virtual drive", ex.Message), Text)));
}
else
{
ShowBallon(String.Format("{0} : {1}", "Virtual drive", ex.Message), true);
}
}
this.tryMountVFS();
buttonVFSupdate();


Expand Down Expand Up @@ -770,7 +774,8 @@ private void buttonVFSMount_Click(object sender, EventArgs e)

if (virtualDrive.Status == DriveStatus.Unmounted)
{
virtualDrive.Mount();
this.tryMountVFS();

}else if (virtualDrive.Status == DriveStatus.Mounted)
{
virtualDrive.Unmount();
Expand Down

0 comments on commit a11e6f8

Please sign in to comment.