fix navigation
authorYurii Zinchuk/Tizen Services & IoT (PLT) /SRPOL/Engineer/Samsung Electronics <y.zinchuk@samsung.com>
Mon, 26 Jun 2023 11:31:04 +0000 (13:31 +0200)
committerYurii Zinchuk/Tizen Services & IoT (PLT) /SRPOL/Engineer/Samsung Electronics <y.zinchuk@samsung.com>
Fri, 30 Jun 2023 09:56:54 +0000 (11:56 +0200)
SettingCore/GadgetNavigation.cs

index a38b1e730919c602a5937888c24b2e2173e6aeeb..0a6a4c8874c41f32c02f78e62d20d6f65bfbdc0b 100644 (file)
@@ -43,6 +43,7 @@ namespace SettingCore
                     NUIGadgetManager.Remove(gadget);
                     gadgetPages.Remove(e.Page);
                 }
+                NUIApplication.GetDefaultWindow().GetDefaultNavigator().EnableBackNavigation = true;
             };
 
             NUIApplication.GetDefaultWindow().KeyEvent += GadgetNavigation_KeyEvent;
@@ -219,14 +220,22 @@ namespace SettingCore
 
         private static void GadgetNavigation_KeyEvent(object sender, Window.KeyEventArgs e)
         {
-            if (e.Key.State == Key.StateType.Up)
+            if (NUIApplication.GetDefaultWindow().GetDefaultNavigator().ChildCount == 1)
             {
-                if (e.Key.KeyPressedName == "XF86Back")
-                {
-                    NUIApplication.GetDefaultWindow().GetDefaultNavigator().EnableBackNavigation = false;
-                    NavigateBack();
-                    NUIApplication.GetDefaultWindow().GetDefaultNavigator().EnableBackNavigation = true;
-                }
+                return;
+            }
+
+            if (e.Key.State == Key.StateType.Down && e.Key.KeyPressedName == "XF86Back")
+            {
+                NUIApplication.GetDefaultWindow().GetDefaultNavigator().EnableBackNavigation = false;
+            }
+            else if (e.Key.State == Key.StateType.Up && e.Key.KeyPressedName == "XF86Back")
+            {
+                NavigateBack();
+            }
+            else
+            {
+                NUIApplication.GetDefaultWindow().GetDefaultNavigator().EnableBackNavigation = true;
             }
         }
     }