Exemplo n.º 1
0
        private void localeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            Logger.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name);
            if (!loadingForm)
            {
                //forcing the loadingForm flag to prevent that this event is fired multiple times ultil it's finished
                loadingForm = true;

                // saving current locale code and index
                if (localeComboBox.SelectedIndex >= 0)
                {
                    MainForm.optionsData.selectedLocaleIndex = localeComboBox.SelectedIndex;
                    MainForm.optionsData.selectedLocale      = MainForm.optionsData.localeList[MainForm.optionsData.selectedLocaleIndex].localeCode;
                }
                localeManager.SaveOldLocaleLabels();
                localeManager.SetLocale(this);

                // setting again the defaults data refreshing the localization
                MainForm.optionsData.SetDefault();

                // restoring the combobox index
                if (MainForm.optionsData.selectedLocaleIndex >= 0)
                {
                    localeComboBox.SelectedIndex = MainForm.optionsData.selectedLocaleIndex;
                }
                //Console.WriteLine("MainForm.optionsData.lastVersionFound: " + MainForm.optionsData.lastVersionFound);
                localeManager.UpdateNewLocaleLabels();

                // update the labels
                UpdateLabels();
                loadingForm = false;
            }
        }
Exemplo n.º 2
0
 public AboutForm()
 {
     Logger.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name);
     InitializeComponent();
     localeManager.SetLocale(this);
     RestoreWindowPositionAndSize();
     SetControlsContent();
 }
Exemplo n.º 3
0
    public void NextLocale()
    {
        // Update the index
        index++;
        index %= Locales.Length;

        // Pick next locale
        Manager.SetLocale(Locales[index]);
    }
Exemplo n.º 4
0
        private void UpdateLocale()
        {
            //Console.WriteLine("currentLocale: " + currentLocale);
            //Console.WriteLine("MainForm.optionsData.localeList[MainForm.optionsData.selectedLocaleIndex].localeCode: " + MainForm.optionsData.localeList[MainForm.optionsData.selectedLocaleIndex].localeCode);

            if (currentLocale != MainForm.optionsData.selectedLocale)
            {
                currentLocale = MainForm.optionsData.selectedLocale;
                localeManager.SetLocale(this);
            }
        }
Exemplo n.º 5
0
        private void ChangeLocale(Locale locale)
        {
            var dialogResult = MessageBox.Show("Do you want to save your changes to this locale's strings?", "Save Changes?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }
            if (dialogResult == DialogResult.Yes)
            {
                Save();
            }

            _localeManager.LoadLocales();
            _localeManager.SetLocale(locale.Key);
            locale = _localeManager.Locales[locale.Key];

            ResetWorkspace();
            FillLocalesMenu(locale.Key);
            CreateDocuments(locale);
        }
Exemplo n.º 6
0
        public ModelsForm(MainForm mainForm)
        {
            Logger.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name);
            loadingForm = true;

            InitializeComponent();
            this.mainForm = mainForm;
            localeManager.SetLocale(this);
            RestoreWindowPositionAndSize();
            SetDataSource();
            SetControlsContent();
            loadingForm = false;
        }
Exemplo n.º 7
0
        public ManageTrackForm(ModelsData.Model.Track track, CallType callType, int index)
        {
            Logger.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name);
            InitializeComponent();
            this.track             = track;
            this.callType          = callType;
            this.currentTrackIndex = index;

            localeManager.SetLocale(this);
            originalTrackJson = Newtonsoft.Json.JsonConvert.SerializeObject(this.track);
            RestoreWindowPositionAndSize();
            SetDataSource();
            SetControlsContent();
        }
Exemplo n.º 8
0
        public void SetGetLocale()
        {
            // Arrange
            var context = new TestCaseContext();
            var sut     = new LocaleManager(
                context.OptionsService,
                context.Logger);

            var locale = "ru-ru";

            // Act
            sut.SetLocale(locale);
            var actual = sut.GetLocale();

            // Assert
            Assert.Equal(locale, actual);
        }
Exemplo n.º 9
0
        public JobForm(int inputJobIndex, int inputJobId)
        {
            Logger.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name);

            InitializeComponent();
            this.jobIndex = inputJobIndex;
            this.jobId    = inputJobId;
            // if the current job is not executed activate the refresh timer
            if (MainForm.queueData.jobList[jobIndex].id == jobId && !MainForm.queueData.jobList[jobIndex].jobExecuted)
            {
                refreshTimer.Enabled = true;
            }
            jobStillAvailableTimer.Enabled = true;
            localeManager.SetLocale(this);
            RestoreWindowPositionAndSize();
            SetDataSource();
            SetControlsContent();
        }
Exemplo n.º 10
0
 public ManageModelForm(ModelsData.Model inputModel, CallType callType, int index)
 {
     Logger.Trace(System.Reflection.MethodBase.GetCurrentMethod().Name);
     loadingForm = true;
     InitializeComponent();
     model                  = inputModel;
     this.callType          = callType;
     this.currentModelIndex = index;
     localeManager.SetLocale(this);
     originalModelJson = Newtonsoft.Json.JsonConvert.SerializeObject(model);
     originalModelName = model.modelName;
     RestoreWindowPositionAndSize();
     NewModelActions();
     loadingForm = false;
     if (!model.customCommand)
     {
         GenerateModel();
     }
     Application.DoEvents();
 }