// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // 2011-11-27 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ using System.Threading; using System.Windows; using hdc.blk; using hdc.ob; namespace QueuedProperties { public partial class MainWindow : Window { ParallelBLOCK PB; public MainWindow() { // Requeridas por en Runtime de M&P TBW BUIThread.Dispatcher = Dispatcher; BLK.ResetStartSuscribers(); InitializeComponent(); // Instancia el custom BLOCK PB = new ParallelBLOCK(); // Pone referencia en el BUS BUS.AddObject("PB", PB); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private void bThread1_Click(object sender, RoutedEventArgs e) { Thread t = new Thread( new ParameterizedThreadStart(aaa)); t.Start(null); } private void bThread2_Click(object sender, RoutedEventArgs e) { Thread t = new Thread( new ParameterizedThreadStart(bbb)); t.Start(null); } void aaa(object o) { for (int i = 0; i < 10000; i++) { // Asigna a la Queued Property PropI PB.PropI = i; Thread.Sleep(5); } } void bbb(object o) { for (int i = 0; i < 10000; i++) { // Asigna a la Queued Property PropS PB.PropS = "Hello ! - " + i; Thread.Sleep(10); } } private void Loaded1(object sender, RoutedEventArgs e) { // Requerida por en Runtime de M&P TBW BLK.Start(); } /////////////////////////////////////////// } }