Example #1
0
        private void UpdateLanguage(Instrument settings, Instrument returnInstrument)
        {
            string instLang = Master.Instance.SwitchService.Instrument.Language.Code;

            returnInstrument.Language.Code = instLang;

            // JFC  26-Sep-2013  INS-4248
            // New logic to support setting the docked instrument's language from what
            // was provided by iNet.  The language code will be an empty string at this point
            // if the pre-v5.7 logic is supposed to be used which will try to set the
            // instrument to the docking station's language.
            if (settings.Language.Code != String.Empty)
            {
                // Instrument already set to what iNet wants.
                if (instLang == settings.Language.Code)
                {
                    return;
                }

                // If code execution reaches this point, we know the language on the instrument
                // differs from what iNet wants.  Set the instrument's language to match what iNet provided.
                LogUpdate("Language", settings.Language.Code, instLang);
                if (_instCtrlr.SetLanguage(settings.Language.Code))
                {
                    Master.Instance.SwitchService.Instrument.Language.Code = settings.Language.Code;
                    returnInstrument.Language.Code = settings.Language.Code;
                }
            }
            // Below block contains the untouched logic to set the instrument's language
            // to the docking station's language.
            else
            {
                string idsLang = Configuration.DockingStation.Language.Code.ToUpper();

                // If instrument language differs from IDS's language, but is a supported language,
                // then make the language of the instrument equal the language of the IDS.  e.g.,
                // if instrument is English, but IDS is French, then make the instrument French, too.
                //
                // But, if instrument language differs from IDS's language, but is NOT a supported
                // langauge, then leave the instrument's language alone. e.g., if instrument is
                // Russian, but IDS is English, then leave just the instrument's language alone.

                if (instLang == idsLang)
                {
                    return;
                }

                // SGF  1-Oct-2012  INS-1656
                // Starting here, code has been reorganized as a result of the addition of Portuguese (Brazil) to the iNet DS.

                if (instLang != Language.English &&
                    instLang != Language.French &&
                    instLang != Language.German &&
                    instLang != Language.Spanish &&
                    instLang != Language.PortugueseBrazil)
                {
                    // The instrument language is not supported by the iNet DS, so leave it set to that language.
                    return;
                }

                // If code execution reaches this point, we know the language on the instrument
                // differs from the iNet DS, and the current language on the instrument is one of the
                // languages the iNet DS supports.  Set the instrument's language to match the iNet DS language.
                LogUpdate("Language", instLang, idsLang);
                if (_instCtrlr.SetLanguage(idsLang))
                {
                    Master.Instance.SwitchService.Instrument.Language.Code = idsLang;
                    returnInstrument.Language.Code = idsLang;
                }
            }
        }