private void _onWindowsClosedHandler(object sender, FrameClosingEventArgs e) { if (e.event_result.HasValue) { subscriber.DialogResult = e.event_result; //The event result will be invoked when a user presses a button. When user presses a button, it will invoke the event stored inside the viewmodel with an input value (bool, in our case). Thus, the event inside the viewmodel is invoked with a value which in turn is stored in the dialogresult. unSubscribe(); //the moment we get the dialog resut. we can unsubscribe. } else { unSubscribe(); // Under any case, we need to unsubscribe first before closing the dialog window. subscriber.Close(); //If user manages to close the dialog without using the predefined button, then the window is closed. } }
private void MainVM_OnWindowsClosed(object sender, FrameClosingEventArgs e) { }