瀏覽代碼

Refactor gestures tab in IntegrationTestApp.

Steven Kirk 3 年之前
父節點
當前提交
c733950aff
共有 2 個文件被更改,包括 42 次插入13 次删除
  1. 9 4
      samples/IntegrationTestApp/MainWindow.axaml
  2. 33 9
      samples/IntegrationTestApp/MainWindow.axaml.cs

+ 9 - 4
samples/IntegrationTestApp/MainWindow.axaml

@@ -72,12 +72,17 @@
       <TabItem Header="Gestures">
         <DockPanel>
           <DockPanel DockPanel.Dock="Top">
-            <Button Name="ClearLastGesture" DockPanel.Dock="Right">Clear</Button>
+            <Button Name="ResetGestures" DockPanel.Dock="Right">Reset</Button>
             <TextBlock Name="LastGesture" />
           </DockPanel>
-          <Border Name="GestureBorder" Background="Blue" 
-                  AutomationProperties.AccessibilityView="Content"
-                  AutomationProperties.ControlTypeOverride="Image"/>
+          <Panel>
+            <Border Name="GestureBorder" Background="Blue"
+                    AutomationProperties.AccessibilityView="Content"
+                    AutomationProperties.ControlTypeOverride="Image"/>
+            <Border Name="GestureBorder2" Background="Green" IsVisible="False"
+                    AutomationProperties.AccessibilityView="Content"
+                    AutomationProperties.ControlTypeOverride="Image"/>
+          </Panel>
         </DockPanel>
       </TabItem>
 

+ 33 - 9
samples/IntegrationTestApp/MainWindow.axaml.cs

@@ -18,18 +18,10 @@ namespace IntegrationTestApp
         {
             InitializeComponent();
             InitializeViewMenu();
+            InitializeGesturesTab();
             this.AttachDevTools();
             AddHandler(Button.ClickEvent, OnButtonClick);
             ListBoxItems = Enumerable.Range(0, 100).Select(x => "Item " + x).ToList();
-            
-            var gestureBorder = this.GetControl<Border>("GestureBorder");
-            var lastGesture = this.GetControl<TextBlock>("LastGesture");
-            var clearLastGesture = this.GetControl<Button>("ClearLastGesture");
-            gestureBorder.Tapped += (s, e) => lastGesture.Text = "Tapped";
-            gestureBorder.DoubleTapped += (s, e) => lastGesture.Text = "DoubleTapped";
-            Gestures.AddRightTappedHandler(gestureBorder, (s, e) => lastGesture.Text = "RightTapped");
-            clearLastGesture.Click += (s, e) => lastGesture.Text = string.Empty;
-            
             DataContext = this;
         }
 
@@ -130,6 +122,38 @@ namespace IntegrationTestApp
             }
         }
 
+        private void InitializeGesturesTab()
+        {
+            var gestureBorder = this.GetControl<Border>("GestureBorder");
+            var gestureBorder2 = this.GetControl<Border>("GestureBorder2");
+            var lastGesture = this.GetControl<TextBlock>("LastGesture");
+            var resetGestures = this.GetControl<Button>("ResetGestures");
+            gestureBorder.Tapped += (s, e) => lastGesture.Text = "Tapped";
+            
+            gestureBorder.DoubleTapped += (s, e) =>
+            {
+                lastGesture.Text = "DoubleTapped";
+
+                // Testing #8733
+                gestureBorder.IsVisible = false;
+                gestureBorder2.IsVisible = true;
+            };
+
+            gestureBorder2.DoubleTapped += (s, e) =>
+            {
+                lastGesture.Text = "DoubleTapped2";
+            };
+
+            Gestures.AddRightTappedHandler(gestureBorder, (s, e) => lastGesture.Text = "RightTapped");
+            
+            resetGestures.Click += (s, e) =>
+            {
+                lastGesture.Text = string.Empty;
+                gestureBorder.IsVisible = true;
+                gestureBorder2.IsVisible = false;
+            };
+        }
+
         private void MenuClicked(object? sender, RoutedEventArgs e)
         {
             var clickedMenuItemTextBlock = this.Get<TextBlock>("ClickedMenuItem");