Reputation: 179
The problem is that my program does not return after return;
statement. Maybe I am just tired and cannot find obvious mistake but... it continues its work after Return and opens the window. What the heck?
And yes, my program enters IF statement.
public partial class MainWindow : Window
{
public MainWindow()
{
bool checkingResult = FileChecker.CheckFiles();
if (!checkingResult)
{
MessageBox.Show("Required files are missing.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
InitializeComponent();
DataContext = new MainViewModel();
}
}
Upvotes: 0
Views: 181
Reputation: 3744
MainWindow()
is just a constructor. The application doesn't terminate when this constructor returns. Use Application.Current.Shutdown()
to properly close a WPF app.
Upvotes: 5