Exemplo n.º 1
0
        private void LanguagePackPicker_Load(object sender, EventArgs e)
        {
            LocalizationLoader.ApplyLanguage(Controls, RuntimeSettings.Language);
            var loc = new LocalizationLoader();

            var n = 0;

            // Default language: English
            {
                var cb = new FirefoxRadioButton
                {
                    Location = new Point(10, 25 + n * 33),
                    Text     = "English (Official)",
                    Tag      = string.Empty,
                    Checked  = string.IsNullOrEmpty(_settings.GetLocal().LocalizationFile),
                    TabIndex = n,
                    TabStop  = true
                };

                groupBox1.Controls.Add(cb);
                _checkboxes.Add(cb);
                n++;
            }

            foreach (var path in _paths)
            {
                if (Directory.Exists(Path.Combine(path, "localization")))
                {
                    foreach (var file in Directory.EnumerateFiles(Path.Combine(path, "localization"), "*.zip"))
                    {
                        loc.CheckLanguage(file, out var author, out var language);

                        var cb = new FirefoxRadioButton
                        {
                            Location = new Point(10, 25 + n * 33),
                            Text     = RuntimeSettings.Language.GetTag("iatag_ui_language_by_author", language, author),
                            Anchor   = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top,
                            Width    = groupBox1.Width - pictureBox1.Width,
                            Tag      = file,
                            Checked  = file == _settings.GetLocal().LocalizationFile,
                            TabIndex = n,
                            TabStop  = true
                        };

                        groupBox1.Controls.Add(cb);
                        _checkboxes.Add(cb);
                        n++;
                    }
                }
            }

            Height += n * 33;
        }
Exemplo n.º 2
0
        private void LanguagePackPicker_Load(object sender, EventArgs e)
        {
            LocalizationLoader loc = new LocalizationLoader();

            int n = 0;

            // Default language: English
            {
                FirefoxRadioButton cb = new FirefoxRadioButton {
                    Location = new Point(10, 25 + n * 33),
                    Text     = "English (Official)",
                    Tag      = string.Empty,
                    Checked  = string.IsNullOrEmpty(Properties.Settings.Default.LocalizationFile)
                };

                cb.TabIndex = n;
                cb.TabStop  = true;
                groupBox1.Controls.Add(cb);
                _checkboxes.Add(cb);
                n++;
            }

            foreach (var path in _paths)
            {
                if (Directory.Exists(Path.Combine(path, "localization")))
                {
                    foreach (var file in Directory.EnumerateFiles(Path.Combine(path, "localization"), "*.zip"))
                    {
                        string author;
                        string language;
                        loc.CheckLanguage(file, out author, out language);

                        FirefoxRadioButton cb = new FirefoxRadioButton {
                            Location = new Point(10, 25 + n * 33),
                            Text     = string.Format("{0} by {1}", language, author),
                            Anchor   = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top,
                            Width    = groupBox1.Width - pictureBox1.Width,
                            Tag      = file,
                            Checked  = file == Properties.Settings.Default.LocalizationFile
                        };

                        cb.TabIndex = n;
                        cb.TabStop  = true;
                        groupBox1.Controls.Add(cb);
                        _checkboxes.Add(cb);
                        n++;
                    }
                }
            }

            this.Height += n * 33;
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        private static void It(System.Windows.Forms.Control.ControlCollection collection)
        {
            foreach (Control control in collection)
            {
                It(control.Controls);

                TextBox            tb     = control as TextBox;
                FirefoxCheckBox    cb     = control as FirefoxCheckBox;
                FirefoxRadioButton rb     = control as FirefoxRadioButton;
                GroupBox           gb     = control as GroupBox;
                FirefoxButton      button = control as FirefoxButton;
                PanelBox           pb     = control as PanelBox;
                Label label = control as Label;

                if (tb != null)
                {
                    tb.Text = Reverse(tb.Text);
                }
                if (cb != null)
                {
                    cb.Text = Reverse(cb.Text);
                }
                if (rb != null)
                {
                    rb.Text = Reverse(rb.Text);
                }
                if (gb != null)
                {
                    gb.Text = Reverse(gb.Text);
                }
                if (button != null)
                {
                    button.Text = Reverse(button.Text);
                }
                if (pb != null)
                {
                    pb.Text = Reverse(pb.Text);
                }
                if (label != null)
                {
                    label.Text = Reverse(label.Text);
                }
            }
        }
Exemplo n.º 5
0
        private void buttonTransfer_Click(object sender, EventArgs e)
        {
            Result = string.Empty;

            foreach (Control c in groupBox1.Controls)
            {
                FirefoxRadioButton cb = c as FirefoxRadioButton;
                if (cb != null && cb.Checked)
                {
                    GDTransferFile mod = c.Tag as GDTransferFile;
                    if (mod != null)
                    {
                        Result            = mod.Filename;
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }


            this.Close();
        }
Exemplo n.º 6
0
        private void StashPicker_Load(object sender, EventArgs e)
        {
            int n = 0;

            foreach (var mod in GlobalPaths.TransferFiles)
            {
                Control cb = new FirefoxRadioButton {
                    Location = new Point(10, 25 + n * 33),
                    Text     = mod.ToString(),
                    Tag      = mod,
                    Enabled  = !string.IsNullOrEmpty(mod.Filename),
                };

                cb.TabIndex = n;
                cb.TabStop  = true;
                groupBox1.Controls.Add(cb);
                n++;
            }

            this.Height += n * 33;
        }
Exemplo n.º 7
0
        private void LanguagePackPicker_Load(object sender, EventArgs e)
        {
            LocalizationLoader.ApplyLanguage(Controls, RuntimeSettings.Language);
            var loc = new LocalizationLoader();

            var n = 0;

            // Default language: English
            {
                var cb = new FirefoxRadioButton {
                    Location = new Point(10, 25 + n * 33),
                    Text     = "English (Official)",
                    Tag      = string.Empty,
                    Checked  = string.IsNullOrEmpty(_settings.GetLocal().LocalizationFile),
                    TabIndex = n,
                    TabStop  = true
                };

                groupBox1.Controls.Add(cb);
                _checkboxes.Add(cb);
                n++;
            }

            foreach (var path in _paths)
            {
                if (Directory.Exists(Path.Combine(path, "localization")))
                {
                    foreach (var file in Directory.EnumerateFiles(Path.Combine(path, "localization"), "*.zip"))
                    {
                        loc.CheckLanguage(file, out var author, out var language);

                        var isFullyTranslatedTag = LocalizationLoader.IsFullySupportedTranslation(file) ? "" : "[Partial] ";
                        var cb = new FirefoxRadioButton {
                            Location = new Point(10, 25 + n * 33),
                            Text     = isFullyTranslatedTag + RuntimeSettings.Language.GetTag("iatag_ui_language_by_author", language, author),
                            Anchor   = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top,
                            Width    = groupBox1.Width - pictureBox1.Width,
                            Tag      = file,
                            Checked  = file == _settings.GetLocal().LocalizationFile,
                            TabIndex = n,
                            TabStop  = true
                        };

                        groupBox1.Controls.Add(cb);
                        _checkboxes.Add(cb);
                        n++;
                    }
                }
            }


            var delta = Math.Min(Math.Max(0, n - 5), 15) * 33; // We already have space for 5, only expand if we exceed this.

            if (delta > 0)
            {
                var newHeight = Height + delta;
                MaximumSize         = new Size(MaximumSize.Width, newHeight);
                MinimumSize         = new Size(MinimumSize.Width, newHeight);
                Height              = newHeight;
                lblWarning.Location = new Point(lblWarning.Location.X, lblWarning.Location.Y + delta);
            }
        }