Removed an unnecessary log.
This commit is contained in:
@@ -11,6 +11,8 @@ namespace Progrart.Pages;
|
||||
|
||||
public partial class EditorPage : UserControl, ITabPage, IEditorPage
|
||||
{
|
||||
IStorageFile? file = null;
|
||||
TabButton? btn = null;
|
||||
public EditorPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -18,7 +20,12 @@ public partial class EditorPage : UserControl, ITabPage, IEditorPage
|
||||
|
||||
public void BindButton(TabButton button)
|
||||
{
|
||||
btn = button;
|
||||
button.Title = "Editor Page";
|
||||
if (file is not null)
|
||||
{
|
||||
btn.Title = file.Name;
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
@@ -32,6 +39,11 @@ public partial class EditorPage : UserControl, ITabPage, IEditorPage
|
||||
|
||||
public void LoadDocument(IStorageFile file)
|
||||
{
|
||||
this.file = file;
|
||||
if (btn is not null)
|
||||
{
|
||||
btn.Title = file.Name;
|
||||
}
|
||||
Task.Run(async () =>
|
||||
{
|
||||
using var stream = await file.OpenReadAsync();
|
||||
|
||||
@@ -70,7 +70,6 @@ public partial class MainView : UserControl
|
||||
|
||||
if (topLevel == null) return;
|
||||
|
||||
// Open the folder picker
|
||||
var folders = await topLevel.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions
|
||||
{
|
||||
Title = "Select Folder",
|
||||
@@ -79,16 +78,10 @@ public partial class MainView : UserControl
|
||||
|
||||
if (folders.Count >= 1)
|
||||
{
|
||||
// Get the first selected folder path
|
||||
// Note: TryGetLocalPath() returns null if the file isn't on a local disk (e.g., cloud storage)
|
||||
FileContainer.Children.Clear();
|
||||
var folderPath = folders[0].TryGetLocalPath();
|
||||
var folder = folders[0];
|
||||
FileContainer.Children.Add(new FileItem(folder));
|
||||
if (folderPath != null)
|
||||
{
|
||||
// Do something with the path
|
||||
System.Diagnostics.Debug.WriteLine($"Picked: {folderPath}");
|
||||
}
|
||||
}
|
||||
};
|
||||
LeftPanelToggle.IsChecked = true;
|
||||
|
||||
Reference in New Issue
Block a user