private void BlockTypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (m_firmware == null)
            {
                return;
            }

            StringListBox.Invalidate();
            StringListBox_SelectedValueChanged(StringListBox, EventArgs.Empty);
        }
Пример #2
0
        private void NeedWorkStringButton_Click(object sender, RoutedEventArgs e)
        {
            foreach (var translateString in project.Extractor.TranslateStrings.Select((value, i) => new { i, value }))
            {
                if (translateString.value.Machine == "" || (translateString.value.Hand == "" && project.InHandTranslateMode))
                {
                    StringListBox.SelectedIndex = translateString.i;
                    StringListBox.ScrollIntoView(translateString.value);
                    return;
                }
            }

            MessageBox.Show("모든 작업이 완료된것으로 보입니다");
        }
        private void BlockStringRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            if (sender == Block1StringRadioButton)
            {
                m_currentStringBlock        = BlockType.Block1;
                Block1StringListBox.Visible = true;
                Block2StringListBox.Visible = false;
            }
            if (sender == Block2StringRadioButton)
            {
                m_currentStringBlock        = BlockType.Block2;
                Block1StringListBox.Visible = false;
                Block2StringListBox.Visible = true;
            }

            StringListBox.Focus();
        }
Пример #4
0
        /// <summary>
        /// Display all string in the current language
        /// </summary>
        void BuildListString()
        {
            StringListBox.BeginUpdate();
            StringListBox.Items.Clear();

            if (CurrentLanguageBox.SelectedIndex == -1)
            {
                StringListBox.EndUpdate();
                return;
            }

            Language language = StringTable.GetLanguage(CurrentLanguageBox.SelectedItem as string);

            foreach (KeyValuePair <int, string> kvp in language.Strings)
            {
                ListViewItem item = new ListViewItem(kvp.Key.ToString());
                item.SubItems.Add(kvp.Value);
                StringListBox.Items.Add(item);
            }

            // Compare the current language and the default language
            if (DefaultLanguageBox.SelectedItem != null && DefaultLanguageBox.SelectedItem as string != StringTable.LanguageName)
            {
                Language deflang = StringTable.GetLanguage(DefaultLanguageBox.SelectedItem as string);


                foreach (KeyValuePair <int, string> kvp in deflang.Strings)
                {
                    // If current language already contains this string, skip it
                    if (!string.IsNullOrEmpty(language.GetString(kvp.Key)))
                    {
                        continue;
                    }

                    // Else add to the listview
                    ListViewItem item = new ListViewItem(kvp.Key.ToString());
                    item.ForeColor = Color.Red;

                    item.SubItems.Add(kvp.Value);
                    StringListBox.Items.Add(item);
                }
            }

            StringListBox.EndUpdate();
            StringListBox.Sort();
        }
        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;
        }
 public void OnActivate()
 {
     StringListBox.Focus();
     UpdateStringPreview();
 }