示例#1
0
        private void EncodeForm_Load(object sender, System.EventArgs e)
        {
            // Initialize encoding schemes
            EncodingInfo[] encodings = Encoding.GetEncodings();
            ArrayList      encList   = new ArrayList(encodings);
            IComparer      encComp   = new EncodingSortClass();

            encList.Sort(encComp);
            encodings = (EncodingInfo[])encList.ToArray(typeof(EncodingInfo));

            encodingSchemeComboBox.DataSource                 = encodings;
            encodingSchemeComboBox.DisplayMember              = "DisplayName";
            encodingSchemeComboBox.ValueMember                = "CodePage";
            encodingSchemeComboBox.SelectedValue              = Encoding.UTF8.CodePage;
            this.encodingSchemeComboBox.SelectedIndexChanged += new System.EventHandler(this.encodingSchemeComboBox_SelectedIndexChanged);

            // Initialize fallback schemes
            this.fallbackSchemeComboBox.Items.AddRange(EncoderInfo.FallbackSchemes);
            fallbackSchemeComboBox.SelectedIndex = 0;

            // Initialize normalization form
            this.normalizationComboBox.Items.Add(EncoderInfo.NormalizationNone);
            this.normalizationComboBox.Items.AddRange(Enum.GetNames(typeof(NormalizationForm)));
            normalizationComboBox.SelectedIndex = 0;
        }
示例#2
0
        //Called at startup
        private void EncodeFileUserControl_Load(object sender, System.EventArgs e)
        {
            captionLabel.Visible          = false;
            outputLinkLabel.Visible       = false;
            intermediateLabel.Visible     = false;
            intermediateLinkLabel.Visible = false;

            // Initialize encoding schemes
            encodings = Encoding.GetEncodings();
            ArrayList encList = new ArrayList(encodings);
            IComparer encComp = new EncodingSortClass();

            encList.Sort(encComp);
            encodings = (EncodingInfo[])encList.ToArray(typeof(EncodingInfo));

            foreach (EncodingInfo ei in encodings)
            {
                decodeComboBox.Items.Add(ei.DisplayName);
            }
            decodeComboBox.Items.Insert(0, "Default");

            decodeComboBox.SelectedIndex              = 0;
            this.decodeComboBox.SelectedIndexChanged += new System.EventHandler(this.decodeComboBox_SelectedIndexChanged);
        }