Changeset 16165


Ignore:
Timestamp:
09/20/18 14:58:59 (11 months ago)
Author:
gkronber
Message:

#2932: merged r16054 from trunk to stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.Instances.DataAnalysis.Views

  • stable/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisImportDialog.cs

    r15584 r16165  
    3333  public partial class DataAnalysisImportDialog : Form {
    3434
    35     private static readonly List<KeyValuePair<DateTimeFormatInfo, string>> dateTimeFormats =
     35    private static readonly List<KeyValuePair<DateTimeFormatInfo, string>> POSSIBLE_DATETIME_FORMATS =
    3636      new List<KeyValuePair<DateTimeFormatInfo, string>>{
    3737        new KeyValuePair<DateTimeFormatInfo, string>(DateTimeFormatInfo.GetInstance(new CultureInfo("de-DE")), "dd/mm/yyyy hh:MM:ss" ),
     
    4242
    4343    private static readonly List<KeyValuePair<char, string>> POSSIBLE_SEPARATORS =
    44       new List<KeyValuePair<char, string>>{ 
     44      new List<KeyValuePair<char, string>>{
    4545        new KeyValuePair<char, string>(';', "; (Semicolon)" ),
    46         new KeyValuePair<char, string>(',', ", (Comma)" ),   
     46        new KeyValuePair<char, string>(',', ", (Comma)" ),
    4747        new KeyValuePair<char, string>('\t', "\\t (Tab)"),
    4848        new KeyValuePair<char, string>((char)0, "all whitespaces (including tabs and spaces)")
     
    5252      new List<KeyValuePair<NumberFormatInfo, string>>{
    5353        new KeyValuePair<NumberFormatInfo, string>(NumberFormatInfo.GetInstance(new CultureInfo("de-DE")), ", (Comma)"),
    54         new KeyValuePair<NumberFormatInfo, string>(NumberFormatInfo.InvariantInfo, ". (Period)" )   
     54        new KeyValuePair<NumberFormatInfo, string>(NumberFormatInfo.InvariantInfo, ". (Period)" )
    5555    };
    5656
     
    5959        new KeyValuePair<Encoding, string>(Encoding.Default, "Default"),
    6060        new KeyValuePair<Encoding, string>(Encoding.ASCII, "ASCII"),
    61         new KeyValuePair<Encoding, string>(Encoding.Unicode, "Unicode"),   
    62         new KeyValuePair<Encoding, string>(Encoding.UTF8, "UTF8")       
     61        new KeyValuePair<Encoding, string>(Encoding.Unicode, "Unicode"),
     62        new KeyValuePair<Encoding, string>(Encoding.UTF8, "UTF8")
    6363      };
    6464
     
    9797      DecimalSeparatorComboBox.ValueMember = "Key";
    9898      DecimalSeparatorComboBox.DisplayMember = "Value";
    99       DateTimeFormatComboBox.DataSource = dateTimeFormats;
     99      DateTimeFormatComboBox.DataSource = POSSIBLE_DATETIME_FORMATS;
    100100      DateTimeFormatComboBox.ValueMember = "Key";
    101101      DateTimeFormatComboBox.DisplayMember = "Value";
     
    104104      EncodingComboBox.DisplayMember = "Value";
    105105
     106
     107      // set default values based on the current culture
     108      var separator = POSSIBLE_SEPARATORS.Where(n => n.Value.Substring(0, 1) == CultureInfo.CurrentCulture.TextInfo.ListSeparator);
     109      if (separator.Any())
     110        SeparatorComboBox.SelectedItem = separator.First();
     111
     112      var decimalSeparator = POSSIBLE_DECIMAL_SEPARATORS.Where(n => n.Value.Substring(0,1) == CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator);
     113      if (decimalSeparator.Any())
     114        DecimalSeparatorComboBox.SelectedItem = decimalSeparator.First();
    106115    }
    107116
     
    158167        OkButton.Enabled = true;
    159168      }
    160       catch (Exception ex) {
     169       catch (Exception ex) {
    161170        if (ex is IOException || ex is InvalidOperationException || ex is ArgumentException) {
    162171          OkButton.Enabled = false;
Note: See TracChangeset for help on using the changeset viewer.