Пример #1
0
        /// <summary>
        ///     技術座標リストビューの項目編集後の処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnTechPositionListViewBeforeItemEdit(object sender, ListViewItemEditEventArgs e)
        {
            switch (e.Column)
            {
                case 0: // X
                    techXNumericUpDown.Text = e.Text;
                    break;

                case 1: // Y
                    techYNumericUpDown.Text = e.Text;
                    break;
            }

            // 自前でリストビューの項目を更新するのでキャンセル扱いとする
            e.Cancel = true;
        }
Пример #2
0
        /// <summary>
        ///     技術効果リストビューの項目編集後の処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnEffectListViewBeforeItemEdit(object sender, ListViewItemEditEventArgs e)
        {
            switch (e.Column)
            {
                case 0: // 種類
                    commandTypeComboBox.SelectedIndex = e.Index;
                    break;

                case 1: // Which
                    commandWhichComboBox.Text = e.Text;
                    break;

                case 2: // Value
                    commandValueComboBox.Text = e.Text;
                    break;

                case 3: // When
                    commandWhenComboBox.Text = e.Text;
                    break;

                case 4: // Where
                    commandWhereComboBox.Text = e.Text;
                    break;
            }

            // 自前でリストビューの項目を更新するのでキャンセル扱いとする
            e.Cancel = true;
        }
Пример #3
0
        /// <summary>
        ///     OR条件必要技術リストビューの項目編集後の処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnOrRequiredListViewBeforeItemEdit(object sender, ListViewItemEditEventArgs e)
        {
            switch (e.Column)
            {
                case 0: // ID
                    orIdNumericUpDown.Text = e.Text;
                    break;

                case 1: // 名前
                    orTechComboBox.SelectedIndex = e.Index;
                    break;
            }

            // 自前でリストビューの項目を更新するのでキャンセル扱いとする
            e.Cancel = true;
        }
Пример #4
0
        /// <summary>
        ///     改良リストビューの項目編集後の処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnUpgradeListViewBeforeItemEdit(object sender, ListViewItemEditEventArgs e)
        {
            switch (e.Column)
            {
                case 0: // ユニット種類
                    upgradeTypeComboBox.SelectedIndex = e.Index;
                    break;

                case 1: // IC
                    upgradeCostTextBox.Text = e.Text;
                    OnUpgradeCostTextBoxValidated(upgradeCostTextBox, new EventArgs());
                    break;

                case 2: // 時間
                    upgradeTimeTextBox.Text = e.Text;
                    OnUpgradeTimeTextBoxValidated(upgradeTimeTextBox, new EventArgs());
                    break;
            }

            // 自前でリストビューの項目を更新するのでキャンセル扱いとする
            e.Cancel = true;
        }
Пример #5
0
        /// <summary>
        ///     小研究リストビューの項目編集後の処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnComponentListViewBeforeItemEdit(object sender, ListViewItemEditEventArgs e)
        {
            switch (e.Column)
            {
                case 0: // ID
                    componentIdNumericUpDown.Text = e.Text;
                    break;

                case 1: // 小研究名
                    componentNameTextBox.Text = e.Text;
                    break;

                case 2: // 研究特性
                    componentSpecialityComboBox.SelectedIndex = e.Index;
                    break;

                case 3: // 難易度
                    componentDifficultyNumericUpDown.Text = e.Text;
                    break;

                case 4: // 2倍
                    componentDoubleTimeCheckBox.Checked = e.Flag;
                    break;
            }

            // 自前でリストビューの項目を更新するのでキャンセル扱いとする
            e.Cancel = true;
        }
Пример #6
0
        /// <summary>
        ///     装備リストビューの項目編集後の処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnEquipmentListViewBeforeItemEdit(object sender, ListViewItemEditEventArgs e)
        {
            switch (e.Column)
            {
                case 0: // 資源
                    resourceComboBox.SelectedIndex = e.Index;
                    break;

                case 1: // 量
                    quantityTextBox.Text = e.Text;
                    OnQuantityTextBoxValidated(quantityTextBox, new EventArgs());
                    break;
            }

            // 自前でリストビューの項目を更新するのでキャンセル扱いとする
            e.Cancel = true;
        }
Пример #7
0
        /// <summary>
        ///     ユニットモデルリストビューの項目編集後の処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnModelListViewBeforeItemEdit(object sender, ListViewItemEditEventArgs e)
        {
            switch (e.Column)
            {
                case 1: // 名前
                    modelNameTextBox.Text = e.Text;
                    break;

                case 2: // IC
                    costTextBox.Text = e.Text;
                    OnCostTextBoxValidated(costTextBox, new EventArgs());
                    break;

                case 3: // 時間
                    buildTimeTextBox.Text = e.Text;
                    OnBuildTimeTextBoxValidated(buildTimeTextBox, new EventArgs());
                    break;

                case 4: // 労働力
                    manPowerTextBox.Text = e.Text;
                    OnManPowerTextBoxValidated(manPowerTextBox, new EventArgs());
                    break;

                case 5: // 物資
                    supplyConsumptionTextBox.Text = e.Text;
                    OnSupplyConsumptionTextBoxValidated(supplyConsumptionTextBox, new EventArgs());
                    break;

                case 6: // 燃料
                    fuelConsumptionTextBox.Text = e.Text;
                    OnFuelConsumptionTextBoxValidated(fuelConsumptionTextBox, new EventArgs());
                    break;

                case 7: // 組織率
                    defaultOrganisationTextBox.Text = e.Text;
                    OnDefaultOrganizationTextBoxValidated(defaultOrganisationTextBox, new EventArgs());
                    break;

                case 8: // 士気
                    moraleTextBox.Text = e.Text;
                    OnMoraleTextBoxValidated(moraleTextBox, new EventArgs());
                    break;

                case 9: // 速度
                    maxSpeedTextBox.Text = e.Text;
                    OnMaxSpeedTextBoxValidated(maxSpeedTextBox, new EventArgs());
                    break;
            }

            // 自前でリストビューの項目を更新するのでキャンセル扱いとする
            e.Cancel = true;
        }
Пример #8
0
        /// <summary>
        ///     指揮官リストビューの項目編集後の処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnLeaderListViewBeforeItemEdit(object sender, ListViewItemEditEventArgs e)
        {
            switch (e.Column)
            {
                case 0: // 国タグ
                    countryComboBox.SelectedIndex = e.Index;
                    break;

                case 1: // ID
                    idNumericUpDown.Text = e.Text;
                    break;

                case 2: // 名前
                    nameTextBox.Text = e.Text;
                    break;

                case 3: // 兵科
                    branchComboBox.SelectedIndex = e.Index;
                    break;

                case 4: // スキル
                    skillNumericUpDown.Text = e.Text;
                    break;

                case 5: // 最大スキル
                    maxSkillNumericUpDown.Text = e.Text;
                    break;

                case 6: // 開始年
                    startYearNumericUpDown.Text = e.Text;
                    break;

                case 7: // 終了年
                    endYearNumericUpDown.Text = e.Text;
                    break;
            }

            // 自前でリストビューの項目を更新するのでキャンセル扱いとする
            e.Cancel = true;
        }
Пример #9
0
        /// <summary>
        ///     プロヴィンスリストビューの項目編集後の処理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnProvinceListViewBeforeItemEdit(object sender, ListViewItemEditEventArgs e)
        {
            switch (e.Column)
            {
                case 0: // 名前
                    nameTextBox.Text = e.Text;
                    break;

                case 3: // 港
                    portCheckBox.Checked = e.Flag;
                    break;

                case 4: // 砂浜
                    beachCheckBox.Checked = e.Flag;
                    break;

                case 5: // インフラ
                    infraTextBox.Text = e.Text;
                    OnInfraTextBoxValidated(infraTextBox, new EventArgs());
                    break;

                case 6: // IC
                    icTextBox.Text = e.Text;
                    OnIcTextBoxValidated(icTextBox, new EventArgs());
                    break;

                case 7: // 労働力
                    manpowerTextBox.Text = e.Text;
                    OnManpowerTextBoxValidated(manpowerTextBox, new EventArgs());
                    break;

                case 8: // エネルギー
                    energyTextBox.Text = e.Text;
                    OnEnergyTextBoxValidated(energyTextBox, new EventArgs());
                    break;

                case 9: // 金属
                    metalTextBox.Text = e.Text;
                    OnMetalTextBoxValidated(metalTextBox, new EventArgs());
                    break;

                case 10: // 希少資源
                    rareMaterialsTextBox.Text = e.Text;
                    OnRareMaterialsTextBoxValidated(rareMaterialsTextBox, new EventArgs());
                    break;

                case 11: // 石油
                    oilTextBox.Text = e.Text;
                    OnOilNumericUpDownValidated(oilTextBox, new EventArgs());
                    break;
            }

            // 自前でリストビューの項目を更新するのでキャンセル扱いとする
            e.Cancel = true;
        }
Пример #10
0
        /// <summary>
        ///     文字列編集時の処理
        /// </summary>
        private void OnTextFinishEdit(object sender, CancelEventArgs e)
        {
            InlineTextBox textBox = sender as InlineTextBox;
            if (textBox == null)
            {
                return;
            }
            string text = textBox.Text;

            // イベントハンドラを削除する
            textBox.FinishEdit -= OnTextFinishEdit;

            // 編集用テキストボックスを削除する
            Controls.Remove(textBox);

            // キャンセルされれば項目を更新しない
            if (e.Cancel)
            {
                return;
            }

            ListViewItem item = Items[_editingRowIndex];
            ListViewItem.ListViewSubItem subItem = item.SubItems[_editingColumnIndex];

            ListViewItemEditEventArgs ie = new ListViewItemEditEventArgs(_editingRowIndex, _editingColumnIndex,
                textBox.Text);
            BeforeItemEdit?.Invoke(this, ie);

            // キャンセルされれば項目を更新しない
            if (ie.Cancel)
            {
                return;
            }

            // 項目の文字列を更新する
            subItem.Text = text;

            AfterItemEdit?.Invoke(this, ie);
        }
Пример #11
0
        /// <summary>
        ///     リスト編集時の処理
        /// </summary>
        private void OnListFinishEdit(object sender, CancelEventArgs e)
        {
            InlineComboBox comboBox = sender as InlineComboBox;
            if (comboBox == null)
            {
                return;
            }
            string s = comboBox.Text;
            int index = comboBox.SelectedIndex;

            // イベントハンドラを削除する
            comboBox.FinishEdit -= OnListFinishEdit;

            // 編集用コンボボックスを削除する
            Controls.Remove(comboBox);

            // キャンセルされれば項目を更新しない
            if (e.Cancel)
            {
                return;
            }

            ListViewItem item = Items[_editingRowIndex];
            ListViewItem.ListViewSubItem subItem = item.SubItems[_editingColumnIndex];

            ListViewItemEditEventArgs ie = new ListViewItemEditEventArgs(_editingRowIndex, _editingColumnIndex, s, index);
            BeforeItemEdit?.Invoke(this, ie);

            // キャンセルされれば項目を更新しない
            if (ie.Cancel)
            {
                return;
            }

            // 項目の文字列を更新する
            subItem.Text = comboBox.Items[index].ToString();

            AfterItemEdit?.Invoke(this, ie);
        }
Пример #12
0
        /// <summary>
        ///     項目の真偽値を反転させる
        /// </summary>
        /// <param name="flag">初期真偽値</param>
        private void InvertFlag(bool flag)
        {
            ListViewItemEditEventArgs ie = new ListViewItemEditEventArgs(_editingRowIndex, _editingColumnIndex, !flag);
            BeforeItemEdit?.Invoke(this, ie);

            // キャンセルされれば項目を更新しない
            if (ie.Cancel)
            {
                return;
            }

            AfterItemEdit?.Invoke(this, ie);
        }