Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,710 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
When loading :
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
radioButtonWatchDirectory.IsChecked = Properties.Settings.Default.RadioButtonWatchDirectory;
radioButtonWatchFile.IsChecked = Properties.Settings.Default.RadioButtonWatchFile;
checkBoxIncludeSubdirectories.IsChecked = Properties.Settings.Default.IncludeSubDirectories;
textBoxFileDirectory.Text = Properties.Settings.Default.BrowseFolderDialog;
}
When setting and saving :
private void radioButtonWatchFile_Checked(object sender, RoutedEventArgs e)
{
Properties.Settings.Default.RadioButtonWatchFile = (bool)radioButtonWatchFile.IsChecked;
Properties.Settings.Default.Save();
}
private void radioButtonWatchDirectory_Checked(object sender, RoutedEventArgs e)
{
Properties.Settings.Default.RadioButtonWatchDirectory = (bool)radioButtonWatchDirectory.IsChecked;
Properties.Settings.Default.Save();
}
When running the application once i checked true the Watch File radio button no matter if i check the Watch Directory radio button next time i will run the application the Watch File radio button will be checked. like it's not remembering changing it to the Watch Directory radio button.
The Include Subdirectories is working fine.
Try one of solutions:
private void radioButtonWatchFile_Checked( object sender, RoutedEventArgs e )
{
Properties.Settings.Default.RadioButtonWatchFile = true;
Properties.Settings.Default.RadioButtonWatchDirectory = false;
Properties.Settings.Default.Save( );
}
private void radioButtonWatchDirectory_Checked( object sender, RoutedEventArgs e )
{
Properties.Settings.Default.RadioButtonWatchFile = false;
Properties.Settings.Default.RadioButtonWatchDirectory = true;
Properties.Settings.Default.Save( );
}