Compare commits

...

2 Commits

Author SHA1 Message Date
洁 任 9b3c0b9cb6 Merge branch 'dev2.0' of http://123.132.248.154:10000/chenwei/FieldWorkClient into dev2.0 2025-07-04 16:39:39 +08:00
洁 任 8f0bba3703 添加文件夹数量显示 2025-07-04 16:39:35 +08:00
6 changed files with 94 additions and 15 deletions

View File

@ -25,6 +25,7 @@ using System.Diagnostics;
using System.Windows.Input;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using System.Reflection;
using Minio.DataModel.Select;
namespace Hopetry.Provider.Behaviors
{
@ -42,6 +43,19 @@ namespace Hopetry.Provider.Behaviors
DependencyProperty.Register("UseMinIO", typeof(bool), typeof(ExplorerMinIOBehavior),
new PropertyMetadata(false, OnUseMinIOChanged));
public static readonly DependencyProperty StatusMessageProperty =
DependencyProperty.Register(
"StatusMessage",
typeof(string),
typeof(ExplorerMinIOBehavior),
new PropertyMetadata(null));
public string StatusMessage
{
get => (string)GetValue(StatusMessageProperty);
set => SetValue(StatusMessageProperty, value);
}
//获取当前选中的文件
public IEnumerable<SystemInfoModel> GetSelectedItems()
{
@ -183,6 +197,8 @@ namespace Hopetry.Provider.Behaviors
// 只有当历史记录变更不是由导航触发时才标记为本地刷新
_isLocalHistoryRefresh = true;
}
//定义状态更新事件
public event EventHandler<string> StatusMessageChanged;
#endregion
@ -218,6 +234,8 @@ namespace Hopetry.Provider.Behaviors
AssociatedObject.Cursor = System.Windows.Input.Cursors.Wait;
var items = await GetMinIOItemsAsync(path, searchText);
var filecount=items.Count();
StatusMessage = $"已全部加载,共 {filecount} 个文件";
AssociatedObject.ItemsSource = items.ToObservable();
//var items = await GetMinIOItemsAsync(path);
@ -397,6 +415,12 @@ namespace Hopetry.Provider.Behaviors
}
}
//// 更新文件数量 $"已加载 {fileCount} 个文件"
//private void UpdateFileCount(string message)
//{
// _viewModel.UpdateStatus(message);
//}
#endregion
#region 图标处理

View File

@ -31,6 +31,8 @@
<!--<Button h:Cattach.Icon="&#xe763;" Content="分享" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />-->
<Button h:Cattach.Icon="&#xe643;" Command="{Binding DeleteFolderCommand}" Content="删除" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
<Button h:Cattach.Icon="&#xe688;" Command="{Binding CreateFolderCommand}" Content="新建文件夹" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
<TextBlock Text="{Binding StatusMessage}" DockPanel.Dock="Right" VerticalAlignment="Center"
Margin="200,0,0,0" Width="150" />
<!--<Button h:Cattach.Icon="&#xe84f;" Content="离线下载" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />-->
</StackPanel>
@ -49,7 +51,7 @@
LoadAnimationType="Opactiy"
Split="0.02"
StartValue="0" />-->
<behaviors:ExplorerMinIOBehavior UseMinIO="True" RootDisplayName="全部文件" />
<behaviors:ExplorerMinIOBehavior UseMinIO="True" RootDisplayName="全部文件" StatusMessage="{Binding StatusMessage, Mode=OneWayToSource}" />
<behaviors:MinIOSearchBehavior/>
</h:Interaction.Behaviors>
@ -62,7 +64,7 @@
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<!--<CheckBox Foreground="{Binding RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}, Path=Foreground}"-->
<!--Command="{Binding DataContext.SelectAllCommand,RelativeSource={RelativeSource AncestorType=DataGrid}}"/>-->
<!--Command="{Binding DataContext.SelectAllCommand,RelativeSource={RelativeSource AncestorType=DataGrid}}"/>-->
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>

View File

@ -111,6 +111,26 @@ namespace HeBianGu.App.Disk
#region 文件上传
#region 网盘空间文件数量更新
private string _statusMessage;
public string StatusMessage
{
get { return _statusMessage; }
set
{
_statusMessage = value;
RaisePropertyChanged("StatusMessage");
}
}
// 添加状态更新方法
public void UpdateStatus(string message)
{
StatusMessage = message;
}
#endregion
#region 参数定义
private SendViewModel _sendViewModel;
@ -122,6 +142,8 @@ namespace HeBianGu.App.Disk
private ExplorerMinIOBehavior _explorerBehavior;
private MinIOSearchBehavior _minioBehavior;
public ICommand UploadCommand { get; }
public ICommand UploadCommand1 { get; }
public ICommand CreateFolderCommand { get; }
@ -596,6 +618,7 @@ namespace HeBianGu.App.Disk
{
SelectedItems.Add(item);
}
UpdateStatus($"已选中{SelectedItems.Count} 个文件/文件夹");
}
private async Task DeleteSelectedItemsAsync()

View File

@ -571,13 +571,20 @@ namespace HeBianGu.App.Disk
ServerCertificateCustomValidationCallback = (msg, cert, chain, errors) => true
});
//var handler =
// new HttpClientHandler
// {
// // 保持 MinIO 必需的 SSL 配置
// ServerCertificateCustomValidationCallback = (msg, cert, chain, errors) => true
// };
try
{
// 从配置获取MinIO设置更安全
IMinioClient client = new MinioClient()
.WithEndpoint(config["Minio:Endpoint"])
.WithCredentials(config["Minio:AccessKey"], config["Minio:SecretKey"])
.WithHttpClient(new HttpClient(handler) { Timeout = Timeout.InfiniteTimeSpan })
//.WithHttpClient(new HttpClient(handler) { Timeout = Timeout.InfiniteTimeSpan })
.Build();
string bucketName = GetCurrentBucket();
// 确保桶存在

View File

@ -6,22 +6,45 @@
// "BucketName": "drone"
// }
//}
{
"Minio": {
"Endpoint": "192.168.10.163:9016",
"AccessKey": "I2c35jD6ayApaneyQZyC",
"SecretKey": "XHlrNeCHK0xf8y2Fo0K5OKyDeaI2ItfEsFbzQPFk",
"BucketName": "demo",
"limitspeed": 1048576
}
//{
// "Minio": {
// "Endpoint": "192.168.20.239:9106",
// "AccessKey": "minioadmin",
// "SecretKey": "hopetry@minio",
// "BucketName": "dev",
// "Endpoint": "192.168.10.163:9016",
// "AccessKey": "I2c35jD6ayApaneyQZyC",
// "SecretKey": "XHlrNeCHK0xf8y2Fo0K5OKyDeaI2ItfEsFbzQPFk",
// "BucketName": "demo",
// "limitspeed": 1048576
// }
{
"Minio": {
"Endpoint": "box.wisestcity.com:9106",
//"Endpoint": "39.76.171.205:9106",
"AccessKey": "minioadmin",
"SecretKey": "hopetry@minio",
"BucketName": "drone"
//"limitspeed": 1048576
}
//"Minio": {
// "Endpoint": "box.wisestcity.com:9106",
// "AccessKey": "V5QWBmTY3YNTiBDmLTjK",
// "SecretKey": "z92lrsD0uNdkYM5OPgnTrAQuVsLPIDXfIskTAGp8",
// "BucketName": "drone"
//}
//"Minio": {
// //"Endpoint": "box.wisestcity.com:9106",
// "Endpoint": "39.76.171.205:9000",
// "AccessKey": "minioadmin",
// "SecretKey": "minioadmin",
// "BucketName": "drone"
// //"limitspeed": 1048576
//}
//{
//"Minio": {
// "Endpoint": "175.27.168.120:9000",
// "AccessKey": "minioadmin",
// "SecretKey": "minioadmin",
// "BucketName": "dev",
// "limitspeed": 1048576
//}
//"Minio": {
// "Endpoint": "nas.continue.fun:10044",
// "AccessKey": "xilonp6jAjBIf0DTaLfY",

BIN
minio.db

Binary file not shown.