我正在开发一个只运行多个后台进程,无用户交互的UI;只是直观地显示进程正在做什么。逻辑/用户界面层次结构为:
+ one Shell UI, with list view of (many):
\---+ BackgroundProcess container(s), each of which is composed of:
\---+ a. Info about FIRST Half of BackgroundProcess instance, namely:
| \---+ Current State
| \---+ ErrorInLogFile?
| \---+ ProgressBar
\---+ b. Info about SECOND Half of BackgroundProcess instance, namely:
\---+ Current State
\---+ ErrorInLogFile?
\---+ ProgressBar
关注我有一个用户控件列表这一事实,每个用户控件都由两个用户控件组成。我的问题是对Current State
的更新,isErrorInLogFile
和Progress
未显示,对我来说,不知何故我构建我的xaml的方式不足以让Caliburn激活第二级用户 - 控件。
文件FullAppCard
中的后台进程容器名为FullAppCard.xaml
,具有以下ViewModel类签名:
public class FullAppCardViewModel : PropertyChangedBase { ... }
//FullAppCard.xaml:
<UserControl x:Class="DocuFaxbackUI.Views.FullAppCardView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:DocuFaxbackUI.Views"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
...
</Grid.RowDefinitions>
<local:AppCardView x:Name="Part1" />
<local:AppCardView x:Name="Part2" />
</Grid>
</UserControl>
和AppCardView
,与整个过程的第一个和第二个“半”有关:
public class AppCardViewModel : PropertyChangedBase { ... }
<UserControl x:Class="DocuFaxbackUI.Views.AppCardView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d">
<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
...
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
...
</Grid.RowDefinitions>
<TextBlock Name="Status"/>
<Label Name="Error" cal:Message.Attach="[Event MouseUp] = [Action OpenLogFile];"/>
<ProgressBar Value="{Binding Path=CurrentProgress}" Maximum="{Binding Path=MaximumProgress}" />
</Grid>
</UserControl>
执行FullAppCardViewModel列表的ShellViewModel
继承自Conductor<PropertyChangedBase>.Collection.AllActive
。尽管有这样的设置,似乎我仍然无法在AppCardView
中进行更改以注册ShellViewModel
级别的UI编组线程。