コード例 #1
0
 private void buttonOpen_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (null != dataGridFile.SelectedItem)
         {
             ConfigFileProperties selectedConfig = dataGridFile.SelectedItem as ConfigFileProperties;
             configFileName    = selectedConfig.FullFileName;
             this.DialogResult = true;
         }
     }
     catch (Exception ex)
     {
         string message = ex.Message;
     }
 }
コード例 #2
0
 private void GetConfigFiles()
 {
     try
     {
         if (Directory.Exists(directoryName))
         {
             string[] files = Directory.GetFiles(directoryName, "*.xml");
             foreach (string file in files)
             {
                 ConfigFileProperties config = new ConfigFileProperties(file);
                 configFiles.Add(config);
             }
             dataGridFile.ItemsSource = null;
             dataGridFile.ItemsSource = configFiles;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Failed to find configuration files.\n" + ex.Message, "Configuration Files", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }