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 void AwaitBackgroundAction(CountDownLatch signal, Host bookmark, string title, string message, Icon icon) { IActiveTaskDialog taskDialog = default; CancellationTokenSource cancelToken = new CancellationTokenSource(); Task task = Wrap(signal, cancelToken.Token).ContinueWith(_ => { taskDialog.ClickButton((int)TaskDialogSimpleResult.Ok); }); var result = TaskDialog.TaskDialog.Show(allowDialogCancellation: true, customMainIcon: icon, commonButtons: TaskDialogCommonButtons.Cancel, content: message, mainInstruction: title, title: BookmarkNameProvider.toString(bookmark), showMarqueeProgressBar: true, callback: (d, a, o) => { switch (a.Notification) { case TaskDialogNotification.DialogConstructed: taskDialog = d; d.SetProgressBarMarquee(true, 0); break; case TaskDialogNotification.ButtonClicked: return(false); } return(true); }); cancelToken.Cancel(); if (result.Result == TaskDialogSimpleResult.Cancel) { throw new ConnectionCanceledException(); } }
private void RefreshJumpList() { InitJumpList(); try { Iterator iterator = HistoryCollection.defaultCollection().iterator(); _jumpListManager.ClearAllUserTasks(); while (iterator.hasNext()) { Host host = (Host)iterator.next(); var file = BookmarkCollection.defaultCollection().getFile(host); if (file.exists()) { bookmarkCategory.AddJumpListItems(new JumpListLink(file.getAbsolute(), BookmarkNameProvider.toString(host)) { IconReference = new IconReference(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "cyberduck-application.ico"), 0), }); } } _jumpListManager.Refresh(); } catch (Exception exception) { Logger.warn("Exception while refreshing jump list", exception); } }
protected virtual void Update() { View.WindowTitle = BookmarkNameProvider.toString(_host); View.Hostname = _host.getHostname(); View.HostFieldEnabled = _host.getProtocol().isHostnameConfigurable(); View.Nickname = BookmarkNameProvider.toString(_host); View.DownloadFolder = new DownloadDirectoryFinder().find(_host).getAbsolute(); View.URL = new HostUrlProvider(true, true).get(_host); View.Port = _host.getPort().ToString(); View.PortFieldEnabled = _host.getProtocol().isPortConfigurable(); View.PathFieldEnabled = _host.getProtocol().isPathConfigurable(); View.Path = _host.getDefaultPath(); View.Username = _host.getCredentials().getUsername(); View.UsernameEnabled = _options.user() && !_host.getCredentials().isAnonymousLogin(); View.UsernameLabel = $"{_host.getProtocol().getUsernamePlaceholder()}:"; View.Password = _host.getCredentials().getPassword(); View.PasswordLabel = $"{_options.getPasswordPlaceholder()}:"; View.PasswordEnabled = _options.password() && !_host.getCredentials().isAnonymousLogin(); View.AnonymousEnabled = _options.anonymous(); View.AnonymousChecked = _host.getCredentials().isAnonymousLogin(); View.SelectedProtocol = _host.getProtocol(); View.SelectedTransferMode = _host.getTransferType(); View.SelectedEncoding = _host.getEncoding() == null ? Default : _host.getEncoding(); View.EncodingFieldEnabled = _host.getProtocol().isEncodingConfigurable(); View.ConnectModeFieldEnabled = _host.getProtocol().getType() == Protocol.Type.ftp; View.SelectedConnectMode = _host.getFTPConnectMode(); View.PrivateKeyFieldEnabled = _options.publickey(); if (_host.getCredentials().isPublicKeyAuthentication()) { String key = _host.getCredentials().getIdentity().getAbsolute(); if (!_keys.Contains(key)) { _keys.Add(key); View.PopulatePrivateKeys(_keys); } View.SelectedPrivateKey = key; } else { View.SelectedPrivateKey = LocaleFactory.localizedString("None"); } View.ClientCertificateFieldEnabled = _options.certificate(); List <string> keys = new List <string> { LocaleFactory.localizedString("None") }; if (_options.certificate()) { foreach (String certificate in SystemCertificateStore.ListAliases()) { keys.Add(certificate); } } View.PopulateClientCertificates(keys); if (_host.getCredentials().isCertificateAuthentication()) { View.SelectedClientCertificate = _host.getCredentials().getCertificate(); } else { View.SelectedClientCertificate = LocaleFactory.localizedString("None"); } View.WebUrlButtonToolTip = new WebUrlProvider(_host).toUrl().getUrl(); View.WebURL = _host.getWebURL(); View.Notes = _host.getComment(); View.TimezoneFieldEnabled = !_host.getProtocol().isUTCTimezone(); if (null == _host.getTimezone()) { if (_host.getProtocol().isUTCTimezone()) { View.SelectedTimezone = UTC.getID(); } else { View.SelectedTimezone = TimeZone.getTimeZone(PreferencesFactory.get().getProperty("ftp.timezone.default")).getID(); } } else { View.SelectedTimezone = _host.getTimezone().getID(); } }
public object GetNickname(object host) { return(BookmarkNameProvider.toString(((Host)host))); }