コード例 #1
0
        private void BlockTypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (m_firmware == null)
            {
                return;
            }

            StringListBox.Invalidate();
            StringListBox_SelectedValueChanged(StringListBox, EventArgs.Empty);
        }
コード例 #2
0
        private void Icb_SelectedValueChanged(object sender, EventArgs e)
        {
            var icb = sender as ComboBox;

            if (icb == null)
            {
                return;
            }

            var tag  = icb.Tag as Tuple <FirmwareStringMetadata, int>;
            var item = icb.SelectedItem as ImagedItem <byte>;

            if (tag == null)
            {
                return;
            }
            if (item == null)
            {
                return;
            }

            var value = item.Value;
            var idx   = CharLayoutPanel.Controls.IndexOf(icb);

            m_firmware.WriteChar(value, tag.Item2, tag.Item1);
            var itemRect = StringListBox.GetItemRectangle(LastSelectedStringListBoxItemIndex);

            StringListBox.Invalidate(itemRect);
            ImageCacheManager.RebuildStringImageCache(m_firmware, BlockType.Block1);

            UpdateStringPreview();

            if (value == 0x00)
            {
                for (var i = idx + 1; i < CharLayoutPanel.Controls.Count; i++)
                {
                    var relatedIcb = CharLayoutPanel.Controls[i] as ComboBox;
                    if (relatedIcb == null)
                    {
                        continue;
                    }

                    relatedIcb.SelectedIndex = 0;
                    relatedIcb.Enabled       = false;
                }
            }
            else if (idx + 1 < CharLayoutPanel.Controls.Count)
            {
                var relatedIcb = CharLayoutPanel.Controls[idx + 1] as ComboBox;
                if (relatedIcb == null)
                {
                    return;
                }

                if (relatedIcb.SelectedIndex == 0 && !relatedIcb.Enabled)
                {
                    relatedIcb.Enabled = true;
                }
            }

            IsDirty = true;
        }