/// <summary>
        /// フォームロードイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormKeySettings_Load(object sender, EventArgs e)
        {
            tabControlCommands.TabPages.Clear();

            var settings = ShortcutKeyManager.ShortcutKeyManager.LoadSettings("shortcutkeys.xml");

            if (settings == null)
            {
                settings = new Dictionary <string, ShortcutKeyManager.ShortcutKeyManager.KeyParam>();
            }

            var layout = LayoutLoader.Load(@".\layout.xml");

            foreach (var layoutTab in layout.Tabs)
            {
                var listview = new ListView();
                listview.Dock          = DockStyle.Fill;
                listview.HideSelection = false;
                listview.FullRowSelect = true;
                listview.View          = View.Details;

                var columnsHeaderCommands = new ColumnHeader();
                columnsHeaderCommands.Text  = "Commands";
                columnsHeaderCommands.Width = 300;
                listview.Columns.Add(columnsHeaderCommands);
                var columnsHeaderShortcutKeys = new ColumnHeader();
                columnsHeaderShortcutKeys.Text  = "Shortcut Key(s)";
                columnsHeaderShortcutKeys.Width = 140;
                listview.Columns.Add(columnsHeaderShortcutKeys);

                foreach (var layoutKeySet in layoutTab.KeySets)
                {
                    var settingsId = layoutTab.Id + SettingsIdNameSeparator + layoutKeySet.Id;
                    var item       = new ListViewItem(layoutKeySet.Label);
                    var subItem    = new ListViewItem.ListViewSubItem();
                    if (settings.ContainsKey(settingsId))
                    {
                        subItem.Text = string.Join(", ", settings[settingsId].KeyTexts);
                    }
                    else
                    {
                        subItem.Text = string.Join(", ", layoutKeySet.KeyTexts);
                    }
                    item.SubItems.Add(subItem);
                    item.Tag = layoutKeySet;
                    listview.Items.Add(item);
                    listview.SelectedIndexChanged += listViewCommands_SelectedIndexChanged;
                }

                var tabPage = new TabPage();
                tabPage.Name = layoutTab.Id;
                tabPage.Text = layoutTab.Label;
                tabPage.Controls.Add(listview);
                tabPage.Tag = listview;

                tabControlCommands.TabPages.Add(tabPage);
            }

            LocalizeUtil.Localized(this);
        }
Esempio n. 2
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            _settings = Settings.Load();
            Size      = _settings.FormSize;

            _caches = Caches.Load();

            comboBoxTarget.Items.AddRange(_settings.TargetHistory.ToArray <string>());
            comboBoxExtensions.Items.AddRange(_settings.ExtensionsHistory.ToArray <string>());
            comboBoxSearchText.Items.AddRange(_settings.SearchTextHistory.ToArray <string>());
            if (_settings.TargetHistory.Count > 0)
            {
                comboBoxTarget.Text = _settings.TargetHistory[0];
            }
            if (_settings.ExtensionsHistory.Count > 0)
            {
                comboBoxExtensions.Text = _settings.ExtensionsHistory[0];
            }
            if (_settings.SearchTextHistory.Count > 0)
            {
                comboBoxSearchText.Text = _settings.SearchTextHistory[0];
            }

            buttonSearch.Visible = true;
            buttonSearch.Enabled = comboBoxSearchText.Text.Length > 0 && comboBoxTarget.Text.Length > 0;
            buttonCancel.Visible = false;
            toolStripProgressBarSearchProgress.Available = false;

            LocalizeUtil.Localized(this);
            LocalizeUtil.Localized(contextMenuStripTargetSelect);
        }