-
-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix #14197
- Loading branch information
Showing
139 changed files
with
1,144 additions
and
442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
core/native/refresh/src/main/csharp/Interactivity/DialogPromptShareeCallback.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using ch.cyberduck.core; | ||
using ch.cyberduck.core.exception; | ||
using ch.cyberduck.core.features; | ||
using ch.cyberduck.core.threading; | ||
using Ch.Cyberduck.Core.Refresh.Splat; | ||
using Ch.Cyberduck.Core.Refresh.ViewModels.Dialogs; | ||
using java.util; | ||
using Splat; | ||
using System.Windows; | ||
|
||
namespace Ch.Cyberduck.Core.Refresh.Interactivity; | ||
|
||
public class DialogPromptShareeCallback : Share.ShareeCallback | ||
{ | ||
private readonly Controller controller; | ||
private readonly Host host; | ||
private readonly nint parent; | ||
|
||
public DialogPromptShareeCallback(Host host, nint parent, Controller controller) | ||
{ | ||
( | ||
this.controller, | ||
this.host, | ||
this.parent) = (controller, host, parent); | ||
} | ||
|
||
public Share.Sharee prompt(Share.Type type, Set sharees) | ||
{ | ||
var viewModel = new PromptShareeViewModel(host.getProtocol(), sharees); | ||
var action = new PromptShareeAction(viewModel, parent); | ||
controller.invoke(action, true); | ||
if (action.Result != true) | ||
{ | ||
throw new ConnectionCanceledException(); | ||
} | ||
|
||
return viewModel.SelectedSharee; | ||
} | ||
|
||
private class PromptShareeAction : DefaultMainAction | ||
{ | ||
private readonly nint parent; | ||
private readonly PromptShareeViewModel viewModel; | ||
|
||
public bool? Result { get; private set; } | ||
|
||
public PromptShareeAction(PromptShareeViewModel viewModel, nint parent) | ||
{ | ||
this.parent = parent; | ||
this.viewModel = viewModel; | ||
} | ||
|
||
public override void run() | ||
{ | ||
var factory = Locator.Current.GetService<IWindowFactory<PromptShareeViewModel>>(); | ||
var window = factory.Create(viewModel); | ||
Result = window.ShowWithOwnerDialog(parent); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System.Windows; | ||
|
||
namespace Ch.Cyberduck.Core.Refresh.Splat; | ||
|
||
public interface IWindowFactory<TViewModel> where TViewModel : class | ||
{ | ||
Window Create(TViewModel model); | ||
} |
12 changes: 12 additions & 0 deletions
12
core/native/refresh/src/main/csharp/System/Collections/DictionaryExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace System.Collections | ||
{ | ||
public static class DictionaryExtensions | ||
{ | ||
public static TValue Lookup<TValue, TKey>(this IDictionary<TKey, TValue> dictionary, TKey key) | ||
{ | ||
return dictionary[key]; | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
core/native/refresh/src/main/csharp/System/Windows/WindowExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Windows.Interop; | ||
|
||
namespace System.Windows; | ||
|
||
public static class WindowExtensions | ||
{ | ||
public static bool? ShowWithOwnerDialog(this Window window, in nint? owner) | ||
{ | ||
if (owner is nint ownerLocal) | ||
{ | ||
_ = new WindowInteropHelper(window) | ||
{ | ||
Owner = ownerLocal | ||
}; | ||
window.WindowStartupLocation = WindowStartupLocation.CenterOwner; | ||
} | ||
|
||
return window.ShowDialog(); | ||
} | ||
} |
Oops, something went wrong.