From 33e01dae053a3d424299e6229041e2e8ff2a0523 Mon Sep 17 00:00:00 2001 From: Poker Date: Wed, 16 Nov 2022 14:52:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=B3=E6=97=B6=E4=BF=9D=E5=AD=98=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TagsTree/Views/FilePropertiesPage.xaml.cs | 5 +- TagsTree/Views/SettingsPage.xaml | 18 ++---- TagsTree/Views/SettingsPage.xaml.cs | 76 +++++++++++++---------- 3 files changed, 51 insertions(+), 48 deletions(-) diff --git a/TagsTree/Views/FilePropertiesPage.xaml.cs b/TagsTree/Views/FilePropertiesPage.xaml.cs index 6c65d2c..47fbe89 100644 --- a/TagsTree/Views/FilePropertiesPage.xaml.cs +++ b/TagsTree/Views/FilePropertiesPage.xaml.cs @@ -6,10 +6,10 @@ using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Media.Animation; using Microsoft.UI.Xaml.Navigation; -using Microsoft.VisualBasic.FileIO; using TagsTree.Services; using TagsTree.Services.ExtensionMethods; using TagsTree.ViewModels; +using System.IO; namespace TagsTree.Views; @@ -45,7 +45,7 @@ private async void RenameBClick(object sender, RoutedEventArgs e) } var newFullName = FileViewModel.Path + @"\" + cd.Text; - if (FileViewModel.IsFolder ? FileSystem.DirectoryExists(newFullName) : FileSystem.FileExists(newFullName)) + if (FileViewModel.IsFolder ? Directory.Exists(newFullName) : File.Exists(newFullName)) { var isFolder = FileViewModel.IsFolder ? "夹" : ""; return $"新文件{isFolder}名与目录中其他文件{isFolder}同名!"; @@ -58,6 +58,7 @@ private async void RenameBClick(object sender, RoutedEventArgs e) var newFullName = FileViewModel.Path + @"\" + InputName.Text; FileViewModel.FileModel.Rename(newFullName); FileViewModel.MoveOrRenameAndSave(newFullName); + // 相当于对FileViewModel的所有属性OnPropertyChanged OnPropertyChanged(nameof(FileViewModel)); } private async void MoveBClick(object sender, RoutedEventArgs e) diff --git a/TagsTree/Views/SettingsPage.xaml b/TagsTree/Views/SettingsPage.xaml index 863f8a7..300f90d 100644 --- a/TagsTree/Views/SettingsPage.xaml +++ b/TagsTree/Views/SettingsPage.xaml @@ -7,19 +7,18 @@ xmlns:local="using:TagsTree.Views" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:root="using:TagsTree" - xmlns:ui="using:CommunityToolkit.WinUI.UI.Controls" Background="Transparent" NavigationCacheMode="Required" mc:Ignorable="d"> - + - + 0 @@ -49,7 +48,7 @@ IsClickEnabled="True" Tapped="BLibraryPath_Click"> - + @@ -58,13 +57,13 @@ Description="将所在路径文件夹名作为标签使用" Header="文件夹标签" HeaderIcon="Tag"> - + - + - -