private void View_ChangedSelectionEvent() { if (View.SelectedItem != null) { TransferItem selected = View.SelectedItem; if (null != selected) { if (null != selected.local) { View.LocalFileUrl = selected.local.getAbsolute(); if (selected.local.attributes().getSize() == -1) { View.LocalFileSize = UnknownString; } else { View.LocalFileSize = SizeFormatterFactory.get().format(selected.local.attributes().getSize()); } if (selected.local.attributes().getModificationDate() == -1) { View.LocalFileModificationDate = UnknownString; } else { View.LocalFileModificationDate = UserDateFormatterFactory.get().getLongFormat(selected.local.attributes().getModificationDate()); } } View.RemoteFileUrl = new DefaultUrlProvider(Transfer.getSource()).toUrl(selected.remote) .find(DescriptiveUrl.Type.provider) .getUrl(); TransferStatus status = TransferPromptModel.GetStatus(selected); if (status.getRemote().getSize() == -1) { View.RemoteFileSize = UnknownString; } else { View.RemoteFileSize = SizeFormatterFactory.get().format(status.getRemote().getSize()); } if (status.getRemote().getModificationDate() == -1) { View.RemoteFileModificationDate = UnknownString; } else { View.RemoteFileModificationDate = UserDateFormatterFactory.get().getLongFormat(status.getRemote().getModificationDate()); } } else { View.LocalFileUrl = String.Empty; View.LocalFileSize = String.Empty; View.LocalFileModificationDate = String.Empty; } } }
private void PopulateBandwidthList() { IList <KeyValuePair <int, string> > list = new List <KeyValuePair <int, string> >(); list.Add(new KeyValuePair <int, string>(BandwidthThrottle.UNLIMITED, LocaleFactory.localizedString("Unlimited Bandwidth", "Preferences"))); foreach (String option in _preferences.getProperty("queue.bandwidth.options") .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { list.Add(new KeyValuePair <int, string>(Convert.ToInt32(option.Trim()), (SizeFormatterFactory.get(true).format(Convert.ToInt32(option.Trim())) + "/s"))); } View.PopulateBandwidthList(list); }
public string GetSizeAsString(object size) { return(SizeFormatterFactory.get().format((long)size)); }