/// <summary> /// This method will be executed when passing from Step 2 to Step 3 in the Packages guide, so it will show the TermsOfUse Window in case it was not accepted yet /// </summary> /// <param name="stepInfo"></param> /// <param name="uiAutomationData"></param> /// <param name="enableFunction"></param> /// <param name="currentFlow"></param> internal static void ExecuteTermsOfServiceFlow(Step stepInfo, StepUIAutomation uiAutomationData, bool enableFunction, GuideFlow currentFlow) { CurrentExecutingStep = stepInfo; if (stepInfo.ExitGuide != null) { exitGuide = stepInfo.ExitGuide; } //When enableFunction = true, means we want to show the TermsOfUse Window (this is executed in the UIAutomation step in the Show() method) if (enableFunction) { //If the TermsOfService is not accepted yet it will show the TermsOfUseView otherwise it will show the PackageManagerSearchView stepInfo.DynamoViewModelStep.ShowPackageManagerSearch(null); Window ownedWindow = Guide.FindWindowOwned(stepInfo.HostPopupInfo.WindowName, stepInfo.MainWindow as Window); foreach (var handler in uiAutomationData.AutomaticHandlers) { if (ownedWindow == null) { return; } UIElement element = Guide.FindChild(ownedWindow, handler.HandlerElement); //When the Accept button is pressed in the TermsOfUseView then we need to move to the next Step if (element != null) { ManageEventHandler(element, handler.HandlerElementEvent, handler.ExecuteMethod); } } } //When enableFunction = false, means we are hiding (closing) the TermsOfUse Window due that we are moving to the next Step or we are exiting the Guide else { Window ownedWindow = Guide.FindWindowOwned(stepInfo.HostPopupInfo.WindowName, stepInfo.MainWindow as Window); if (ownedWindow == null) { return; } //Tries to close the TermsOfUseView or the PackageManagerSearchView if they were opened previously Guide.CloseWindowOwned(stepInfo.HostPopupInfo.WindowName, stepInfo.MainWindow as Window); } }
/// <summary> /// This method will be executed when passing from Step 6 to Step 7 in the Packages guide, so it will subscribe the install button event /// </summary> /// <param name="stepInfo"></param> /// <param name="uiAutomationData"></param> /// <param name="enableFunction"></param> /// <param name="currentFlow"></param> internal static void ExecuteInstallPackagesFlow(Step stepInfo, StepUIAutomation uiAutomationData, bool enableFunction, GuideFlow currentFlow) { CurrentExecutingStep = stepInfo; Window ownedWindow = Guide.FindWindowOwned(stepInfo.HostPopupInfo.WindowName, stepInfo.MainWindow as Window); if (enableFunction) { if (ownedWindow != null) { viewModel = ownedWindow.DataContext as PackageManagerSearchViewModel; } Button buttonElement = Guide.FindChild(ownedWindow, stepInfo.HostPopupInfo.HostUIElementString) as Button; viewModel.PackageManagerClientViewModel.Downloads.CollectionChanged += Downloads_CollectionChanged; } else { //Tries to close the TermsOfUseView or the PackageManagerSearchView if they were opened previously Guide.CloseWindowOwned(stepInfo.HostPopupInfo.WindowName, stepInfo.MainWindow as Window); } }