WPF多线程 后台加载 前台一个Loading动画 怎么才能不让动画加载的时候卡
小慧哥 2010-11-15 04:54:05 我做一个加载功能 一个动画Loading效果 在后台用线成加载窗体 但是加载的时候 前台动画就卡住了 不动了 加载完 才动 来一个大神HELP 一下 就类似 开机动画效果 程序什么时候加载完 动画什么时候消失! 不要假的!!!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Interop;
using SYST_Products;
using System.Threading;
using System.Windows.Forms;
using System.Windows.Threading;
namespace WpfApplication6
{
/// <summary>
/// Window1.xaml 的交互逻辑
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
public delegate void AddButtonDelegate(Object uiobject);
private void Window1_Loaded(object sender, RoutedEventArgs e)
{
Thread thread = new Thread( AddButton );
thread.IsBackground = true;
thread.Start();
}
这个方法 加载的时候很卡 把动画卡住了
public void DoAddButton(Object uiobject)
{
Introduction gsjj = new Introduction(0, this);
gsjj.Width = SystemParameters.PrimaryScreenWidth;
gsjj.Height = SystemParameters.PrimaryScreenHeight;
this.UserContrlGD.Children.Add(gsjj);
this.zv.Visibility = Visibility.Collapsed;
}
public void AddButton(Object UIObject)
{
this.UserContrlGD.Dispatcher.BeginInvoke(new ParameterizedThreadStart(DoAddButton), DispatcherPriority.ContextIdle, UIObject);
}
前台就一个动画
}
}