Compare commits
2 Commits
837b035e5d
...
9b3c0b9cb6
| Author | SHA1 | Date |
|---|---|---|
|
|
9b3c0b9cb6 | |
|
|
8f0bba3703 |
|
|
@ -25,6 +25,7 @@ using System.Diagnostics;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Minio.DataModel.Select;
|
||||||
|
|
||||||
namespace Hopetry.Provider.Behaviors
|
namespace Hopetry.Provider.Behaviors
|
||||||
{
|
{
|
||||||
|
|
@ -42,6 +43,19 @@ namespace Hopetry.Provider.Behaviors
|
||||||
DependencyProperty.Register("UseMinIO", typeof(bool), typeof(ExplorerMinIOBehavior),
|
DependencyProperty.Register("UseMinIO", typeof(bool), typeof(ExplorerMinIOBehavior),
|
||||||
new PropertyMetadata(false, OnUseMinIOChanged));
|
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()
|
public IEnumerable<SystemInfoModel> GetSelectedItems()
|
||||||
{
|
{
|
||||||
|
|
@ -183,6 +197,8 @@ namespace Hopetry.Provider.Behaviors
|
||||||
// 只有当历史记录变更不是由导航触发时才标记为本地刷新
|
// 只有当历史记录变更不是由导航触发时才标记为本地刷新
|
||||||
_isLocalHistoryRefresh = true;
|
_isLocalHistoryRefresh = true;
|
||||||
}
|
}
|
||||||
|
//定义状态更新事件
|
||||||
|
public event EventHandler<string> StatusMessageChanged;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -218,6 +234,8 @@ namespace Hopetry.Provider.Behaviors
|
||||||
AssociatedObject.Cursor = System.Windows.Input.Cursors.Wait;
|
AssociatedObject.Cursor = System.Windows.Input.Cursors.Wait;
|
||||||
|
|
||||||
var items = await GetMinIOItemsAsync(path, searchText);
|
var items = await GetMinIOItemsAsync(path, searchText);
|
||||||
|
var filecount=items.Count();
|
||||||
|
StatusMessage = $"已全部加载,共 {filecount} 个文件";
|
||||||
AssociatedObject.ItemsSource = items.ToObservable();
|
AssociatedObject.ItemsSource = items.ToObservable();
|
||||||
|
|
||||||
//var items = await GetMinIOItemsAsync(path);
|
//var items = await GetMinIOItemsAsync(path);
|
||||||
|
|
@ -397,6 +415,12 @@ namespace Hopetry.Provider.Behaviors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//// 更新文件数量 $"已加载 {fileCount} 个文件"
|
||||||
|
//private void UpdateFileCount(string message)
|
||||||
|
//{
|
||||||
|
// _viewModel.UpdateStatus(message);
|
||||||
|
//}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 图标处理
|
#region 图标处理
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@
|
||||||
<!--<Button h:Cattach.Icon="" Content="分享" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />-->
|
<!--<Button h:Cattach.Icon="" Content="分享" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />-->
|
||||||
<Button h:Cattach.Icon="" Command="{Binding DeleteFolderCommand}" Content="删除" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
|
<Button h:Cattach.Icon="" Command="{Binding DeleteFolderCommand}" Content="删除" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
|
||||||
<Button h:Cattach.Icon="" Command="{Binding CreateFolderCommand}" Content="新建文件夹" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
|
<Button h:Cattach.Icon="" 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="" Content="离线下载" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />-->
|
<!--<Button h:Cattach.Icon="" Content="离线下载" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />-->
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
|
@ -49,7 +51,7 @@
|
||||||
LoadAnimationType="Opactiy"
|
LoadAnimationType="Opactiy"
|
||||||
Split="0.02"
|
Split="0.02"
|
||||||
StartValue="0" />-->
|
StartValue="0" />-->
|
||||||
<behaviors:ExplorerMinIOBehavior UseMinIO="True" RootDisplayName="全部文件" />
|
<behaviors:ExplorerMinIOBehavior UseMinIO="True" RootDisplayName="全部文件" StatusMessage="{Binding StatusMessage, Mode=OneWayToSource}" />
|
||||||
<behaviors:MinIOSearchBehavior/>
|
<behaviors:MinIOSearchBehavior/>
|
||||||
</h:Interaction.Behaviors>
|
</h:Interaction.Behaviors>
|
||||||
|
|
||||||
|
|
@ -62,7 +64,7 @@
|
||||||
<DataGridTemplateColumn.HeaderTemplate>
|
<DataGridTemplateColumn.HeaderTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<!--<CheckBox Foreground="{Binding RelativeSource={RelativeSource AncestorType=DataGridColumnHeader}, Path=Foreground}"-->
|
<!--<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>
|
</DataTemplate>
|
||||||
</DataGridTemplateColumn.HeaderTemplate>
|
</DataGridTemplateColumn.HeaderTemplate>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,26 @@ namespace HeBianGu.App.Disk
|
||||||
|
|
||||||
#region 文件上传
|
#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 参数定义
|
#region 参数定义
|
||||||
|
|
||||||
private SendViewModel _sendViewModel;
|
private SendViewModel _sendViewModel;
|
||||||
|
|
@ -122,6 +142,8 @@ namespace HeBianGu.App.Disk
|
||||||
private ExplorerMinIOBehavior _explorerBehavior;
|
private ExplorerMinIOBehavior _explorerBehavior;
|
||||||
private MinIOSearchBehavior _minioBehavior;
|
private MinIOSearchBehavior _minioBehavior;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ICommand UploadCommand { get; }
|
public ICommand UploadCommand { get; }
|
||||||
public ICommand UploadCommand1 { get; }
|
public ICommand UploadCommand1 { get; }
|
||||||
public ICommand CreateFolderCommand { get; }
|
public ICommand CreateFolderCommand { get; }
|
||||||
|
|
@ -596,6 +618,7 @@ namespace HeBianGu.App.Disk
|
||||||
{
|
{
|
||||||
SelectedItems.Add(item);
|
SelectedItems.Add(item);
|
||||||
}
|
}
|
||||||
|
UpdateStatus($"已选中{SelectedItems.Count} 个文件/文件夹");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DeleteSelectedItemsAsync()
|
private async Task DeleteSelectedItemsAsync()
|
||||||
|
|
|
||||||
|
|
@ -571,13 +571,20 @@ namespace HeBianGu.App.Disk
|
||||||
ServerCertificateCustomValidationCallback = (msg, cert, chain, errors) => true
|
ServerCertificateCustomValidationCallback = (msg, cert, chain, errors) => true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//var handler =
|
||||||
|
// new HttpClientHandler
|
||||||
|
// {
|
||||||
|
// // 保持 MinIO 必需的 SSL 配置
|
||||||
|
// ServerCertificateCustomValidationCallback = (msg, cert, chain, errors) => true
|
||||||
|
// };
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 从配置获取MinIO设置更安全
|
// 从配置获取MinIO设置更安全
|
||||||
IMinioClient client = new MinioClient()
|
IMinioClient client = new MinioClient()
|
||||||
.WithEndpoint(config["Minio:Endpoint"])
|
.WithEndpoint(config["Minio:Endpoint"])
|
||||||
.WithCredentials(config["Minio:AccessKey"], config["Minio:SecretKey"])
|
.WithCredentials(config["Minio:AccessKey"], config["Minio:SecretKey"])
|
||||||
.WithHttpClient(new HttpClient(handler) { Timeout = Timeout.InfiniteTimeSpan })
|
//.WithHttpClient(new HttpClient(handler) { Timeout = Timeout.InfiniteTimeSpan })
|
||||||
.Build();
|
.Build();
|
||||||
string bucketName = GetCurrentBucket();
|
string bucketName = GetCurrentBucket();
|
||||||
// 确保桶存在
|
// 确保桶存在
|
||||||
|
|
|
||||||
47
global.json
47
global.json
|
|
@ -6,22 +6,45 @@
|
||||||
// "BucketName": "drone"
|
// "BucketName": "drone"
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
{
|
|
||||||
"Minio": {
|
|
||||||
"Endpoint": "192.168.10.163:9016",
|
|
||||||
"AccessKey": "I2c35jD6ayApaneyQZyC",
|
|
||||||
"SecretKey": "XHlrNeCHK0xf8y2Fo0K5OKyDeaI2ItfEsFbzQPFk",
|
|
||||||
"BucketName": "demo",
|
|
||||||
"limitspeed": 1048576
|
|
||||||
}
|
|
||||||
//{
|
//{
|
||||||
// "Minio": {
|
// "Minio": {
|
||||||
// "Endpoint": "192.168.20.239:9106",
|
// "Endpoint": "192.168.10.163:9016",
|
||||||
// "AccessKey": "minioadmin",
|
// "AccessKey": "I2c35jD6ayApaneyQZyC",
|
||||||
// "SecretKey": "hopetry@minio",
|
// "SecretKey": "XHlrNeCHK0xf8y2Fo0K5OKyDeaI2ItfEsFbzQPFk",
|
||||||
// "BucketName": "dev",
|
// "BucketName": "demo",
|
||||||
// "limitspeed": 1048576
|
// "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": {
|
//"Minio": {
|
||||||
// "Endpoint": "nas.continue.fun:10044",
|
// "Endpoint": "nas.continue.fun:10044",
|
||||||
// "AccessKey": "xilonp6jAjBIf0DTaLfY",
|
// "AccessKey": "xilonp6jAjBIf0DTaLfY",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue