コード例 #1
0
        /// <summary>
        ///   Handles the Load event of the EditSettings control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        private void EditSettings_Load(object sender, EventArgs e)
        {
            fileSettingBindingSource.DataSource = m_ViewSettings;
            fileFormatBindingSource.DataSource  = m_ViewSettings.FileFormat;

            // Fill Drop down
            cboCodePage.SuspendLayout();

            cboCodePage.DataSource           = EncodingHelper.CommonCodePages.Select(cp => new DisplayItem <int>(cp, EncodingHelper.GetEncodingName(cp, false))).ToList();
            cboRecordDelimiter.DisplayMember = nameof(DisplayItem <int> .Display);
            cboRecordDelimiter.ValueMember   = nameof(DisplayItem <int> .ID);
            cboRecordDelimiter.SelectedValue = m_ViewSettings.CodePageId;
            cboCodePage.ResumeLayout(true);

            var descConv = new EnumDescriptionConverter(typeof(RecordDelimiterType));
            var di       = (from RecordDelimiterType item in Enum.GetValues(typeof(RecordDelimiterType))
                            select new DisplayItem <int>((int)item, descConv.ConvertToString(item))).ToList();

            var selValue = (int)m_ViewSettings.FileFormat.NewLine;

            cboRecordDelimiter.SuspendLayout();
            cboRecordDelimiter.DataSource    = di;
            cboRecordDelimiter.DisplayMember = nameof(DisplayItem <int> .Display);
            cboRecordDelimiter.ValueMember   = nameof(DisplayItem <int> .ID);
            cboRecordDelimiter.SelectedValue = selValue;
            cboRecordDelimiter.ResumeLayout(true);

            quotingControl.CsvFile = m_ViewSettings;
        }
コード例 #2
0
        public static string Description(this RecordDelimiterType item)
        {
            var descConv = new EnumDescriptionConverter(typeof(RecordDelimiterType));

            return(descConv.ConvertToString(item));
        }