介绍
Silverlight 2.0 使用Thread, Timer, BackgroundWorker, ThreadPool来实现多线程开发
    Thread - 用于线程的创建和控制的类
    Timer - 用于以指定的时间间隔执行指定的方法的类
    BackgroundWorker - 用于在单独的线程上运行操作
    ThreadPool - 线程池的管理类


在线DEMO
http://www.cnblogs.com/webabcd/archive/2008/10/09/1307486.html


示例
1、Thread.xaml
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool<UserControl x:Class="Silverlight20.Thread.Thread"
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml">
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    
<StackPanel HorizontalAlignment="Left" Margin="5">
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool        
<TextBlock x:Name="txtMsg" />
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    
</StackPanel>
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
</UserControl>
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool

Thread.xaml.cs
2.0线程之Thread, Timer, BackgroundWorker, ThreadPoolusing System;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Collections.Generic;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Linq;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Net;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Controls;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Documents;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Input;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Media;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Media.Animation;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Shapes;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
namespace Silverlight20.Thread


2、Timer.xaml
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool<UserControl x:Class="Silverlight20.Thread.Timer"
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml">
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    
<StackPanel HorizontalAlignment="Left" Margin="5">
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool        
<TextBlock x:Name="txtMsg" />
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    
</StackPanel>
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
</UserControl>
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool

Timer.xaml.cs
2.0线程之Thread, Timer, BackgroundWorker, ThreadPoolusing System;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Collections.Generic;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Linq;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Net;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Controls;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Documents;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Input;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Media;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Media.Animation;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Shapes;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
namespace Silverlight20.Thread


3、BackgroundWorker.xaml
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool<UserControl x:Class="Silverlight20.Thread.BackgroundWorker"
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml">
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    
<StackPanel HorizontalAlignment="Left" Margin="5">
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool        
<StackPanel Orientation="Horizontal" Margin="5">
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool            
<Button x:Name="btnStart" Content="开始" Margin="5" Click="btnStart_Click" />
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool            
<Button x:Name="btnCancel" Content="取消" Margin="5" Click="btnCancel_Click" />
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool        
</StackPanel>
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool        
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool        
<StackPanel Margin="5">
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool            
<TextBlock x:Name="txtProgress" Margin="5" />
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool            
<TextBlock x:Name="txtMsg" Margin="5" />
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool        
</StackPanel>
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    
</StackPanel> 
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
</UserControl>
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool

BackgroundWorker.xaml.cs


4、ThreadPool.xaml
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool<UserControl x:Class="Silverlight20.Thread.ThreadPool"
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    xmlns
="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml">
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    
<StackPanel HorizontalAlignment="Left" Margin="5">
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool        
<TextBlock x:Name="txtMsgQueueUserWorkItem" Text="click here" MouseLeftButtonDown="txtMsgQueueUserWorkItem_MouseLeftButtonDown" Margin="30" />
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool        
<TextBlock x:Name="txtRegisterWaitForSingleObject" Text="click here" MouseLeftButtonDown="txtRegisterWaitForSingleObject_MouseLeftButtonDown" Margin="30" />
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool    
</StackPanel>
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
</UserControl>
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool

ThreadPool.xaml.cs
2.0线程之Thread, Timer, BackgroundWorker, ThreadPoolusing System;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Collections.Generic;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Linq;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Net;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Controls;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Documents;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Input;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Media;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Media.Animation;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
using System.Windows.Shapes;
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
2.0线程之Thread, Timer, BackgroundWorker, ThreadPool
namespace Silverlight20.Thread

相关文章:

  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-03
  • 2022-01-29
猜你喜欢
  • 2021-07-29
  • 2022-01-14
  • 2021-07-27
  • 2022-12-23
  • 2022-02-03
相关资源
相似解决方案