试图让这个例子从http://www.munna.shatkotha.com/blog/post/2008/10/26/Light-box-effect-with-WPF.aspx
但是,我似乎无法为下面的“进程”找到正确的名称空间或语法。
<Border x:Name="panelDialog" Visibility="Collapsed">
<Grid>
<Border Background="Black" Opacity="0.49"></Border>
<!--While Xmal Content of the dialog will go here-->
</Grid>
</Border>
博文接着说......
只需将两个函数用于隐藏和显示对话框。总代码如下。在下面的代码中,我显示了一个带有灯箱效果的加载屏幕。显示模式对话框时,只需调用显示和隐藏等待屏幕方法。将您的 cpu 扩展作业发送到后台线程并在后台线程中使用调度程序更新 UI 是很好的。
<Page x:Class="Home">
<Grid>
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<!--All the contents will go here-->
</ScrollViewer>
<Border x:Name="panelLoading" Visibility="Collapsed">
<Grid>
<Border Background="Black" Opacity="0.49"></Border>
<local:TMEWaitScreen></local:TMEWaitScreen>
</Grid>
</Border>
</Grid>
</Page>
这是代码隐藏
#region About Wait Screen
/// <summary>
/// Show wait screen before a web request
/// </summary>
public void ShowWaitScreen()
{
Process del = new Process(ShowWaitScreenUI);
Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, del);
}
private void ShowWaitScreenUI()
{
panelLoading.Visibility = Visibility.Visible;
}
/// <summary>
/// Hide a wait screen after a web request
/// </summary>
public void HideWaitScreen()
{
Process del = new Process(HideWaitScreenUI);
Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, del);
}
private void HideWaitScreenUI()
{
panelLoading.Visibility = Visibility.Collapsed;
}
#endregion
我对这行特别有疑问:
Process del = new Process(ShowWaitScreenUI);
我能找到的唯一进程是在 System.Diagnostics 中,并且不带任何参数。是我想从中学习的博客文章,还是我只是在错误的地方?