sj char

sj char

  • NA
  • 1
  • 0

*urgent* popout Window and storyboarding Issue

Aug 15 2010 5:33 AM

Hi all, I got a Installation Window, which have a cancel button to
1) pause the storyboarding
2) popout my Cancel Window
if never click cancel button, will prompt me Success Window

For Cancel Window, there will be an "OK" button for me to be prompted to Failed Window.

So now I want to know how to track when the User closes the window red (X) button, so I can close the Cancel Window and thus returning to Installation Window and resume my storyboarding.

So far, I've asked this question around... And this looks abit workable for me, but still have something wrong....

---------------------------------------------------------------------------------------------------------------------------------------------

You can show the window as a model dialog and use DialogResult to get the result.

If I understand you correctly, you want to know if the user pressed cancel vs if they just closed the window? I'm not sure if this is what your asking, but if you just want to show a confirmation dialog, and get the result, here's how:

In your cancel window:

private void CancelWindow_OnOkClickedobject sender, RoutedEventArgs e)
{

this.Close();
}

private void CancelWindow_OnCancelClickedobject sender, RoutedEventArgs e)
{
this.DialogResult = true;
this.Close();
}

Then, when you want to show this window:


 popout_Cancel MyApp = new popout_Cancel();

bool? result = MyApp.ShowDialog();

If the user presses cancel, result will be set to true. If the user hits the X button, or presses OK, result will be set to false.

Once you have the result, you can resume your storyboard. So the code would look like this:

Storyboard SB = (Storyboard)FindResource("Install");

SB.Pause();

popout_Cancel MyApp = new popout_Cancel();

bool? result = MyApp.ShowDialog();

if (result == null || result == false)
SB.Resume();
else
//they really want to cancel, terminate the app
//i wrote this
MyApp.Close();

Edited: ShowDialog() returns a Nullable, although ShowDialog() apparently only returns true or false

---------------------------------------------------------------------------------------------------------------------------------------------

So when I debug without clicking that Cancel, it can prompt me to the Finish window.

But when I do on this:
1) debug Installation Window
2) Click on that Cancel button in Installation Window
3) Cancel Window pop out, with option "OK" and "Cancel"
4) If click on "Cancel" it goes back to my Installation Window without resuming my storyboarding = stuck
5) If click on the red (X) button, it goes back to my Installation Window, successfully resume my storyboarding > after my storyboard finishes > prompt me to Success Window and my Success Window hangs/can't click anywhere.

Anyone can help me with this code or have any alternative codes? got stuck for days... ): thanks..