public async virtual void Execute(object parameter)
{
Debug.Assert(CanExecute(parameter));
Part part = parameter as Part;
ViewerWindow window = ViewerWindows.SelectPartTypeWindow;
await (Application.Current.MainWindow as MetroWindow).ShowChildWindowAsync(window);
if (window.DialogResult)
{
part.PartType = (window.ViewFrame.Content as SelectPartTypeView).SelectedPartTypeVM.SelectedPartType;
}
else
{
Debug.Fail("No part type selected, so reverting to SOLID");
ViewerWindows.MessageWindow("Part Type was not selected so will default to Solid");
part.PartType = PartType.Solid;
}
// Set the render colour based on the part type the user has (or has not!) chosen
part.DefaultRenderColour = Part.RenderColours[part.PartType];
}
In the following code I attempt to show a ChildWindow using 'ShowChildWindowAsync' and expect the await call to block until the window is closed. However, execution just continues on.
Have I used the API incorrectly? How do create a Modal ChildWindow which blocks execution until closed like the classic MessageBox.Show()?
In the following code I attempt to show a ChildWindow using 'ShowChildWindowAsync' and expect the await call to block until the window is closed. However, execution just continues on.
Have I used the API incorrectly? How do create a Modal ChildWindow which blocks execution until closed like the classic MessageBox.Show()?
The XAML for the ViewerWindow is:
and the ModalWindow style is: