Hi
I am attempting to create my own exit confirmation window (not to sure if you could use a page to do this) struggling with the bool functions, created a static int in main window ( to which I assigned number values from exitConfirmation window) tried using these within a bool but not to sure why the program rejects all attempts I have made.
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
public static int exitNumber;
public bool Exitbool()
{
if (exitNumber == 1)
{ return true; }
else if (exitNumber == 2)
{
return true;
saveWindow save = new saveWindow();
save.Show();
}
else if (exitNumber == 3)
{ return false; }
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
}
}and here is the second window
public partial class exitConfirmation : Page
{
public exitConfirmation()
{
InitializeComponent();
}
private void exitConfirmationYes_btn_Click(object sender, RoutedEventArgs e)
{
MainWindow.exitNumber = 1;
}
private void exitConfirmationNo_btn_Click(object sender, RoutedEventArgs e)
{
MainWindow.exitNumber = 2;
}
private void exitConfirmationCancel_btn_Click(object sender, RoutedEventArgs e)
{
MainWindow.exitNumber = 3;
}
}any and all help would be appreciated