问题描述
每次查询时Loading动画都会和页面一起卡死下面是代码弄了两天了,没找到解决办法,求大神们给个方案!privatevoidHandleVisibleChanged(objectsender,DependencyPropertyChangedEventArgse){boolisVisible=(bool)e.NewValue;if(isVisible){Threadt=newThread(newThreadStart(BeinAngle));t.Start();}//Start();elseStop();}publicdelegatevoiddelegate1();//定义委托privatevoidBeinAngle(){while(true){SpinnerRotate.Dispatcher.BeginInvoke(DispatcherPriority.Normal,newAction(()=>{SpinnerRotate.Angle=(SpinnerRotate.Angle+36)%360;}));Dispatcher.BeginInvoke(DispatcherPriority.Normal,newdelegate1(Angle));Thread.Sleep(50);}}
时间: 2024-10-25 19:54:44