添加上传

dev
洁 任 2025-03-20 13:33:32 +08:00
parent f5a1cb731e
commit 332932938c
4 changed files with 48 additions and 4 deletions

View File

@ -23,7 +23,7 @@
StartValue="1000" />
</h:Interaction.Behaviors>
<Button h:Cattach.Icon="&#xe892;" Content="上传" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
<Button h:Cattach.Icon="&#xe892;" Command="{Binding UploadCommand}" Content="上传" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
<Button h:Cattach.Icon="&#xe891;" Content="下载" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
<Button h:Cattach.Icon="&#xe763;" Content="分享" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />
<Button h:Cattach.Icon="&#xe643;" Content="删除" Style="{DynamicResource {x:Static h:ButtonKeys.Dynamic}}" />

View File

@ -10,6 +10,7 @@ namespace HeBianGu.App.Disk
public ExplorerControl()
{
InitializeComponent();
this.DataContext = new LoyoutViewModel();
}
}
}

View File

@ -1,8 +1,10 @@
using HeBianGu.Base.WpfBase;
using HeBianGu.Service.Mvc;
using Microsoft.Win32;
using System;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
namespace HeBianGu.App.Disk
@ -83,6 +85,50 @@ namespace HeBianGu.App.Disk
}
#region 文件上传
private ICommand _uploadCommand;
public ICommand UploadCommand
{
get
{
return _uploadCommand ?? (_uploadCommand = new RelayCommand(UploadFile));
}
}
private void UploadFile(object obj)
{
//// 打开文件选择对话框
//OpenFileDialog openFileDialog = new OpenFileDialog();
//openFileDialog.Filter = "All Files (*.*)|*.*"; // 设置文件过滤器
//openFileDialog.Multiselect = false; // 单文件上传
//if (openFileDialog.ShowDialog() == true)
//{
// string filePath = openFileDialog.FileName;
// string fileName = Path.GetFileName(filePath);
// try
// {
// // 模拟文件上传逻辑
// // 这里可以替换为实际的上传逻辑,例如调用 API 或保存到指定目录
// string destinationPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), fileName);
// File.Copy(filePath, destinationPath, overwrite: true);
// // 更新上传时间
// UploadTime = DateTime.Now;
// // 提示上传成功
// MessageBox.Show($"文件 {fileName} 上传成功!", "上传完成", MessageBoxButton.OK, MessageBoxImage.Information);
// }
// catch (Exception ex)
// {
// // 处理上传失败
// MessageBox.Show($"文件上传失败: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
// }
//}
}
#endregion
}
internal class DataFileViewModel : ObservableSourceViewModel<TestViewModel>

View File

@ -1,7 +1,4 @@
{
"sdk": {
"version": "8.0.407"
},
"Minio": {
"Endpoint": "192.168.10.141:9000",
"AccessKey": "kr4Lr0v01uXVDP08PDUn",