コード例 #1
0
        public Form1()
        {
            // Setup translation data
            Tx.UseFileSystemWatcher = true;
            Tx.LoadDirectory("lang");
            Tx.PrimaryCulture = "de";

            InitializeComponent();

            // Adopt UI font
            Font = SystemFonts.MessageBoxFont;

            // Statically set a control's text once
            //IntroLabel.Text = Tx.T("intro");

            // Add a custom control property binding to a text key
            //TxDictionaryBinding.AddBinding(IntroLabel, "Text", "intro");

            // Add translation dictionary bindings for all controls
            TxDictionaryBinding.AddTextBindings(this);

            // Fill the languages drop-down and select the current language
            string currentCulture = Tx.GetCultureName();

            foreach (CultureInfo ci in Tx.AvailableCultures)
            {
                CultureLabel cl = new CultureLabel(ci.Name, Tx.U(ci.NativeName));
                LanguageCombo.Items.Add(cl);
                if (ci.Name == currentCulture)
                {
                    LanguageCombo.SelectedItem = cl;
                }
            }
            isLoading = false;
        }
コード例 #2
0
        public MainWindow()
        {
            InitializeComponent();

            Text = App.AssemblyTitle;

            BackColor           = Color.FromArgb(0xFA, 0xFA, 0xFA);
            toolStrip.BackColor = Color.White;

            implementationButton.DropDownButtonWidth       += 2;
            highlightDifferencesButton.DropDownButtonWidth += 2;

            listView.EmptyText = Tx.T("main.list is empty");

            // Create Languages menu
            string currentCulture = Tx.GetCultureName();

            foreach (CultureInfo culture in Tx.AvailableCultures)
            {
                ToolStripMenuItem item = new ToolStripMenuItem(culture.DisplayName, null, OnLanguageMenuItemClick);
                item.Tag = culture.Name;
                if (culture.Name == currentCulture)
                {
                    item.Checked = true;
                }
                langMenuItem.DropDownItems.Add(item);
            }


            // Load available implementations
            ToolStripMenuItem implementationNetButton = new ToolStripMenuItem("[mathlib.internal.double]");

            implementationNetButton.Click += OnSetItemCallbacksButtonClick;
            implementationNetButton.Tag    = defaultDoubleCallbacks;
            implementationButton.DropDownItems.Add(implementationNetButton);

            ToolStripMenuItem implementationNetFloatButton = new ToolStripMenuItem("[mathlib.internal.float]");

            implementationNetFloatButton.Click += OnSetItemCallbacksButtonClick;
            implementationNetFloatButton.Tag    = defaultFloatCallbacks;
            implementationButton.DropDownItems.Add(implementationNetFloatButton);

            implementationButton.DropDownItems.Add(new ToolStripSeparator());

            LoadAllExternalOperators(implementationButton.DropDownItems);

            implementationButton.DropDownItems.Add(new ToolStripSeparator());

            ToolStripMenuItem implementationAddButton = new ToolStripMenuItem("[mathlib.add]");

            implementationAddButton.Click += OnImplementationAddButtonClick;
            implementationButton.DropDownItems.Add(implementationAddButton);

            // Add available highlight differences modes
            ToolStripMenuItem highlightOffButton = new ToolStripMenuItem("[highlight.disabled]");

            highlightOffButton.Checked = true;
            highlightOffButton.Click  += OnHighlightOffButtonClick;
            highlightDifferencesButton.DropDownItems.Add(highlightOffButton);

            ToolStripMenuItem highlightConstantButton = new ToolStripMenuItem("[highlight.constant]");

            highlightConstantButton.Click += OnHighlightConstantButtonClick;
            highlightDifferencesButton.DropDownItems.Add(highlightConstantButton);

            ToolStripMenuItem highlightDynamicButton = new ToolStripMenuItem("[highlight.dynamic]");

            highlightDynamicButton.Click += OnHighlightDynamicButtonClick;
            highlightDifferencesButton.DropDownItems.Add(highlightDynamicButton);

            ToolStripMenuItem averageButton = new ToolStripMenuItem("[highlight.only diff]");

            averageButton.Click += OnAverageButtonClick;
            highlightDifferencesButton.DropDownItems.Add(averageButton);

            TxWinForms.Bind(this);
            Tx.DictionaryChanged += OnTxDictionaryChanged;

            // Setup graph
            graph.DataSource = listView.Items;

            OnScaleFactorChanged();

            RefreshToolStrip();
        }