完善弹窗设置下载路径逻辑
parent
4d2950fc5c
commit
cd358509df
2
App.xaml
2
App.xaml
|
|
@ -35,7 +35,7 @@
|
|||
</StackPanel>
|
||||
</h:Row>
|
||||
<h:Row>
|
||||
<CheckBox Content="设为默认路径"/>
|
||||
<CheckBox Content="设为默认路径" IsChecked="{Binding IsSelect}"/>
|
||||
</h:Row>
|
||||
<Grid
|
||||
HorizontalAlignment="Right"
|
||||
|
|
|
|||
|
|
@ -590,16 +590,17 @@ namespace HeBianGu.App.Disk
|
|||
{
|
||||
// todo 当为文件时,处理
|
||||
var tempSelectedItems = new ObservableCollection<SystemInfoModel>(SelectedItems);
|
||||
SelectedItems.Clear();
|
||||
if (tempSelectedItems.Count > 0)
|
||||
{
|
||||
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 =>
|
||||
{
|
||||
x.Width = 800;
|
||||
x.Width = 600;
|
||||
x.Height = 450;
|
||||
//x.Padding = new System.Windows.Thickness(10);
|
||||
//x.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
|
||||
|
|
@ -607,14 +608,32 @@ namespace HeBianGu.App.Disk
|
|||
}, ObjectContentDialog.ClearKey);
|
||||
if (r)
|
||||
{
|
||||
// todo 开始下载
|
||||
var downDir = DownFolderSelect.DownFolder;
|
||||
if (DownFolderSelect.IsSelect)
|
||||
{
|
||||
// todo 持久化配置
|
||||
}
|
||||
SelectedItems.Clear();
|
||||
_explorerBehavior.RefreshMinIOPath(CurrentMinIOPath);
|
||||
AddTaskToDownLoad(tempSelectedItems, downDir);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
|
||||
ViewModelLocator.DownViewModel.AddTask(temp.BucketName, objectKey, temp.Size, downDir);
|
||||
MessageProxy.Snacker.Show($"{temp.Name} 加入下载队列");
|
||||
}
|
||||
|
||||
|
|
@ -625,12 +644,6 @@ namespace HeBianGu.App.Disk
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await MessageProxy.Messager.ShowResult("至少选择一项");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
using var client = SqlSugarConfig.GetSqlSugarScope();
|
||||
client.Insertable(task).ExecuteCommandIdentityIntoEntity();
|
||||
|
|
|
|||
Loading…
Reference in New Issue