Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Improved balloon tips and fixed focus for new window instances
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDuffman85 authored and TheDuffman85 committed Feb 24, 2015
1 parent ee0b2ab commit 3c1b6d1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 19 deletions.
46 changes: 29 additions & 17 deletions Synology Download Station Adapter/Adapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,27 @@ public static Form VisibleForm
{
get
{
if (frmDownloadStation.Instance.Visible)
{
return frmDownloadStation.Instance;
}
else if(frmSelectHoster.Instance.Visible)
{
return frmSelectHoster.Instance;
}
else if (frmAddLinks.Instance.Visible)
{
return frmAddLinks.Instance;
}
else
{
return frmSettings.Instance;
}

return (Form)frmSettings.Instance.Invoke(new Func<Form>(
delegate
{
if (frmDownloadStation.Instance.Visible)
{
return frmDownloadStation.Instance;
}
else if (frmSelectHoster.Instance.Visible)
{
return frmSelectHoster.Instance;
}
else if (frmAddLinks.Instance.Visible)
{
return frmAddLinks.Instance;
}
else
{
return frmSettings.Instance;
}
}));
}
}

Expand Down Expand Up @@ -283,7 +288,14 @@ private static void WebRequestCallback(IAsyncResult result)

if (decrypter != null)
{
decrypter.Decrypt();
try
{
decrypter.Decrypt();
}
catch (Exception ex)
{
Adapter.ShowBalloonTip(ex.Message, ToolTipIcon.Error);
}

if (Properties.Settings.Default.ShowDecryptedLinks)
{
Expand Down
2 changes: 1 addition & 1 deletion Synology Download Station Adapter/frmDownloadStation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public partial class frmDownloadStation : Form
#region Variables

private static object _lock = new object();
private static frmDownloadStation _instance;
private static frmDownloadStation _instance = new frmDownloadStation();
private bool _newInstance = false;

#endregion
Expand Down
13 changes: 12 additions & 1 deletion Synology Download Station Adapter/frmSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,18 @@ private void contextMenuStrip_Opening(object sender, CancelEventArgs e)

private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
{
Adapter.OpenDownloadStation();
if (Adapter.VisibleForm.InvokeRequired)
{
Adapter.VisibleForm.Invoke((MethodInvoker)(() =>
{
Adapter.OpenDownloadStation();
}
));
}
else
{
Adapter.OpenDownloadStation();
}
}

#endregion
Expand Down

0 comments on commit 3c1b6d1

Please sign in to comment.