Beispiel #1
0
        private void StashTabPicker_Load(object sender, EventArgs e)
        {
            // Calculate the height dynamically depending on how many stashes the user has
            Height            = Math.Min(800, Math.Max(357, 202 + 31 * _numStashTabs));
            gbMoveTo.Height   = Math.Max(248, 83 + 33 * _numStashTabs);
            gbLootFrom.Height = Math.Max(248, 83 + 33 * _numStashTabs);


            for (int i = 1; i <= Math.Max(5, _numStashTabs); i++)
            {
                int p = i; // Don't reference out scope (mutated)
                FirefoxRadioButton.CheckedChangedEventHandler callback = (o, args) => {
                    if (p <= _numStashTabs)
                    {
                        // Don't trust the "Firefox framework" to not trigger clicks on disabled buttons.
                        _settings.GetLocal().StashToDepositTo = p;
                    }
                };

                int y  = 32 + 33 * i;
                var cb = CreateCheckbox($"moveto_tab_{i}", $"iatag_ui_tab_{i}", $"Tab {i}", new Point(6, y), callback);

                cb.Checked     = _settings.GetLocal().StashToDepositTo == i;
                cb.Enabled     = i <= _numStashTabs;
                cb.EnabledCalc = i <= _numStashTabs;
                this.gbMoveTo.Controls.Add(cb);
                helpWhyAreTheseDisabled.Visible = _numStashTabs <= 4;
            }


            for (int i = 1; i <= Math.Max(5, _numStashTabs); i++)
            {
                int p = i; // Don't reference out scope (mutated)
                FirefoxRadioButton.CheckedChangedEventHandler callback = (o, args) => {
                    if (p <= _numStashTabs)
                    {
                        // Don't trust the "Firefox framework" to not trigger clicks on disabled buttons.
                        _settings.GetLocal().StashToLootFrom = p;
                    }
                };

                int y  = 32 + 33 * i;
                var cb = CreateCheckbox($"lootfrom_tab_{i}", $"iatag_ui_tab_{i}", $"Tab {i}", new Point(6, y), callback);
                cb.Checked     = _settings.GetLocal().StashToLootFrom == i;
                cb.Enabled     = i <= _numStashTabs;
                cb.EnabledCalc = i <= _numStashTabs;
                this.gbLootFrom.Controls.Add(cb);
            }



            radioOutputSecondToLast.Checked = _settings.GetLocal().StashToDepositTo == 0;
            radioInputLast.Checked          = _settings.GetLocal().StashToLootFrom == 0;

            LocalizationLoader.ApplyLanguage(Controls, RuntimeSettings.Language);
        }
Beispiel #2
0
        private FirefoxRadioButton CreateCheckbox(string name, string label, string text, Point position, FirefoxRadioButton.CheckedChangedEventHandler callback)
        {
            FirefoxRadioButton checkbox = new FirefoxRadioButton();

            checkbox.Bold            = false;
            checkbox.Checked         = false;
            checkbox.EnabledCalc     = true;
            checkbox.Font            = new Font("Segoe UI", 10F);
            checkbox.ForeColor       = Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(78)))), ((int)(((byte)(90)))));
            checkbox.Location        = position;
            checkbox.Name            = name;
            checkbox.Size            = new Size(188, 27);
            checkbox.TabIndex        = 3;
            checkbox.Tag             = label;
            checkbox.Text            = text;
            checkbox.CheckedChanged += callback;
            return(checkbox);
        }