Skip to content

Commit

Permalink
Fix titlebar renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2776 committed Jan 25, 2025
1 parent 379f4d3 commit 3de04b6
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/PicView.Avalonia/Views/UC/EditableTitlebar.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,11 @@ private async Task HandleRename()
return;
}

if (!NavigationHelper.CanNavigate(vm))
if (vm.FileInfo is { Exists: false })
{
return;
}

if (vm.FileInfo is null)
{
return;
}
vm.IsLoading = true;
var oldPath = vm.FileInfo.FullName;
var newPath = Path.Combine(vm.FileInfo.DirectoryName, TextBox.Text);
Expand Down Expand Up @@ -194,8 +190,6 @@ private async Task HandleRename()

async Task End()
{
// vm.ImageIterator?.RemoveCurrentItemFromPreLoader();
// await NavigationHelper.LoadPicFromFile(newPath, vm).ConfigureAwait(false);
vm.IsLoading = false;
await Dispatcher.UIThread.InvokeAsync(() =>
{
Expand All @@ -205,6 +199,9 @@ await Dispatcher.UIThread.InvokeAsync(() =>
UIHelper.GetMainView.Focus();
});
vm.IsEditableTitlebarOpen = false;
vm.ImageIterator?.RefreshAllFileInfo();
vm.FileInfo = new FileInfo(newPath);
SetTitleHelper.RefreshTitle(vm);
}
}

Expand Down

0 comments on commit 3de04b6

Please sign in to comment.