完善弹窗设置下载路径逻辑
parent
4d2950fc5c
commit
cd358509df
2
App.xaml
2
App.xaml
|
|
@ -35,7 +35,7 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</h:Row>
|
</h:Row>
|
||||||
<h:Row>
|
<h:Row>
|
||||||
<CheckBox Content="设为默认路径"/>
|
<CheckBox Content="设为默认路径" IsChecked="{Binding IsSelect}"/>
|
||||||
</h:Row>
|
</h:Row>
|
||||||
<Grid
|
<Grid
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
|
|
|
||||||
|
|
@ -590,16 +590,17 @@ namespace HeBianGu.App.Disk
|
||||||
{
|
{
|
||||||
// todo 当为文件时,处理
|
// todo 当为文件时,处理
|
||||||
var tempSelectedItems = new ObservableCollection<SystemInfoModel>(SelectedItems);
|
var tempSelectedItems = new ObservableCollection<SystemInfoModel>(SelectedItems);
|
||||||
SelectedItems.Clear();
|
|
||||||
if (tempSelectedItems.Count > 0)
|
if (tempSelectedItems.Count > 0)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(DownFolderSelect.DownFolder))
|
if (string.IsNullOrEmpty(DownFolderSelect.DownFolder))
|
||||||
{
|
{
|
||||||
DownFolderSelect.DownFolder = "d:/abc";
|
// 如果是空,则把同步目录拿过来使用
|
||||||
|
DownFolderSelect.DownFolder = ViewModelLocator.SyncViewModel.SyncDir;
|
||||||
}
|
}
|
||||||
|
// todo 假如设置了默认下载目录,开启下载
|
||||||
bool r = await MessageProxy.Presenter.Show(DownFolderSelect, x => true, "下载目录选择", x =>
|
bool r = await MessageProxy.Presenter.Show(DownFolderSelect, x => true, "下载目录选择", x =>
|
||||||
{
|
{
|
||||||
x.Width = 800;
|
x.Width = 600;
|
||||||
x.Height = 450;
|
x.Height = 450;
|
||||||
//x.Padding = new System.Windows.Thickness(10);
|
//x.Padding = new System.Windows.Thickness(10);
|
||||||
//x.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
|
//x.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
|
||||||
|
|
@ -607,28 +608,40 @@ namespace HeBianGu.App.Disk
|
||||||
}, ObjectContentDialog.ClearKey);
|
}, ObjectContentDialog.ClearKey);
|
||||||
if (r)
|
if (r)
|
||||||
{
|
{
|
||||||
// todo 开始下载
|
var downDir = DownFolderSelect.DownFolder;
|
||||||
foreach (var item in tempSelectedItems)
|
if (DownFolderSelect.IsSelect)
|
||||||
{
|
{
|
||||||
if (item is MinIOFileModel file)
|
// todo 持久化配置
|
||||||
{
|
|
||||||
var temp = (MinIOFileInfo)file.Model;
|
|
||||||
var objectKey = temp.FullName.Replace(temp.BucketName + "/", "");
|
|
||||||
ViewModelLocator.DownViewModel.AddTask(temp.BucketName, objectKey, temp.Size);
|
|
||||||
MessageProxy.Snacker.Show($"{temp.Name} 加入下载队列");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item is MinIODirectoryModel dir)
|
|
||||||
{
|
|
||||||
Console.WriteLine("建设中...");
|
|
||||||
//return ((MinIODirectoryInfo)dir.Model).BucketName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
SelectedItems.Clear();
|
||||||
|
_explorerBehavior.RefreshMinIOPath(CurrentMinIOPath);
|
||||||
|
AddTaskToDownLoad(tempSelectedItems, downDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await MessageProxy.Messager.ShowResult("至少选择一项");
|
await MessageProxy.Messager.ShowResult("至少选择一项");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddTaskToDownLoad(ObservableCollection<SystemInfoModel> tempSelectedItems, string downDir)
|
||||||
|
{
|
||||||
|
foreach (var item in tempSelectedItems)
|
||||||
|
{
|
||||||
|
if (item is MinIOFileModel file)
|
||||||
|
{
|
||||||
|
var temp = (MinIOFileInfo)file.Model;
|
||||||
|
var objectKey = temp.FullName.Replace(temp.BucketName + "/", "");
|
||||||
|
|
||||||
|
ViewModelLocator.DownViewModel.AddTask(temp.BucketName, objectKey, temp.Size, downDir);
|
||||||
|
MessageProxy.Snacker.Show($"{temp.Name} 加入下载队列");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item is MinIODirectoryModel dir)
|
||||||
|
{
|
||||||
|
Console.WriteLine("建设中...");
|
||||||
|
//return ((MinIODirectoryInfo)dir.Model).BucketName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -250,9 +250,8 @@ public class DownViewModel : MvcViewModelBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTask(string bucketName, string objectKey, string size)
|
public void AddTask(string bucketName, string objectKey, string size,string downDir)
|
||||||
{
|
{
|
||||||
var downDir = ViewModelLocator.SyncViewModel.SyncDir;
|
|
||||||
var task = new MinioDownloadTask(_minioService, bucketName, objectKey, downDir, size);
|
var task = new MinioDownloadTask(_minioService, bucketName, objectKey, downDir, size);
|
||||||
using var client = SqlSugarConfig.GetSqlSugarScope();
|
using var client = SqlSugarConfig.GetSqlSugarScope();
|
||||||
client.Insertable(task).ExecuteCommandIdentityIntoEntity();
|
client.Insertable(task).ExecuteCommandIdentityIntoEntity();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue