Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 78072

Overload SaveAsDialog and GenericDialog handlers

$
0
0

Finally figured out a work around. If anything in this should be accomplished differently, please correct me.

 

public static void HandleSaveDialog(ArtOfTest.WebAii.Controls.Xaml.Wpf.TextBlock element, string filePath)
{
    // Create an instance of the Manager class to allow access to its functions.
    Settings mySettings = new Settings();
    Manager myManager = new Manager(mySettings);

    // Connect the manager to the first running instance of dTIMS.
    myManager.ConnectToApplication(System.Diagnostics.Process.GetCurrentProcess());

    // Create the dialog handlers.
    GenericDialog genDialog = new GenericDialog(myManager.ActiveApplication, "Save As", false, 6);
    SaveAsDialog saveDlg = SaveAsDialog.CreateSaveAsDialog(myManager.ActiveApplication, DialogButton.SAVE, filePath);

    // Add the save dialog handler to the monitor, and start the monitor.
    myManager.DialogMonitor.AddDialog(saveDlg);
    myManager.DialogMonitor.Start();

    // Click on the element passed in that will create the dialog.
    element.User.Click();

    // Wait until the dialog is handled, and then stop the monitor.
    saveDlg.WaitUntilHandled(30000);
    myManager.DialogMonitor.Stop();
            
    // Add the generic dialog handler to the monitor, and start the monitor.
    myManager.DialogMonitor.AddDialog(genDialog);
    myManager.DialogMonitor.Start();

    // Sleep for 3 seconds to give an overwite dialog to occur.
    System.Threading.Thread.Sleep(3000);

    // Stop the monitor, and remove both dialog from it.
    myManager.DialogMonitor.Stop();
    myManager.DialogMonitor.RemoveDialogs(saveDlg, genDialog);
}


Viewing all articles
Browse latest Browse all 78072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>