-
-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port WinForms TransferForm to WPF #15912
Conversation
@@ -106,5 +121,24 @@ public bool TryGetIcon<T>(object Key, int size, out T image, string classifier = | |||
public ReaderWriterLockSlimExtensions.UpgradeableReadLock UpgradeableReadLock() => writer.UseUpgradeableReadLock(); | |||
|
|||
public ReaderWriterLockSlimExtensions.WriteLock WriteLock() => writer.UseWriteLock(); | |||
|
|||
private static void OnCacheEvict(CacheEntryRemovedArguments arguments) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used to temporarily store extracted file icons (which will be garbage collected once not used in cache anymore).
{ | ||
public partial class IconProvider<T> | ||
{ | ||
public T GetPath(Path path, int size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from WinFormsIconProvider to base - previously used in ProgressController.
@@ -105,17 +105,21 @@ public T GetApplication(Application application, int size) | |||
public T GetFileIcon(string filename, bool isFolder, bool large, bool isExecutable) | |||
{ | |||
string key = string.Empty; | |||
string fileInfo = filename; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed logic here to be able to extract local file icons correctly, and not pollute the cache with wrong information.
e.g. calling GetFileIcon("C:\A\B.exe") would pollute cache key "ext:exe" to forever use that icon.
protected override BitmapSource Overlay(BitmapSource baseImage, BitmapSource overlay, int size) | ||
{ | ||
DrawingVisual visual = new(); | ||
using (var context = visual.RenderOpen()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately required.
{ | ||
public delegate TResult ObservableTransform<TSource, TResult>(TSource obj, TResult? cached); | ||
|
||
public static IObservable<IChangeSet<TResult>> ToObservableChangeSet<TSource, TResult>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create Observable from ch.cyberduck.core.Collection
Basically allows watching for collectionX-notifications
@@ -848,7 +856,7 @@ private void InitializeTransfers() | |||
_bc.Invoke(() => | |||
{ | |||
transfersSemaphore.Wait(); | |||
TransferController.Instance.View.Show(); | |||
TransferController.Instance.ShowWindow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
View is lazily created if required. Use instance method which handles everything (including dispatching to WPF secondary thread).
throw new LoginCanceledException(); | ||
} | ||
}); | ||
var result = UiUtils.Show( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IWindowController doesn't have CommandBox.
Use readily available Utils-helper methods.
_preferences.setProperty("queue.transcript.size.height", View.TranscriptHeight); | ||
if (wait) | ||
{ | ||
MainController.Application.SynchronizationContext.Send( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to not get bitten by not-supported UI display scaling when opening prompts from the Transfer-window thread which has DPI display scaling enabled, schedule everything from background actions to WinForms main thread.
windows/src/main/csharp/ch/cyberduck/ui/controller/TransferController.cs
Outdated
Show resolved
Hide resolved
windows/src/main/csharp/ch/cyberduck/ui/core/TaskbarApplicationBadgeLabeler.cs
Outdated
Show resolved
Hide resolved
Apply Fant scaling
ConverterParameter is passed as string
Resolves #15885