Beispiel #1
0
        public frmOptions(NewOptionsApplier newOptionsApplier)
        {
            InitializeComponent();
            Utils.Gfx.SetFormIcon(this);
            this._newOptionsApplier = newOptionsApplier;
            this.chkCompileOnSave.Checked = Program.Vars.CompileOnSave;
            this.chkCompileCheckFormat.Checked = Program.Vars.MOCompiler_CheckFormat;
            this.chkCompileCheckHeader.Checked = Program.Vars.MOCompiler_CheckHeader;
            this.nudMaxSearchResults.Value = Convert.ToDecimal(Program.Vars.MaxSearchResults);
            this.btnApply.Enabled = (this._newOptionsApplier != null);
            this.tbxViewerPath.Text = Program.Vars.ViewerPath;
            this.tbxViewerParams.Text = Program.Vars.ViewerParameters;
            this.tbxMOCompilerPath.Text = Program.Vars.MOCompilerPath;
            this._colorsLabels = new Dictionary<ColorEnviroPlace, Label>();
            List<SpecialCharManager> specialCharsData =  new List<SpecialCharManager>(Program.Vars.SpecialChars.Count);
            foreach (KeyValuePair<string, string> kv in Program.Vars.SpecialChars)
            {
                specialCharsData.Add(new SpecialCharManager(kv));
            }
            this.dgvSpecialChars.AutoGenerateColumns = true;
            this.dgvSpecialChars.DataSource = this._specialCharsData = new BindingList<SpecialCharManager>(specialCharsData);
            this._specialCharsDataManager = (CurrencyManager)this.dgvSpecialChars.BindingContext[this._specialCharsData];
            foreach (ColorEnviro enviro in Enum.GetValues(typeof(ColorEnviro)))
            {
                foreach (ColorPlace place in Enum.GetValues(typeof(ColorPlace)))
                {
                    ColorEnviroPlace key = ColorEnviroPlace.Get(enviro, place);
                    Label label = new Label();
                    label.Cursor = Cursors.Hand;
                    label.Dock = DockStyle.Fill;
                    label.Margin = new Padding(1);
                    label.Tag = key;
                    this.tlpColors.Controls.Add(label, 1 + (int)place, 1 + (int)enviro);
                    this._colorsLabels.Add(ColorEnviroPlace.Get(enviro, place), label);
                    label.Click += this.ColorLabels_Click;

                }
            }
            this.SetColors(Program.Vars.Colors);
            FontSet(this.lnkFontSource, Program.Vars.SourceFont);
            FontSet(this.lnkFontTranslation, Program.Vars.TranslatedFont);
            this.tbxBingTranslatorClientID.Text = Program.Vars.BingTranslatorClientID;
            this.tbxBingTranslatorClientSecret.Text = Program.Vars.BingTranslatorClientSecret;
        }
Beispiel #2
0
        public frmOptions(NewOptionsApplier newOptionsApplier)
        {
            InitializeComponent();
            Utils.Gfx.SetFormIcon(this);
            this._newOptionsApplier            = newOptionsApplier;
            this.chkCompileOnSave.Checked      = Program.Vars.CompileOnSave;
            this.chkCompileCheckFormat.Checked = Program.Vars.MOCompiler_CheckFormat;
            this.chkCompileCheckHeader.Checked = Program.Vars.MOCompiler_CheckHeader;
            this.nudMaxSearchResults.Value     = Convert.ToDecimal(Program.Vars.MaxSearchResults);
            this.btnApply.Enabled       = (this._newOptionsApplier != null);
            this.tbxViewerPath.Text     = Program.Vars.ViewerPath;
            this.tbxViewerParams.Text   = Program.Vars.ViewerParameters;
            this.tbxMOCompilerPath.Text = Program.Vars.MOCompilerPath;
            this._colorsLabels          = new Dictionary <ColorEnviroPlace, Label>();
            List <SpecialCharManager> specialCharsData = new List <SpecialCharManager>(Program.Vars.SpecialChars.Count);

            foreach (KeyValuePair <string, string> kv in Program.Vars.SpecialChars)
            {
                specialCharsData.Add(new SpecialCharManager(kv));
            }
            this.dgvSpecialChars.AutoGenerateColumns = true;
            this.dgvSpecialChars.DataSource          = this._specialCharsData = new BindingList <SpecialCharManager>(specialCharsData);
            this._specialCharsDataManager            = (CurrencyManager)this.dgvSpecialChars.BindingContext[this._specialCharsData];
            foreach (ColorEnviro enviro in Enum.GetValues(typeof(ColorEnviro)))
            {
                foreach (ColorPlace place in Enum.GetValues(typeof(ColorPlace)))
                {
                    ColorEnviroPlace key   = ColorEnviroPlace.Get(enviro, place);
                    Label            label = new Label();
                    label.Cursor = Cursors.Hand;
                    label.Dock   = DockStyle.Fill;
                    label.Margin = new Padding(1);
                    label.Tag    = key;
                    this.tlpColors.Controls.Add(label, 1 + (int)place, 1 + (int)enviro);
                    this._colorsLabels.Add(ColorEnviroPlace.Get(enviro, place), label);
                    label.Click += this.ColorLabels_Click;
                }
            }
            this.SetColors(Program.Vars.Colors);
            FontSet(this.lnkFontSource, Program.Vars.SourceFont);
            FontSet(this.lnkFontTranslation, Program.Vars.TranslatedFont);
            this.tbxBingTranslatorClientID.Text     = Program.Vars.BingTranslatorClientID;
            this.tbxBingTranslatorClientSecret.Text = Program.Vars.BingTranslatorClientSecret;
        }