void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 13 "..\..\MainWindow.xaml" ((Test.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.temperature = ((TemperatureGuage.TemperatureGuageControl)(target)); return; case 3: this.circleBar = ((CircleProcessBar.CircularProcessBarControl)(target)); return; case 4: this.loading = ((LoadingCircle.LoadingCircleControl)(target)); return; } this._contentLoaded = true; }
private void Window_Loaded(object sender, RoutedEventArgs e) { ThreadPool.QueueUserWorkItem(x => { while (true) { Thread.Sleep(2000); this.Dispatcher.Invoke((Action)(() => { TemperatureGuage.TemperatureGuageControl control = this.temperatureGrid.Children[r.Next(0, 3)] as TemperatureGuageControl; if (control != null) { control.CurrentValue = r.NextDouble() * (control.MaxValue - control.MinHeight); } CircleProcessBar.CircularProcessBarControl control1 = this.processBarGrid.Children[r.Next(0, 3)] as CircularProcessBarControl; if (control1 != null) { control1.SuccessRate = r.Next(0, 101); } })); } }); }