public void Close() { myPopupNavigator.ExitTour(); myWindowManager.WindowActivated -= WindowActivated; myWindowManager.WindowDeactivated -= WindowDeactivated; FeatureTour.OnStepLeaved(myCurrentStepNode.Step); FeatureTour.OnClosed(myCurrentStepNode.Step); FeatureTour.SetCurrentRunNull(); }
private bool SetStep(StepNode nextStep, bool includeUnloaded = false) { if (nextStep == null) { Log.Debug("SetStep: nextStep is null"); return(false); } Log.Debug("SetStep: '" + nextStep.Step.ID + "'"); if (myCurrentStepNode != nextStep) { FeatureTour.OnStepLeaved(myCurrentStepNode.Step); myCurrentStepNode = nextStep; } var step = myCurrentStepNode.Step; FeatureTour.OnStepEntering(step); var app = Application.Current; VisualElement element; if (app == null) { element = myVisualElementManager.GetVisualElement(step.ElementID, includeUnloaded); } else { element = app.Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, new Func <object>(() => myVisualElementManager.GetVisualElement(step.ElementID, includeUnloaded))) as VisualElement; } if (element == null) { LogWarningCouldNotFindElementFor(step); return(false); } using (myPopupNavigator.MovePopupTo(element)) { InitializeViewModel(step, element); // required to ensure that the view is updated before the popup is shown // otherwise the update is visible in the popup (which looks ugly) Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Background, new Action(() => { })); FeatureTour.OnStepEntered(step); } return(true); }