Skip to content

Commit

Permalink
Improve Copy/Move UI ainotes-team#52
Browse files Browse the repository at this point in the history
  • Loading branch information
HDhotdog committed Nov 18, 2022
1 parent 071d115 commit fc12d90
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions AINotes/Controls/FileManagement/CustomFileGridView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using AINotesCloud;
using AINotesCloud.Models;
using MaterialComponents;
using Microsoft.IdentityModel.Tokens;
using Colors = Windows.UI.Colors;

namespace AINotes.Controls.FileManagement {
Expand Down Expand Up @@ -487,12 +488,13 @@ private async void OpenCopyMovePopup(FileModel fileModel) {
Height = 500,
Mode = FileGridMode.List,
};
directoryList.ModelCollection.AddRange(await FileHelper.ListDirectoriesAsync(currentDirectory.DirectoryId));
var subDirs = await FileHelper.ListDirectoriesAsync(currentDirectory.DirectoryId);
directoryList.ModelCollection.AddRange(subDirs);

MDButton moveButton = null;
moveButton = new MDButton {
ButtonStyle = MDButtonStyle.Primary,
Text = ResourceHelper.GetString("move"),
Text = ResourceHelper.GetString("copy_move"),
Command = async () => {
var directoryId = (directoryList.SelectedModels.FirstOrDefault(m => m is DirectoryModel) as DirectoryModel)?.DirectoryId;
if (!(directoryId is { } pId)) {
Expand Down Expand Up @@ -537,6 +539,11 @@ await FileHelper.CreateComponentAsync(new ComponentModel {
MDPopup.CloseCurrentPopup();
},
};

if (subDirs.IsNullOrEmpty()) {
moveButton.IsEnabled = false;
copyButton.IsEnabled = false;
}

var popup = new MDContentPopup(ResourceHelper.GetString("copy_move"), new Frame {
Background = Configuration.Theme.Background,
Expand Down

0 comments on commit fc12d90

Please sign in to comment.