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