コード例 #1
0
        private void barrackComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            FlatComboBox fcb = sender as FlatComboBox;

            bot.cfgData["troops"]["barrack" + fcb.Tag.ToString()] = fcb.SelectedIndex.ToString();
            bot.SaveConfig();
        }
コード例 #2
0
        private void flatComboBox_attackMode_SelectedIndexChanged(object sender, EventArgs e)
        {
            FlatComboBox fcb = sender as FlatComboBox;

            bot.cfgData["attack"]["mode"] = fcb.SelectedIndex.ToString();
            bot.SaveConfig();
        }
コード例 #3
0
        private void AttachResources(Materials materials)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(() => AttachResources(materials));
                return;
            }

            var combos = new FlatComboBox[] {
                this.comboResources1,
                this.comboResources2
            };

            foreach (var combo in combos)
            {
                combo.Items.Clear();

                combo.Items.Add(new ResourceNameValueDisplayItem("연료", () => materials.Fuel.ToString()));
                combo.Items.Add(new ResourceNameValueDisplayItem("탄약", () => materials.Ammo.ToString()));
                combo.Items.Add(new ResourceNameValueDisplayItem("강재", () => materials.Steel.ToString()));
                combo.Items.Add(new ResourceNameValueDisplayItem("보크사이트", () => materials.Bauxite.ToString()));

                combo.Items.Add(new ResourceNameValueDisplayItem("고속수복재", () => materials.RepairBuckets.ToString()));
                combo.Items.Add(new ResourceNameValueDisplayItem("고속건조재", () => materials.BuildMaterials.ToString()));
                combo.Items.Add(new ResourceNameValueDisplayItem("개발자재", () => materials.DevMaterials.ToString()));
                combo.Items.Add(new ResourceNameValueDisplayItem("개수자재", () => materials.ImproveMaterials.ToString()));
            }
            this.comboResources1.SelectedIndex = Settings.ResourceSelected1.Value;
            this.comboResources2.SelectedIndex = Settings.ResourceSelected2.Value;
        }
コード例 #4
0
 public static void appendCombo(FlatComboBox cb, string value)
 {
     if (cb.InvokeRequired)
     {
         cb.Invoke(new Action <FlatComboBox, string>(appendCombo), cb, value);
     }
     else
     {
         cb.Items.Add(value);
     }
 }
コード例 #5
0
        protected void AgregarControlesFiltro()
        {
            txtPad.Width = DataGridView1.RowHeadersWidth;
            int x = txtPad.Width - 1;

            foreach (DataGridViewColumn column in DataGridView1.Columns)
            {
                if (!column.Visible)
                {
                    continue;
                }
                if (column.CellType == typeof(DataGridViewTextBoxCell))
                {
                    if (column.DefaultCellStyle.Format == "d")
                    {
                        MaskedTextBox txtBox = new MaskedTextBox();
                        txtBox.Name = string.Format("{0}Fin", column.Name);
                        AjustarFechaFiltro(txtBox, x, column);
                        panelFiltro.Controls.Add(txtBox);
                        txtBox      = new MaskedTextBox();
                        txtBox.Name = string.Format("{0}Ini", column.Name);
                        AjustarFechaFiltro(txtBox, x, column);
                        txtBox.Location = new Point(txtBox.Location.X, panelHeader.Height - panelFiltro.Height - txtBox.Height - 1);
                        panelHeader.Controls.Add(txtBox);
                        x += column.Width;
                    }
                    else
                    {
                        TextBox txtBox = new TextBox();
                        txtBox.BorderStyle = BorderStyle.FixedSingle;
                        AjustarControlFiltro(txtBox, x, column);
                        x += column.Width;
                        txtBox.TextAlign = HorizontalAlignment.Center;
                    }
                }
                if (column.CellType == typeof(DataGridViewComboBoxCell))
                {
                    FlatComboBox cboBox = new FlatComboBox();
                    cboBox.DropDownStyle = ComboBoxStyle.DropDown;
                    cboBox.FlatStyle     = FlatStyle.Flat;
                    cboBox.Filtro        = true;
                    AjustarControlFiltro(cboBox, x, column);
                    x += column.Width;
                }
                if (column.CellType == typeof(DataGridViewCheckBoxCell))
                {
                    icbaCheckBox chk = new icbaCheckBox();
                    chk.CheckAlign = ContentAlignment.MiddleCenter;
                    chk.Text       = "";
                    chk.Height     = 20;
                    AjustarControlFiltro(chk, x, column);
                }
            }
        }
コード例 #6
0
        private void UpdateResources(Materials materials)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(() => UpdateResources(materials));
                return;
            }

            var combos = new FlatComboBox[] {
                this.comboResources1,
                this.comboResources2
            };

            foreach (var combo in combos)
            {
                combo.Refresh();
            }
        }
コード例 #7
0
        private void FCBTWordSelector_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((!isSCInit) || (_ftb == null))
            {
                return;
            }
            FlatComboBox fcb = sender as FlatComboBox;
            string       val = fcb.SelectedValue.ToString();

            switch (val)
            {
            case null:
            case "":
            {
                break;
            }

            default:
            {
                try
                {
                    if (
                        (val.Equals(Properties.Resources.txtSpellMwnuUnderline)) ||
                        (val.Equals(Properties.Resources.txtSpellMwnuNoMiss)) ||
                        (val.Equals(Properties.Resources.txtSpellMwnuReplace)) ||
                        (val.Equals(Properties.Resources.txtSpellMwnuCancelMiss))
                        )
                    {
                        break;
                    }
                    else if (val.Equals(Properties.Resources.txtSpellMwnuRestore))
                    {
                        _ftb.Text = _origin;
                        _SpellReset();
                        break;
                    }
                    else if (val.Equals(Properties.Resources.txtSpellMwnuClose))
                    {
                        this.Visible = false;
                        _SpellReset();
                        break;
                    }
                    else if (val.Equals(Properties.Resources.txtSpellMwnuCancel))
                    {
                        FCBTWordSelector.DataSource = new string[] {
                            Properties.Resources.txtSpellMwnuCancelMiss,
                            Properties.Resources.txtSpellMwnuClose
                        };
                        _SpellReset();
                        break;
                    }
                    else if (val.Contains(Properties.Resources.txtSpellMwnuAddDictionary))
                    {
                        if (_bw != null)
                        {
                            _spc.AddUserWord(_bw.Text);
                            _ftb.Select(0, 0);
                            _Check();
                        }
                        break;
                    }
                    else if ((_bw != null) && (!string.IsNullOrWhiteSpace(_ftb.Text)))
                    {
                        _ftb.Select(_bw.StartIndex, _bw.Length);
                        _ftb.SelectionReplace(val);
                        _Check();
                        break;
                    }
                }
                catch (Exception ex)
                {
                    _iLog.LogError(ex.Message);
                }
                break;
            }
            }
        }
コード例 #8
0
ファイル: LoadConfig.cs プロジェクト: Jeremymav/ClashofBots
 public static void Load(FlatComboBox comboBoxBarrack1, FlatComboBox comboBoxBarrack2, 
     FlatComboBox comboBoxBarrack3, FlatComboBox comboBoxBarrack4,
     FlatTextBox textboxGold, FlatTextBox textboxElixir,
     FlatTextBox textboxDark, FlatTextBox textboxTrophy,
     FlatCheckBox checkboxGold, FlatCheckBox checkboxElixir,
     FlatCheckBox checkboxDark, FlatCheckBox checkboxTrophy,
     FlatCheckBox checkboxAlert, FlatComboBox comboBoxAttackSides,
     FlatCheckBox checkboxMaxTrophy, FlatTextBox textboxMaxTrophy,
     FlatComboBox comboBoxAttackMode, FlatNumeric numericDeployTime)
 {
     FileIniDataParser parser = new FileIniDataParser();
     IniData data = parser.ReadFile("config.ini");
     int intBarrack1 = Convert.ToInt32(data["troops"]["barrack1"]);
     int intBarrack2 = Convert.ToInt32(data["troops"]["barrack2"]);
     int intBarrack3 = Convert.ToInt32(data["troops"]["barrack3"]);
     int intBarrack4 = Convert.ToInt32(data["troops"]["barrack4"]);
     Action action1 = () => comboBoxBarrack1.SelectedIndex = intBarrack1;
     comboBoxBarrack1.Invoke(action1);
     Action action2 = () => comboBoxBarrack2.SelectedIndex = intBarrack2;
     comboBoxBarrack2.Invoke(action2);
     Action action3 = () => comboBoxBarrack3.SelectedIndex = intBarrack3;
     comboBoxBarrack3.Invoke(action3);
     Action action4 = () => comboBoxBarrack4.SelectedIndex = intBarrack4;
     comboBoxBarrack4.Invoke(action4);
     int gold = Convert.ToInt32(data["search"]["gold"]);
     int elixir = Convert.ToInt32(data["search"]["elixir"]);
     int dark = Convert.ToInt32(data["search"]["dark"]);
     int trophy = Convert.ToInt32(data["search"]["trophy"]);
     Action action5 = () => textboxGold.Text = gold.ToString();
     textboxGold.Invoke(action5);
     Action action6 = () => textboxElixir.Text = elixir.ToString();
     textboxElixir.Invoke(action6);
     Action action7 = () => textboxDark.Text = dark.ToString();
     textboxDark.Invoke(action7);
     Action action8 = () => textboxTrophy.Text = trophy.ToString();
     textboxTrophy.Invoke(action8);
     bool bgold = Convert.ToBoolean(data["search"]["bgold"]);
     bool belixir = Convert.ToBoolean(data["search"]["belixir"]);
     bool bdark = Convert.ToBoolean(data["search"]["bdark"]);
     bool btrophy = Convert.ToBoolean(data["search"]["btrophy"]);
     bool alert = Convert.ToBoolean(data["search"]["alert"]);
     Action action9 = () => checkboxGold.Checked = bgold;
     checkboxGold.Invoke(action9);
     Action action10 = () => checkboxElixir.Checked = belixir;
     checkboxElixir.Invoke(action10);
     Action action11 = () => checkboxDark.Checked = bdark;
     checkboxDark.Invoke(action11);
     Action action12 = () => checkboxTrophy.Checked = btrophy;
     checkboxTrophy.Invoke(action12);
     Action action13 = () => checkboxAlert.Checked = alert;
     checkboxAlert.Invoke(action13);
     int attackSides = Convert.ToInt32(data["attack"]["sides"]);
     Action action14 = () => comboBoxAttackSides.SelectedIndex = attackSides;
     comboBoxAttackSides.Invoke(action14);
     bool bmaxtrophy = Convert.ToBoolean(data["attack"]["bmaxtrophy"]);
     int maxtrophy = Convert.ToInt32(data["attack"]["maxtrophy"]);
     Action action15 = () => checkboxMaxTrophy.Checked = bmaxtrophy;
     checkboxMaxTrophy.Invoke(action15);
     Action action16 = () => textboxMaxTrophy.Text = maxtrophy.ToString();
     textboxMaxTrophy.Invoke(action16);
     int attackMode = Convert.ToInt32(data["attack"]["mode"]);
     Action action17 = () => comboBoxAttackMode.SelectedIndex = attackMode;
     comboBoxAttackMode.Invoke(action17);
     int deployTime = Convert.ToInt32(data["attack"]["deploytime"]);
     Action action18 = () => numericDeployTime.Value = deployTime;
     numericDeployTime.Invoke(action18);
 }
コード例 #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cb"></param>
 /// <param name="selectedValue"></param>
 public static void setComboBox(FlatComboBox cb, string selectedValue)
 {
     cb = (FlatComboBox)getControl(cb);
     cb.SelectedText = selectedValue;
 }