I would like to show a not interactive screen to inform the user of loading data before the actual interactive screen is shown.
Currently I am using the engine.ShowProress method before creating + showing the actual interactive dialog. Although it works fine for the purpose, it is not possible to give the loading screen a proper title. It will show the automation script name.
How can I show a default screen with a nice "loading" title without blocking any of the code ( = not waiting for any user input)
I got it to work by using this:
- Create custom dialog containing 1 Label
- Showing this dialog before running the controller
- Have the controller run the interactive dialog iso the Loading dialog.
The dialog:
public class DialogLoading : Dialog
{
public DialogLoading(IEngine engine) : base(engine)
{
Title = "Info";
LoadingText = new Label();
AddWidget(LoadingText, 0, 0);
}public Label LoadingText { get; set; }
}
Showing the loading screen:
internal void ShowLoadingScreen(string screenText)
{
var dialog = new DialogLoading(BaseEngine) { Title = "Loading" };
dialog.LoadingText.Text = screenText;
dialog.Show(false);
}
Showing an interactive screen after loading is done:
private void MyMethod()
{
userInfoMsg.AppendLine("Hang on, we are retrieving Categorization data...");
ShowLoadingScreen(userInfoMsg.ToString());
// Do other things and show progress...
// ...
ScreenController = new InteractiveController(BaseEngine);
var dialog = new DialogCategorizeTicket(BaseEngine)
{
Title = "Categorize Ticket ",
};
ScreenController.Run(dialog);
}