diff --git a/SafeExamBrowser.UserInterface.Desktop/FileSystemDialog.xaml b/SafeExamBrowser.UserInterface.Desktop/FileSystemDialog.xaml
index 2875f176..13fad6cc 100644
--- a/SafeExamBrowser.UserInterface.Desktop/FileSystemDialog.xaml
+++ b/SafeExamBrowser.UserInterface.Desktop/FileSystemDialog.xaml
@@ -38,7 +38,7 @@
-
+
diff --git a/SafeExamBrowser.UserInterface.Desktop/FileSystemDialog.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/FileSystemDialog.xaml.cs
index d3d0f3d2..d4dba374 100644
--- a/SafeExamBrowser.UserInterface.Desktop/FileSystemDialog.xaml.cs
+++ b/SafeExamBrowser.UserInterface.Desktop/FileSystemDialog.xaml.cs
@@ -172,7 +172,7 @@ namespace SafeExamBrowser.UserInterface.Desktop
if (item.Tag is DirectoryInfo directory)
{
- FileSystem.Cursor = Cursors.Wait;
+ item.Cursor = Cursors.Wait;
item.BeginInit();
try
@@ -199,7 +199,7 @@ namespace SafeExamBrowser.UserInterface.Desktop
}
item.EndInit();
- FileSystem.Cursor = Cursors.Arrow;
+ item.Cursor = Cursors.Hand;
}
}
@@ -299,14 +299,13 @@ namespace SafeExamBrowser.UserInterface.Desktop
if (!string.IsNullOrEmpty(initialPath))
{
- var pathRoot = Path.GetPathRoot(initialPath);
- var directories = initialPath.Replace(pathRoot, "").Split(Path.DirectorySeparatorChar);
- var segments = new List();
+ var root = Path.GetPathRoot(initialPath);
+ var path = initialPath.Replace(root, "").Split(Path.DirectorySeparatorChar);
+ var segments = new List { root };
- segments.Add(pathRoot);
- segments.AddRange(directories);
+ segments.AddRange(path);
- AutoSelect(FileSystem.Items, segments);
+ SelectInitialPath(FileSystem.Items, segments);
if (element == FileSystemElement.File && operation == FileSystemOperation.Save)
{
@@ -315,7 +314,7 @@ namespace SafeExamBrowser.UserInterface.Desktop
}
}
- private void AutoSelect(ItemCollection items, List segments)
+ private void SelectInitialPath(ItemCollection items, List segments)
{
var segment = segments.FirstOrDefault();
@@ -329,7 +328,7 @@ namespace SafeExamBrowser.UserInterface.Desktop
i.IsSelected = true;
i.BringIntoView();
- AutoSelect(i.Items, segments.Skip(1).ToList());
+ SelectInitialPath(i.Items, segments.Skip(1).ToList());
break;
}
diff --git a/SafeExamBrowser.UserInterface.Mobile/FileSystemDialog.xaml b/SafeExamBrowser.UserInterface.Mobile/FileSystemDialog.xaml
new file mode 100644
index 00000000..fa5741db
--- /dev/null
+++ b/SafeExamBrowser.UserInterface.Mobile/FileSystemDialog.xaml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SafeExamBrowser.UserInterface.Mobile/FileSystemDialog.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/FileSystemDialog.xaml.cs
new file mode 100644
index 00000000..5c821567
--- /dev/null
+++ b/SafeExamBrowser.UserInterface.Mobile/FileSystemDialog.xaml.cs
@@ -0,0 +1,381 @@
+/*
+ * Copyright (c) 2020 ETH Zürich, Educational Development and Technology (LET)
+ *
+ * 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;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media;
+using FontAwesome.WPF;
+using SafeExamBrowser.I18n.Contracts;
+using SafeExamBrowser.UserInterface.Contracts.FileSystemDialog;
+using SafeExamBrowser.UserInterface.Contracts.Windows;
+using SafeExamBrowser.UserInterface.Shared.Utilities;
+
+namespace SafeExamBrowser.UserInterface.Mobile
+{
+ public partial class FileSystemDialog : Window, IFileSystemDialog
+ {
+ private FileSystemElement element;
+ private string initialPath;
+ private string message;
+ private FileSystemOperation operation;
+ private IText text;
+ private string title;
+
+ public FileSystemDialog(
+ FileSystemElement element,
+ string initialPath,
+ FileSystemOperation operation,
+ IText text,
+ string message = default(string),
+ string title = default(string))
+ {
+ this.element = element;
+ this.initialPath = initialPath;
+ this.message = message;
+ this.operation = operation;
+ this.text = text;
+ this.title = title;
+
+ InitializeComponent();
+ InitializeDialog();
+ }
+
+ public FileSystemDialogResult Show(IWindow parent = null)
+ {
+ return Dispatcher.Invoke(() =>
+ {
+ var result = new FileSystemDialogResult();
+
+ if (parent is Window)
+ {
+ Owner = parent as Window;
+ WindowStartupLocation = WindowStartupLocation.CenterOwner;
+ }
+
+ if (ShowDialog() == true)
+ {
+ result.FullPath = BuildFullPath();
+ result.Success = true;
+ }
+
+ return result;
+ });
+ }
+
+ private void CancelButton_Click(object sender, RoutedEventArgs e)
+ {
+ DialogResult = false;
+ Close();
+ }
+
+ private void FileSystem_Expanded(object sender, RoutedEventArgs e)
+ {
+ if (e.Source is TreeViewItem item && item.Items.Count == 1 && !(item.Items[0] is TreeViewItem))
+ {
+ Load(item);
+ }
+ }
+
+ private void FileSystem_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs