浏览代码

Preventing the Progress Bar view to continuous pulsing after quit the Scrolling scenario.

BDisp 4 年之前
父节点
当前提交
fc4796cc61
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      UICatalog/Scenarios/Scrolling.cs

+ 9 - 1
UICatalog/Scenarios/Scrolling.cs

@@ -284,13 +284,21 @@ namespace UICatalog {
 			progress.X = Pos.Right (scrollView) + 1;
 			progress.Y = Pos.AnchorEnd (2);
 			progress.Width = 50;
+			bool pulsing = true;
 			bool timer (MainLoop caller)
 			{
 				progress.Pulse ();
-				return true;
+				return pulsing;
 			}
 			Application.MainLoop.AddTimeout (TimeSpan.FromMilliseconds (300), timer);
 
+			void Top_Unloaded ()
+			{
+				pulsing = false;
+				Top.Unloaded -= Top_Unloaded;
+			}
+			Top.Unloaded += Top_Unloaded;
+
 			Win.Add (scrollView, scrollView2, scrollView3, mousePos, progress);
 		}
 	}