Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DYN-6130 remove the toast notification #14317

Merged
merged 7 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions src/DynamoCoreWpf/UI/GuidedTour/GuidesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Windows.Controls.Primitives;
using Dynamo.Controls;
using Dynamo.Logging;
using Dynamo.Utilities;
QilongTang marked this conversation as resolved.
Show resolved Hide resolved
using Dynamo.ViewModels;
using Dynamo.Wpf.Properties;
using Dynamo.Wpf.ViewModels.GuidedTour;
Expand Down Expand Up @@ -120,7 +121,7 @@ internal void Initialize()
guideBackgroundElement.ClearCutOffSection();
guideBackgroundElement.ClearHighlightSection();
stopwatch = Stopwatch.StartNew();
}
}

/// <summary>
/// Creates the background for the GuidedTour
Expand Down Expand Up @@ -244,10 +245,10 @@ internal void ExitTour()
{
Logging.Analytics.TrackEvent(Logging.Actions.Completed, Logging.Categories.GuidedTourOperations, guidName, currentGuide.CurrentStep.Sequence);
}
else
else
{
Logging.Analytics.TrackEvent(Logging.Actions.End, Logging.Categories.GuidedTourOperations, guidName, currentGuide.CurrentStep.Sequence);
}
}
Logging.Analytics.TrackTimedEvent(Logging.Categories.GuidedTourOperations, Logging.Actions.TimeElapsed.ToString(), stopwatch.Elapsed, guidName);

currentGuide.ClearGuide();
Expand Down Expand Up @@ -338,7 +339,7 @@ private void CreateGuideSteps(string jsonFile)
totalTooltips = (from step in guide.GuideSteps
where step.StepType == Step.StepTypes.TOOLTIP ||
step.StepType == Step.StepTypes.SURVEY
select step).GroupBy(x=>x.Sequence).Count();
select step).GroupBy(x => x.Sequence).Count();

foreach (Step step in guide.GuideSteps)
{
Expand Down Expand Up @@ -464,7 +465,7 @@ private Step CreateStep(Step jsonStepInfo, HostControlInfo hostControlInfo, int
}
};
var popupWindow = newStep.stepUIPopup as PopupWindow;
if(popupWindow != null && hostControlInfo.HtmlPage != null && !string.IsNullOrEmpty(hostControlInfo.HtmlPage.FileName))
if (popupWindow != null && hostControlInfo.HtmlPage != null && !string.IsNullOrEmpty(hostControlInfo.HtmlPage.FileName))
{
popupWindow.WebBrowserUserDataFolder = userDataFolder != null ? userDataFolder.FullName : string.Empty;
}
Expand Down Expand Up @@ -525,11 +526,11 @@ internal Guide GetNextGuide()


private void Popup_StepClosed(string name, Step.StepTypes stepType)
{
{
GuideFlowEvents.OnGuidedTourFinish(currentGuide.Name);

//The exit tour popup will be shown only when a popup (doesn't apply for survey) is closed or when the tour is closed.
if(stepType != Step.StepTypes.SURVEY)
if (stepType != Step.StepTypes.SURVEY)
CreateRealTimeInfoWindow(Res.ExitTourWindowContent);
}

Expand All @@ -546,10 +547,7 @@ internal void CreateRealTimeInfoWindow(string content, bool stayOpen = false)
UIElement hostUIElement = GuideUtilities.FindChild(mainRootElement, "statusBarPanel");

// When popup already exist, replace it
if ( exitTourPopup != null && exitTourPopup.IsOpen)
{
exitTourPopup.IsOpen = false;
}
CloseRealTimeInfoWindow();
// Otherwise creates the RealTimeInfoWindow popup and set up all the needed values
// to show the popup over the Dynamo workspace
exitTourPopup = new RealTimeInfoWindow()
Expand All @@ -565,5 +563,16 @@ internal void CreateRealTimeInfoWindow(string content, bool stayOpen = false)
exitTourPopup.PlacementTarget = hostUIElement;
exitTourPopup.IsOpen = true;
}

/// <summary>
/// Closes the exitTourPopup if exist and it's open
/// </summary>
internal void CloseRealTimeInfoWindow()
{
if (exitTourPopup != null && exitTourPopup.IsOpen)
{
exitTourPopup.IsOpen = false;
}
}
}
}
6 changes: 6 additions & 0 deletions src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,7 @@ public PreferencesViewModel(DynamoViewModel dynamoViewModel)
this.preferenceSettings.PropertyChanged += PreferenceSettings_PropertyChanged;
this.pythonScriptEditorTextOptions = dynamoViewModel.PythonScriptEditorTextOptions;
this.dynamoViewModel = dynamoViewModel;
this.dynamoViewModel.Model.ShutdownStarted += Model_ShutdownStarted;
QilongTang marked this conversation as resolved.
Show resolved Hide resolved

if (dynamoViewModel.PackageManagerClientViewModel != null)
{
Expand Down Expand Up @@ -1428,6 +1429,11 @@ public PreferencesViewModel(DynamoViewModel dynamoViewModel)
InitializeCommands();
}

private void Model_ShutdownStarted(DynamoModel model)
{
dynamoViewModel.MainGuideManager?.CloseRealTimeInfoWindow();
QilongTang marked this conversation as resolved.
Show resolved Hide resolved
}

private void PreferenceSettings_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
var property = e.PropertyName;
Expand Down