コード例 #1
0
            /// --------------------------------------------------------------------------------
            /// <summary>
            /// Determines whether the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>.
            /// </summary>
            /// <param name="obj">The <see cref="T:System.Object"></see> to compare with the current <see cref="T:System.Object"></see>.</param>
            /// <returns>
            /// true if the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>; otherwise, false.
            /// </returns>
            /// --------------------------------------------------------------------------------
            public override bool Equals(object obj)
            {
                LanguageDisplayItem ldi = obj as LanguageDisplayItem;

                if (ldi != null)
                {
                    return(ldi.Locale == Locale && ldi.Name == Name);
                }

                return(false);
            }
コード例 #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Handles the SelectedIndexChanged event
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected override void OnSelectedIndexChanged(EventArgs e)
        {
            base.OnSelectedIndexChanged(e);
            // Change the current dialog on the fly, but don't touch the main program.
            LanguageDisplayItem ldi = (LanguageDisplayItem)SelectedItem;

            if (ldi.Locale != m_sNewUserWs)
            {
                m_sNewUserWs = ldi.Locale;
            }
        }
コード例 #3
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Adds the language.
 /// </summary>
 /// <param name="sLocale">The locale.</param>
 /// ------------------------------------------------------------------------------------
 private void AddLanguage(string sLocale)
 {
     if (IndexInList(sLocale, false) < 0)
     {
         LanguageDisplayItem ldi = new LanguageDisplayItem(sLocale);
         if (ldi.Name.Length == 0)
         {
             ldi.Name = ldi.Locale;                      // TODO: find a better fallback.
         }
         Items.Add(ldi);
     }
 }
コード例 #4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Adds the language.
        /// </summary>
        /// <param name="sLocale">The locale.</param>
        /// ------------------------------------------------------------------------------------
        private void AddLanguage(string sLocale)
        {
            Debug.Assert(!String.IsNullOrEmpty(sLocale));

            if (IndexInList(sLocale, false) < 0)
            {
                var ldi = new LanguageDisplayItem(sLocale);
                if (ldi.Name.Length == 0)
                {
                    ldi.Name = ldi.Locale;                      // TODO: find a better fallback.
                }
                Items.Add(ldi);
            }
        }
コード例 #5
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Determines whether the specified locale is in the chooser's list.
        /// </summary>
        /// <param name="locale">locale (i.e. culture) to look for.</param>
        /// <param name="allowMatchOnParentCulture">True to allow matches on a locale's parent
        /// culture (i.e. "en-US" = "en". Otherwise, don't match on just the parent
        /// culture.</param>
        /// ------------------------------------------------------------------------------------
        private int IndexInList(string locale, bool allowMatchOnParentCulture)
        {
            for (int i = 0; i < Items.Count; i++)
            {
                LanguageDisplayItem ldi = Items[i] as LanguageDisplayItem;
                if (ldi != null)
                {
                    if (ldi.Locale == locale)
                    {
                        return(i);
                    }
                    if (allowMatchOnParentCulture && ldi.Locale.StartsWith(locale))
                    {
                        return(i);
                    }
                }
            }

            return(-1);
        }
コード例 #6
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the language.
		/// </summary>
		/// <param name="sLocale">The locale.</param>
		/// ------------------------------------------------------------------------------------
		private void AddLanguage(string sLocale)
		{
			if (IndexInList(sLocale, false) < 0)
			{
				LanguageDisplayItem ldi = new LanguageDisplayItem(sLocale);
				if (ldi.Name.Length == 0)
					ldi.Name = ldi.Locale;	// TODO: find a better fallback.

				Items.Add(ldi);
			}
		}
コード例 #7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the language.
		/// </summary>
		/// <param name="sLocale">The locale.</param>
		/// ------------------------------------------------------------------------------------
		private void AddLanguage(string sLocale)
		{
			Debug.Assert(!String.IsNullOrEmpty(sLocale));

			if (IndexInList(sLocale, false) < 0)
			{
				var ldi = new LanguageDisplayItem(sLocale);
				if (ldi.Name.Length == 0)
					ldi.Name = ldi.Locale;	// TODO: find a better fallback.

				Items.Add(ldi);
			}
		}