2020-01-22 15:16:11 +01:00
|
|
|
|
/*
|
2023-03-08 00:30:20 +01:00
|
|
|
|
* Copyright (c) 2023 ETH Zürich, Educational Development and Technology (LET)
|
2020-01-22 15:16:11 +01:00
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using SafeExamBrowser.I18n.Contracts;
|
|
|
|
|
using SafeExamBrowser.UserInterface.Contracts.FileSystemDialog;
|
|
|
|
|
using SafeExamBrowser.UserInterface.Contracts.Windows;
|
2020-03-16 18:29:06 +01:00
|
|
|
|
using SafeExamBrowser.UserInterface.Desktop.Windows;
|
2020-01-22 15:16:11 +01:00
|
|
|
|
|
|
|
|
|
namespace SafeExamBrowser.UserInterface.Desktop
|
|
|
|
|
{
|
|
|
|
|
public class FileSystemDialogFactory : IFileSystemDialog
|
|
|
|
|
{
|
|
|
|
|
private IText text;
|
|
|
|
|
|
|
|
|
|
public FileSystemDialogFactory(IText text)
|
|
|
|
|
{
|
|
|
|
|
this.text = text;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-05 22:55:38 +02:00
|
|
|
|
public FileSystemDialogResult Show(
|
|
|
|
|
FileSystemElement element,
|
|
|
|
|
FileSystemOperation operation,
|
|
|
|
|
string initialPath = default(string),
|
|
|
|
|
string message = null,
|
|
|
|
|
string title = null,
|
|
|
|
|
IWindow parent = null,
|
|
|
|
|
bool restrictNavigation = false)
|
2020-01-22 15:16:11 +01:00
|
|
|
|
{
|
2020-01-24 11:07:52 +01:00
|
|
|
|
if (parent is Window window)
|
2020-01-22 15:16:11 +01:00
|
|
|
|
{
|
2020-08-05 22:55:38 +02:00
|
|
|
|
return window.Dispatcher.Invoke(() => new FileSystemDialog(element, operation, text, initialPath, message, title, parent, restrictNavigation).Show());
|
2020-01-22 15:16:11 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-08-05 22:55:38 +02:00
|
|
|
|
return new FileSystemDialog(element, operation, text, initialPath, message, title, restrictNavigation: restrictNavigation).Show();
|
2020-01-22 15:16:11 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|