Exemple #1
0
        public string getName()
        {
            StoreContext    storeContext = StoreContext.GetDefault();
            StoreAppLicense license      = storeContext.GetAppLicenseAsync().AsTask().Result;

            if (license == null)
            {
                return(LocaleFactory.localizedString("Unknown"));
            }
            if (license.IsActive)
            {
                if (license.IsTrial)
                {
                    return(LocaleFactory.localizedString("Trial Version", "License"));
                }
                else
                {
                    return((string)storeContext.User?.GetPropertyAsync(KnownUserProperties.DisplayName).AsTask().Result ?? LocaleFactory.localizedString("Unknown"));
                }
            }
            else
            {
                return(LocaleFactory.localizedString("Unknown"));
            }
        }
Exemple #2
0
        void ICyberduck.RegisterRegistration(string registrationPath)
        {
            Local   f       = LocalFactory.get(registrationPath);
            License license = LicenseFactory.get(f);

            if (license.verify(new DisabledLicenseVerifierCallback()))
            {
                f.copy(LocalFactory.get(SupportDirectoryFinderFactory.get().find(),
                                        f.getName()));
                _bc.InfoBox(license.ToString(),
                            LocaleFactory.localizedString(
                                "Thanks for your support! Your contribution helps to further advance development to make Cyberduck even better.",
                                "License"),
                            LocaleFactory.localizedString(
                                "Your registration key has been copied to the Application Support folder.",
                                "License"),
                            String.Format("{0}", LocaleFactory.localizedString("Continue", "License")), null, false);
                foreach (BrowserController controller in new List <BrowserController>(Browsers))
                {
                    controller.RemoveDonateButton();
                }
            }
            else
            {
                _bc.WarningBox(LocaleFactory.localizedString("Not a valid registration key", "License"),
                               LocaleFactory.localizedString("Not a valid registration key", "License"),
                               LocaleFactory.localizedString("This registration key does not appear to be valid.",
                                                             "License"), null,
                               String.Format("{0}", LocaleFactory.localizedString("Continue", "License")), false,
                               ProviderHelpServiceFactory.get().help(), delegate { });
            }
        }
 public bool prompt(BackgroundException failure)
 {
     if (_supressed)
     {
         return(_option);
     }
     if (_controller.Visible)
     {
         AtomicBoolean c = new AtomicBoolean(true);
         _controller.Invoke(delegate
         {
             TaskDialogResult result = _controller.View.CommandBox(LocaleFactory.localizedString("Error"),
                                                                   failure.getMessage() ?? LocaleFactory.localizedString("Unknown"),
                                                                   failure.getDetail() ?? LocaleFactory.localizedString("Unknown"), null, null,
                                                                   LocaleFactory.localizedString("Always"),
                                                                   LocaleFactory.localizedString("Continue", "Credentials"), true, TaskDialogIcon.Warning,
                                                                   TaskDialogIcon.Information, delegate(int opt, bool verificationChecked)
             {
                 if (verificationChecked)
                 {
                     _supressed = true;
                     _option    = c.Value;
                 }
             });
             if (result.Result == TaskDialogSimpleResult.Cancel)
             {
                 c.SetValue(false);
             }
         }, true);
         return(c.Value);
     }
     // Abort
     return(false);
 }
        public Credentials prompt(Host bookmark, string title, string reason, LoginOptions options)
        {
            Credentials credentials = new VaultCredentials();

            credentials.setSaved(options.save());
            AsyncDelegate d = delegate
            {
                View                = ObjectFactory.GetInstance <IPasswordPromptView>();
                View.Title          = title;
                View.Reason         = reason;
                View.OkButtonText   = LocaleFactory.localizedString("Continue", "Credentials");
                View.IconView       = IconCache.Instance.IconForName(options.icon(), 64);
                View.SavePassword   = options.save();
                View.ValidateInput += ValidateInputEventHandler;
                if (DialogResult.Cancel == View.ShowDialog(_browser.View))
                {
                    throw new LoginCanceledException();
                }
                credentials.setPassword(View.InputText);
                credentials.setSaved(View.SavePassword);
            };

            _browser.Invoke(d);
            return(credentials);
        }
Exemple #5
0
        protected override bool isChangedKeyAccepted(string hostname, PublicKey key)
        {
            AsyncController.AsyncDelegate d = delegate
            {
                _parent.CommandBox(
                    String.Format(LocaleFactory.localizedString("Changed fingerprint", "Sftp"), hostname),
                    String.Format(LocaleFactory.localizedString("Changed fingerprint", "Sftp"), hostname),
                    String.Format(
                        LocaleFactory.localizedString("The fingerprint for the {1} key sent by the server is {0}.",
                                                      "Sftp"), new SSHFingerprintGenerator().fingerprint(key), KeyType.fromKey(key).name()),
                    String.Format("{0}|{1}", LocaleFactory.localizedString("Allow"),
                                  LocaleFactory.localizedString("Deny")), false, LocaleFactory.localizedString("Always"),
                    TaskDialogIcon.Warning,
                    ProviderHelpServiceFactory.get().help(Scheme.sftp),
                    delegate(int option, bool verificationChecked)
                {
                    switch (option)
                    {
                    case 0:
                        allow(hostname, key, verificationChecked);
                        break;

                    case 1:
                        Log.warn("Cannot continue without a valid host key");
                        throw new ConnectionCanceledException();
                    }
                });
            };
            _parent.Invoke(d, true);
            return(true);
        }
Exemple #6
0
        public void warn(Host bookmark, String title, String message, String continueButton, String disconnectButton,
                         String preference)
        {
            AsyncDelegate d = delegate
            {
                _browser.CommandBox(title, title, message, String.Format("{0}|{1}", continueButton, disconnectButton),
                                    false, Utils.IsNotBlank(preference) ? LocaleFactory.localizedString("Don't show again", "Credentials") : null, TaskDialogIcon.Question,
                                    ProviderHelpServiceFactory.get().help(bookmark.getProtocol().getScheme()),
                                    delegate(int option, Boolean verificationChecked)
                {
                    if (verificationChecked)
                    {
                        // Never show again.
                        PreferencesFactory.get().setProperty(preference, true);
                    }
                    switch (option)
                    {
                    case 1:
                        throw new LoginCanceledException();
                    }
                });
            };

            _browser.Invoke(d);
            //Proceed nevertheless.
        }
Exemple #7
0
        public Credentials prompt(Host bookmark, String username, String title, String reason, LoginOptions options)
        {
            View = ObjectFactory.GetInstance <ILoginView>();
            InitEventHandlers();

            _bookmark = bookmark;
            _options  = options;

            View.Title             = LocaleFactory.localizedString(title, "Credentials");
            View.Message           = LocaleFactory.localizedString(reason, "Credentials");
            View.Username          = _credentials.getUsername();
            View.SavePasswordState = _options.save();
            View.DiskIcon          = IconCache.Instance.IconForName(_options.icon(), 64);

            InitPrivateKeys();

            Update();

            AsyncController.AsyncDelegate d = delegate
            {
                if (DialogResult.Cancel == View.ShowDialog(_browser.View))
                {
                    throw new LoginCanceledException();
                }
            };
            _browser.Invoke(d);
            return(_credentials);
        }
Exemple #8
0
 public void warn(Protocol protocol, String title, String message, String continueButton, String disconnectButton,
                  String preference)
 {
     AsyncController.AsyncDelegate d = delegate
     {
         _browser.CommandBox(title, title, message, String.Format("{0}|{1}", continueButton, disconnectButton),
                             false, LocaleFactory.localizedString("Don't show again", "Credentials"), TaskDialogIcon.Question,
                             PreferencesFactory.get().getProperty("website.help") + "/" + protocol.getScheme().name(),
                             delegate(int option, Boolean verificationChecked)
         {
             if (verificationChecked)
             {
                 // Never show again.
                 PreferencesFactory.get().setProperty(preference, true);
             }
             switch (option)
             {
             case 1:
                 throw new LoginCanceledException();
             }
         });
     };
     _browser.Invoke(d);
     //Proceed nevertheless.
 }
Exemple #9
0
        public Credentials prompt(Host bookmark, String username, String title, String reason, LoginOptions options)
        {
            View = ObjectFactory.GetInstance <ILoginView>();
            var credentials = new Credentials().withSaved(options.keychain()).withUsername(username);

            InitEventHandlers(bookmark, credentials, options);


            View.Title             = LocaleFactory.localizedString(title, "Credentials");
            View.Message           = LocaleFactory.localizedString(reason, "Credentials");
            View.Username          = username;
            View.SavePasswordState = options.keychain();
            View.DiskIcon          = Images.Get(options.icon()).Size(64);

            InitPrivateKeys();

            Update(credentials, options);

            AsyncDelegate d = delegate
            {
                if (DialogResult.Cancel == View.ShowDialog(_browser.View))
                {
                    throw new LoginCanceledException();
                }
            };

            _browser.Invoke(d);
            return(credentials);
        }
        public Credentials prompt(Host bookmark, string title, string reason, LoginOptions options)
        {
            Credentials   credentials = new Credentials().withSaved(options.keychain());
            AsyncDelegate d           = delegate
            {
                View                     = ObjectFactory.GetInstance <IPasswordPromptView>();
                View.Title               = title;
                View.Reason              = new StringAppender().append(reason).toString();
                View.OkButtonText        = LocaleFactory.localizedString("Continue", "Credentials");
                View.IconView            = Images.Get(options.icon()).Size(64);
                View.SavePasswordEnabled = options.keychain();
                View.SavePasswordState   = credentials.isSaved();

                View.ValidateInput += ValidateInputEventHandler;
                if (DialogResult.Cancel == View.ShowDialog(_browser.View))
                {
                    throw new LoginCanceledException();
                }
                credentials.setPassword(View.InputText);
                credentials.setSaved(View.SavePasswordState);
            };

            _browser.Invoke(d);
            return(credentials);
        }
Exemple #11
0
        public BookmarkForm()
        {
            InitializeComponent();

            //focus nickname
            Load += (sender, args) => textBoxNickname.Focus();

            protocol.ICImageList = ProtocolIconsImageList();

            toggleOptionsLabel.Text       = "        " + LocaleFactory.localizedString("More Options", "Bookmark");
            toggleOptionsLabel.ImageIndex = (_expanded ? 1 : 4);

            openFileDialog.Title = LocaleFactory.localizedString("Select the private key in PEM or PuTTY format",
                                                                 "Credentials");

            openFileDialog.Filter      = "Private Key Files (*.pem;*.crt;*.ppk;*)|*.pem;*.crt;*.ppk|All Files (*.*)|*.*";
            openFileDialog.FilterIndex = 1;

            SetMinMaxSize(Height);
            ConfigureToggleOptions();

            textBoxPassword.LostFocus += delegate { ChangedPasswordEvent(); };

            numericUpDownPort.GotFocus += delegate { numericUpDownPort.Select(0, numericUpDownPort.Text.Length); };
        }
Exemple #12
0
 private void RefreshJumpList()
 {
     if (Utils.IsWin7OrLater)
     {
         try
         {
             _jumpListManager.ClearCustomDestinations();
             Iterator iterator = HistoryCollection.defaultCollection().iterator();
             while (iterator.hasNext())
             {
                 Host host = (Host)iterator.next();
                 _jumpListManager.AddCustomDestination(new ShellLink
                 {
                     Path         = FolderBookmarkCollection.favoritesCollection().getFile(host).getAbsolute(),
                     Title        = BookmarkNameProvider.toString(host, true),
                     Category     = LocaleFactory.localizedString("History"),
                     IconLocation =
                         System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "cyberduck-document.ico"),
                     IconIndex = 0
                 });
             }
             _jumpListManager.Refresh();
         }
         catch (Exception exception)
         {
             Logger.warn("Exception while refreshing jump list", exception);
         }
     }
 }
 public static bool ApplicationShouldTerminate()
 {
     if (null != _instance)
     {
         //Saving state of transfer window
         PreferencesFactory.get().setProperty("queue.window.open.default", _instance.Visible);
         if (TransferCollection.defaultCollection().numberOfRunningTransfers() > 0)
         {
             TaskDialogResult result =
                 _instance.QuestionBox(LocaleFactory.localizedString("Transfer in progress"),
                                       LocaleFactory.localizedString("There are files currently being transferred. Quit anyway?"),
                                       null, String.Format("{0}", LocaleFactory.localizedString("Exit")), true);
             if (result.CommandButtonResult == 0)
             {
                 // Quit
                 for (int i = 0; i < _instance.getRegistry().size(); i++)
                 {
                     ((BackgroundAction)_instance.getRegistry().get(i)).cancel();
                 }
                 return(true);
             }
             // Cancel
             return(false);
         }
     }
     return(true);
 }
        public void StartTransfer(Transfer transfer, TransferOptions options, TransferCallback callback)
        {
            if (!_collection.contains(transfer))
            {
                if (_collection.size() > _preferences.getInteger("queue.size.warn"))
                {
                    CommandBox(LocaleFactory.localizedString("Clean Up"),
                               LocaleFactory.localizedString("Remove completed transfers from list."), null,
                               LocaleFactory.localizedString("Clean Up"), true,
                               LocaleFactory.localizedString("Don't ask again", "Configuration"), TaskDialogIcon.Question,
                               delegate(int option, bool verificationChecked)
                    {
                        if (verificationChecked)
                        {
                            // Never show again.
                            _preferences.setProperty("queue.size.warn", int.MaxValue);
                        }
                        switch (option)
                        {
                        case 0:         // Clean Up
                            View_CleanEvent();
                            break;
                        }
                    });
                }
                _collection.add(transfer);
            }
            ProgressController progressController;

            _transferMap.TryGetValue(transfer, out progressController);
            PathCache cache = new PathCache(_preferences.getInteger("transfer.cache.size"));

            background(new TransferBackgroundAction(this, transfer.withCache(cache), options, callback, cache, progressController));
        }
Exemple #15
0
        public CreateFilePromptForm()
        {
            InitializeComponent();

            Text = LocaleFactory.localizedString("Create new file", "File");
            Button cancelBtn = new Button
            {
                AutoSize = true,
                Size     = new Size(75, okButton.Size.Height),
                TabIndex = 5,
                Text     = LocaleFactory.localizedString("Cancel"),
                UseVisualStyleBackColor = true,
                Anchor = AnchorStyles.Bottom | AnchorStyles.Left
            };

            tableLayoutPanel.Controls.Add(cancelBtn, 1, 2);

            pictureBox.Padding = new Padding(0, 0, 0, 5);
            label.Text         = LocaleFactory.localizedString("Enter the name for the new file", "File");
            okButton.Text      = LocaleFactory.localizedString("Create", "File");

            // cancelButton is the 'Edit' button now
            cancelButton.DialogResult = DialogResult.Yes;
            cancelButton.Text         = LocaleFactory.localizedString("Edit", "File");

            CancelButton = cancelBtn;
        }
Exemple #16
0
 private static string FormatHelp(string help)
 {
     if (string.IsNullOrEmpty(help))
     {
         return(null);
     }
     return("<A HREF=\"" + help + "\">" + LocaleFactory.localizedString("Help", "Main") + "</A>");
 }
 public object GetChecksum(Path path)
 {
     return(!Checksum.NONE.equals(path.attributes().getChecksum())
         ? path.attributes().getChecksum().hash
         : Utils.IsNotBlank(path.attributes().getETag())
                           ? path.attributes().getETag()
                           : LocaleFactory.localizedString("None"));
 }
Exemple #18
0
 public override string getLongFormat(long millis, bool natural)
 {
     if (-1 == millis)
     {
         return(LocaleFactory.localizedString("Unknown"));
     }
     return(GetLongFormat(ConvertJavaMillisecondsToDateTime(millis)));
 }
Exemple #19
0
        public static bool PrepareExit()
        {
            bool readyToExit = true;

            foreach (BrowserController controller in new List <BrowserController>(Browsers))
            {
                if (controller.IsConnected())
                {
                    if (PreferencesFactory.get().getBoolean("browser.disconnect.confirm"))
                    {
                        controller.CommandBox(LocaleFactory.localizedString("Quit"),
                                              LocaleFactory.localizedString(
                                                  "You are connected to at least one remote site. Do you want to review open browsers?"),
                                              null,
                                              String.Format("{0}|{1}", LocaleFactory.localizedString("Review…"),
                                                            LocaleFactory.localizedString("Quit Anyway")), true,
                                              LocaleFactory.localizedString("Don't ask again", "Configuration"), TaskDialogIcon.Warning,
                                              delegate(int option, bool verificationChecked)
                        {
                            if (verificationChecked)
                            {
                                // Never show again.
                                PreferencesFactory.get().setProperty("browser.disconnect.confirm", false);
                            }
                            switch (option)
                            {
                            case -1:         // Cancel
                                             // Quit has been interrupted. Delete any saved sessions so far.
                                Application._sessions.clear();
                                readyToExit = false;
                                break;

                            case 0:         // Review
                                if (BrowserController.ApplicationShouldTerminate())
                                {
                                    break;
                                }
                                readyToExit = false;
                                break;

                            case 1:         // Quit
                                foreach (BrowserController c in
                                         new List <BrowserController>(Browsers))
                                {
                                    c.View.Dispose();
                                }
                                break;
                            }
                        });
                    }
                    else
                    {
                        controller.Unmount();
                    }
                }
            }
            return(readyToExit);
        }
Exemple #20
0
 private void View_ChangedPrivateKeyEvent(object sender, PrivateKeyArgs e)
 {
     _host.getCredentials()
     .setIdentity(null == e.KeyFile || e.KeyFile.Equals(LocaleFactory.localizedString("None"))
             ? null
             : LocalFactory.get(e.KeyFile));
     Update();
     ItemChanged();
 }
Exemple #21
0
        public bool alert(Host host, BackgroundException failure, StringBuilder log)
        {
            FailureDiagnostics.Type type = _diagnostics.determine(failure);
            if (type == FailureDiagnostics.Type.cancel)
            {
                return(false);
            }
            _notification.alert(host, failure, log);
            bool r = false;

            _controller.Invoke(delegate
            {
                string footer   = ProviderHelpServiceFactory.get().help(host.getProtocol());
                string title    = LocaleFactory.localizedString("Error");
                string message  = failure.getMessage() ?? LocaleFactory.localizedString("Unknown");
                string detail   = failure.getDetail() ?? LocaleFactory.localizedString("Unknown");
                string expanded = log.length() > 0 ? log.toString() : null;
                string commandButtons;
                if (type == FailureDiagnostics.Type.network)
                {
                    commandButtons = String.Format("{0}|{1}", LocaleFactory.localizedString("Try Again", "Alert"),
                                                   LocaleFactory.localizedString("Network Diagnostics", "Alert"));
                }
                else if (type == FailureDiagnostics.Type.quota)
                {
                    commandButtons = String.Format("{0}|{1}", LocaleFactory.localizedString("Try Again", "Alert"),
                                                   LocaleFactory.localizedString("Help", "Main"));
                }
                else
                {
                    commandButtons = String.Format("{0}", LocaleFactory.localizedString("Try Again", "Alert"));
                }
                _controller.WarningBox(title, message, detail, expanded, commandButtons, true, footer,
                                       delegate(int option, bool @checked)
                {
                    switch (option)
                    {
                    case 0:
                        r = true;
                        break;

                    case 1:
                        if (type == FailureDiagnostics.Type.network)
                        {
                            ReachabilityFactory.get().diagnose(host);
                        }
                        if (type == FailureDiagnostics.Type.quota)
                        {
                            BrowserLauncherFactory.get().open(new DefaultProviderHelpService().help(host.getProtocol()));
                        }
                        r = false;
                        break;
                    }
                });
            }, true);
            return(r);
        }
Exemple #22
0
        public GotoPromptForm()
        {
            InitializeComponent();

            Text = LocaleFactory.localizedString("Go to folder", "Goto");
            pictureBox.Padding = new Padding(0, 0, 0, 5);

            label.Text    = LocaleFactory.localizedString("Enter the pathname to list:", "Goto");
            okButton.Text = LocaleFactory.localizedString("Go", "Goto");
        }
 public ClickLinkLabel()
 {
     if (!DesignMode)
     {
         ContextMenuStrip contextMenu = new ContextMenuStrip();
         ToolStripItem    addItem     = contextMenu.Items.Add(LocaleFactory.localizedString("Copy URL", "Browser"));
         addItem.Click   += (sender, args) => Clipboard.SetText(Text);
         ContextMenuStrip = contextMenu;
     }
 }
        public DuplicateFilePromptForm()
        {
            InitializeComponent();

            Text = LocaleFactory.localizedString("Duplicate File", "Duplicate");

            pictureBox.Width  = 32;
            label.Text        = LocaleFactory.localizedString("Enter the name for the new file", "Duplicate");
            okButton.Text     = LocaleFactory.localizedString("Duplicate", "Duplicate");
            cancelButton.Text = LocaleFactory.localizedString("Cancel", "Duplicate");
        }
        protected TransferPromptController(WindowController parent, Transfer transfer, SessionPool source, SessionPool destination)
        {
            View        = ObjectFactory.GetInstance <ITransferPromptView>();
            _parent     = parent;
            Transfer    = transfer;
            Source      = source;
            Destination = destination;
            View.Title  = LocaleFactory.localizedString(TransferName);

            PopulateActions();
        }
Exemple #26
0
        private void View_OpenPrivateKeyBrowserEvent()
        {
            string selectedKeyFile = PreferencesFactory.get().getProperty("local.user.home");

            if (!LocaleFactory.localizedString("None").Equals(View.SelectedPrivateKey))
            {
                selectedKeyFile = Path.GetDirectoryName(View.SelectedPrivateKey);
            }
            View.PasswordEnabled = true;
            View.ShowPrivateKeyBrowser(selectedKeyFile);
        }
        public TransferPromptForm()
        {
            InitializeComponent();

            DoubleBuffered = true;
            MaximumSize    = new Size(MaxWidth, MaxHeight + detailsTableLayoutPanel.Height);
            MinimumSize    = new Size(MinWidth, MinHeight + detailsTableLayoutPanel.Height);

            browser.UseExplorerTheme        = true;
            browser.UseTranslucentSelection = true;
            browser.OwnerDraw             = true;
            browser.UseOverlays           = false;
            browser.HeaderStyle           = ColumnHeaderStyle.None;
            browser.ShowGroups            = false;
            browser.ShowImagesOnSubItems  = true;
            browser.TreeColumnRenderer    = new BrowserRenderer();
            browser.SelectedRowDecoration = new ExplorerRowBorderDecoration();
            browser.MultiSelect           = false;
            browser.FullRowSelect         = true;
            browser.ItemsChanged         += (sender, args) => ItemsChanged();

            //due to the checkbox feature the highlight bar is not being redrawn properly -> redraw the entire control instead
            //todo report this bug to the ObjectListView forum
            browser.SelectedIndexChanged += delegate
            {
                if (null != browser.SelectedItem)
                {
                    browser.Invalidate(browser.SelectedItem.Bounds);
                    if (null != _lastSelectedListViewItem)
                    {
                        browser.Invalidate(_lastSelectedListViewItem.Bounds);
                    }
                    _lastSelectedListViewItem = browser.SelectedItem;
                }
            };

            ScaledImageRenderer sir = new ScaledImageRenderer();

            treeColumnWarning.Renderer = sir;
            treeColumnCreate.Renderer  = sir;
            treeColumnSync.Renderer    = sir;

            treeColumnName.FillsFreeSpace = true;

            toggleDetailsLabel.Text        = String.Format("        {0}", LocaleFactory.localizedString("Details"));
            toggleDetailsLabel.Click      += delegate { ToggleDetailsEvent(); };
            toggleDetailsLabel.MouseDown  += delegate { toggleDetailsLabel.ImageIndex = (_expanded ? 2 : 5); };
            toggleDetailsLabel.MouseEnter += delegate { toggleDetailsLabel.ImageIndex = (_expanded ? 1 : 4); };
            toggleDetailsLabel.MouseLeave += delegate { toggleDetailsLabel.ImageIndex = (_expanded ? 0 : 3); };
            toggleDetailsLabel.MouseUp    += delegate { toggleDetailsLabel.ImageIndex = (_expanded ? 1 : 4); };

            browser.Focus();
        }
Exemple #28
0
 private string LookupInMultipleBundles(string toLocalize, string[] bundles)
 {
     foreach (string bundle in bundles)
     {
         string cand = LocaleFactory.localizedString(toLocalize, bundle);
         if (!toLocalize.Equals(cand))
         {
             return(cand);
         }
     }
     return(toLocalize);
 }
Exemple #29
0
        public void setup()
        {
            ContextMenuStrip  rightMenu  = new ContextMenuStrip();
            ToolStripMenuItem itemUpdate = new ToolStripMenuItem
            {
                Text = LocaleFactory.get().localize("Check for Update…", "Main")
            };
            PeriodicUpdateChecker updater = PeriodicUpdateCheckerFactory.get();

            itemUpdate.Enabled = updater.hasUpdatePrivileges();
            itemUpdate.Click  += delegate { updater.check(false); };
            ToolStripMenuItem itemDonate = new ToolStripMenuItem
            {
                Text = LocaleFactory.get().localize("Donate…", "Main")
            };

            itemDonate.Click +=
                delegate { BrowserLauncherFactory.get().open(PreferencesFactory.get().getProperty("website.donate")); };
            ToolStripMenuItem itemKey = new ToolStripMenuItem {
                Text = LicenseFactory.find().ToString(), Enabled = false
            };
            ToolStripMenuItem itemExit = new ToolStripMenuItem
            {
                Text = LocaleFactory.get().localize("Exit", "Localizable")
            };

            itemExit.Click += delegate { MainController.Exit(false); };
            rightMenu.Items.AddRange(new ToolStripItem[]
                                     { itemUpdate, new ToolStripSeparator(), itemDonate, itemKey, new ToolStripSeparator(), itemExit });

            try
            {
                _icon.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
            }
            catch (ArgumentException)
            {
            }
            _icon.Visible          = true;
            _icon.ContextMenuStrip = rightMenu;

            _icon.MouseClick += delegate(object sender, MouseEventArgs args)
            {
                if (args.Button == MouseButtons.Left)
                {
                    foreach (BrowserController browser in MainController.Browsers)
                    {
                        browser.View.Activate();
                        browser.View.BringToFront();
                    }
                }
            };
        }
 public override void chunk(Path parent, AttributedList list)
 {
     if (_supressed)
     {
         return;
     }
     try
     {
         base.chunk(parent, list);
     }
     catch (ListCanceledException e)
     {
         if (_controller.Visible)
         {
             AtomicBoolean c = new AtomicBoolean(true);
             AsyncController.AsyncDelegate d = delegate
             {
                 _controller.CommandBox(
                     string.Format(LocaleFactory.localizedString("Listing directory {0}", "Status"), string.Empty),
                     string.Format(LocaleFactory.localizedString("Listing directory {0}", "Status"), string.Empty),
                     string.Format(
                         LocaleFactory.localizedString("Continue listing directory with more than {0} files.",
                                                       "Alert"), e.getChunk().size()),
                     string.Format("{0}|{1}", LocaleFactory.localizedString("Continue", "Credentials"),
                                   LocaleFactory.localizedString("Cancel")), false, LocaleFactory.localizedString("Always"),
                     TaskDialogIcon.Warning, delegate(int option, bool verificationChecked)
                 {
                     if (option == 0)
                     {
                         _supressed = true;
                     }
                     if (option == 1)
                     {
                         c.SetValue(false);
                     }
                     if (verificationChecked)
                     {
                         _supressed = true;
                         disable();
                     }
                 });
             };
             _controller.Invoke(d, true);
             if (!c.Value)
             {
                 throw e;
             }
         }
     }
 }