Browse Source

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

BDisp 4 năm trước cách đây
mục cha
commit
fc4796cc61
1 tập tin đã thay đổi với 9 bổ sung1 xóa
  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);
 		}
 	}