Compare commits
2 Commits
c6de7d19a1
...
620efc20b3
| Author | SHA1 | Date |
|---|---|---|
|
|
620efc20b3 | |
|
|
5423c5ec76 |
|
|
@ -1,4 +1,12 @@
|
|||
using System.Windows.Controls;
|
||||
using HeBianGu.Base.WpfBase;
|
||||
using HeBianGu.Control.Explorer;
|
||||
using HeBianGu.Service.Mvc;
|
||||
using HeBianGu.Window.Link;
|
||||
using Hopetry.Provider.Behaviors;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace HeBianGu.App.Disk.Send
|
||||
{
|
||||
|
|
@ -10,6 +18,42 @@ namespace HeBianGu.App.Disk.Send
|
|||
public SendControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Loaded += OnLoaded;
|
||||
}
|
||||
private async void OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 查找h:Explorer控件
|
||||
var box = FindVisualChild<ListBox>(this);
|
||||
var fream= FindVisualChild<LinkActionFrame>(this);
|
||||
|
||||
if (box != null &&fream!=null && this.DataContext is SendViewModel viewModel)
|
||||
{
|
||||
IActionResult result = await viewModel.SelectLink.GetActionResult();
|
||||
var uielement = result.View as UIElement;
|
||||
fream.Content = uielement;
|
||||
}
|
||||
}
|
||||
|
||||
// 辅助方法:在可视化树中查找指定类型的子元素
|
||||
private static T FindVisualChild<T>(DependencyObject parent) where T : DependencyObject
|
||||
{
|
||||
if (parent == null) return null;
|
||||
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(parent, i);
|
||||
if (child is T result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
var childResult = FindVisualChild<T>(child);
|
||||
if (childResult != null)
|
||||
{
|
||||
return childResult;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,9 +135,9 @@ namespace HeBianGu.App.Disk
|
|||
public ICommand DeleteFolderCommand { get; }
|
||||
|
||||
//public ICommand SelectItemsCommand { get; }
|
||||
public LoyoutViewModel()
|
||||
public LoyoutViewModel(SendViewModel sendViewModel)
|
||||
{
|
||||
//_sendViewModel = sendViewModel;
|
||||
_sendViewModel = sendViewModel;
|
||||
_uploadService = new FileUploadService();
|
||||
UploadCommand = new AsyncRelayCommand(async () => await UploadFile());
|
||||
UploadCommand1 = new AsyncRelayCommand(async () => await UploadFile1());
|
||||
|
|
@ -149,9 +149,9 @@ namespace HeBianGu.App.Disk
|
|||
// 初始化Timer
|
||||
_progressTimer = new Timer(1000);
|
||||
_progressTimer.Elapsed += UpdateProgress;
|
||||
//_sendViewModel.UpLoadItems.CollectionChanged += (s, e) => { _sendViewModel.UpdateUploadingItems(); };
|
||||
_sendViewModel.UpLoadItems.CollectionChanged += (s, e) => { _sendViewModel.UpdateUploadingItems(); };
|
||||
//加载上传完成列表
|
||||
//GetCompletedFiles();
|
||||
GetCompletedFiles();
|
||||
}
|
||||
|
||||
private async Task DoSelectDirCommand()
|
||||
|
|
|
|||
Loading…
Reference in New Issue