2 // Copyright (c) 2010-2014 Yves Langisch. All rights reserved.
3 // http://cyberduck.ch/
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // Bug fixes, suggestions and comments should be sent to:
20 using System
.Windows
.Forms
;
21 using ch
.cyberduck
.core
;
22 using ch
.cyberduck
.core
.aquaticprime
;
23 using ch
.cyberduck
.core
.local
;
24 using ch
.cyberduck
.core
.notification
;
25 using ch
.cyberduck
.core
.preferences
;
26 using Ch
.Cyberduck
.Ui
.Controller
;
27 using Application
= System
.Windows
.Forms
.Application
;
29 namespace Ch
.Cyberduck
.Ui
.Growl
31 public class ToolstripNotificationService
: NotificationService
33 private readonly NotifyIcon _icon
= new NotifyIcon();
35 public void notify(string title
, string description
)
37 _icon
.ShowBalloonTip(PreferencesFactory
.get().getInteger("notifications.timeout.milliseconds"), title
,
38 description
, ToolTipIcon
.Info
);
43 ContextMenuStrip rightMenu
= new ContextMenuStrip();
44 ToolStripMenuItem itemUpdate
= new ToolStripMenuItem
46 Text
= LocaleFactory
.get().localize("Check for Update…", "Main")
48 itemUpdate
.Click
+= delegate { UpdateController.Instance.ForceCheckForUpdates(false); }
;
49 ToolStripMenuItem itemDonate
= new ToolStripMenuItem
51 Text
= LocaleFactory
.get().localize("Donate…", "Main")
54 delegate { BrowserLauncherFactory.get().open(PreferencesFactory.get().getProperty("website.donate")); }
;
55 ToolStripMenuItem itemKey
= new ToolStripMenuItem {Text = LicenseFactory.find().ToString(), Enabled = false}
;
56 ToolStripMenuItem itemExit
= new ToolStripMenuItem
58 Text
= LocaleFactory
.get().localize("Exit", "Localizable")
60 itemExit
.Click
+= delegate { MainController.Exit(); }
;
61 rightMenu
.Items
.AddRange(new ToolStripItem
[]
62 {itemUpdate, new ToolStripSeparator(), itemDonate, itemKey, new ToolStripSeparator(), itemExit}
);
64 _icon
.Icon
= Icon
.ExtractAssociatedIcon(Application
.ExecutablePath
);
66 _icon
.ContextMenuStrip
= rightMenu
;
68 _icon
.MouseClick
+= delegate(object sender
, MouseEventArgs args
)
70 if (args
.Button
== MouseButtons
.Left
)
72 foreach (BrowserController browser
in MainController
.Browsers
)
74 browser
.View
.Activate();
75 browser
.View
.BringToFront();
81 public void unregister()
86 public void notifyWithImage(string title
, string description
, string image
)
88 notify(title
, description
);