Skip to content

Commit

Permalink
DYN-5656-PackagesGuide-BugFix (#14849)
Browse files Browse the repository at this point in the history
When opening the Packages tour and later opening the PackageManager (during the tour) at closing was removing the wrong dark background, then I added some code for searching for the specific overlay added  (not the one added by the guided tour).
Also deleted the code for using the EnableEnvironment function due that  is not used any more.
  • Loading branch information
RobertGlobant20 authored Jan 17, 2024
1 parent 685057f commit 61a4f7d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
10 changes: 0 additions & 10 deletions src/DynamoCoreWpf/UI/GuidedTour/GuidesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,22 +262,13 @@ internal void ExitTour()

dynamoViewModel.OnEnableShortcutBarItems(true);

EnableDynamoUI();

//Hide guide background overlay
guideBackgroundElement.Visibility = Visibility.Hidden;
GuidesValidationMethods.CurrentExecutingGuide = null;
tourStarted = false;
}
}

private void EnableDynamoUI()
{
var dynamoView = mainRootElement as DynamoView;
if (dynamoView != null)
dynamoView.EnableEnvironment(true);
}

/// <summary>
/// Creates the exit modal when close button is pressed
/// </summary>
Expand Down Expand Up @@ -306,7 +297,6 @@ private void ContinueTourButton_Click(object sender, RoutedEventArgs e)
private void ExitTourButton_Click(object sender, RoutedEventArgs e)
{
exitGuideWindow.IsOpen = false;
EnableDynamoUI();
GuideFlowEvents.OnGuidedTourExited(currentGuide.Name);
ExitTour();
}
Expand Down
7 changes: 0 additions & 7 deletions src/DynamoCoreWpf/UI/GuidedTour/GuidesValidationMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,6 @@ private static void ClosePackageManager(PackageManagerView packageManager)
packageManager.PackageManagerViewModel.Width = PMDefaultWidth;
packageManager.PackageManagerViewModel.Height = PMDefaultHeight;
packageManagerViewModel.PropertyChanged -= searchPackagesPropertyChanged.Invoke;

//Enable the DynamoView.mainGrid so the user will be able to interact with Dynamo
var dynamoView = packageManager.Owner as DynamoView;
if (dynamoView != null)
{
dynamoView.EnableEnvironment(true);
}
packageManager.Close();

}
Expand Down
10 changes: 3 additions & 7 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2316,11 +2316,6 @@ private void HandlePackageManagerWindowClosed(object sender, EventArgs e)
cmd.Dispose();
}

internal void EnableEnvironment(bool isEnabled)
{
this.mainGrid.IsEnabled = isEnabled;
}

/// <summary>
/// Adds/Removes an overlay so the user won't be able to interact with the background (this behavior was implemented for Dynamo and for Library)
/// </summary>
Expand All @@ -2329,14 +2324,15 @@ internal void EnableOverlayBlocker(bool isEnabled)
{
object[] parametersInvokeScript = new object[] { "fullOverlayVisible", new object[] { isEnabled } };
ResourceUtilities.ExecuteJSFunction(this, parametersInvokeScript);
var backgroundName = "BackgroundBlocker";

if (isEnabled)
{
//By default the shortcutsBarGrid has a ZIndex = 1 then will be shown over the overlay that's why we need to change the ZIndex
Panel.SetZIndex(shortcutsBarGrid, 0);
var backgroundElement = new GuideBackground(this)
{
Name = "BackgroundBlocker",
Name = backgroundName,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
Visibility = Visibility.Visible
Expand All @@ -2351,7 +2347,7 @@ internal void EnableOverlayBlocker(bool isEnabled)
{
//Restoring the ZIndex value to the default one.
Panel.SetZIndex(shortcutsBarGrid, 1);
var backgroundElement = mainGrid.Children.OfType<GuideBackground>().FirstOrDefault();
var backgroundElement = mainGrid.Children.OfType<GuideBackground>().Where(element => element.Name == backgroundName).FirstOrDefault();
if (backgroundElement != null)
{
mainGrid.Children.Remove(backgroundElement);
Expand Down

0 comments on commit 61a4f7d

Please sign in to comment.