private void SetProperties()
 {
     this.mImgSettings.ToolTip = (object)LocaleStrings.GetLocalizedString("STRING_MANAGE_NOTIFICATION", "");
     this.mImgMute.ToolTip     = (object)LocaleStrings.GetLocalizedString("STRING_MUTE_NOTIFICATION_TOOLTIP", "");
     this.mImgDismiss.ToolTip  = (object)LocaleStrings.GetLocalizedString("STRING_DISMISS_TOOLTIP", "");
     this.mLbl1Hour.Text       = LocaleStrings.GetLocalizedString("STRING_HOUR", "");
     this.mLbl1Day.Text        = LocaleStrings.GetLocalizedString("STRING_DAY", "");
     this.mLbl1Week.Text       = LocaleStrings.GetLocalizedString("STRING_WEEK", "");
     this.mLblForever.Text     = LocaleStrings.GetLocalizedString("STRING_FOREVER", "");
 }
Exemplo n.º 2
0
        public void ShowWindow()
        {
            string path1 = Path.Combine(RegistryManager.Instance.UserDefinedDir, "Client\\Helper");

            this.mMuteButton.ImageName  = Path.Combine(path1, "mute2.png");
            this.mCloseButton.ImageName = Path.Combine(path1, "close.png");
            this.mMuteButton.ToolTip    = (object)LocaleStrings.GetLocalizedString("STRING_MUTE_NOTIFICATION_TOOLTIP", "");
            this.mCloseButton.ToolTip   = (object)LocaleStrings.GetLocalizedString("STRING_CLOSE", "");
            this.Show();
        }
 public static string GetThemeName(string themeName)
 {
     try
     {
         if (File.Exists(BlueStacksUIColorManager.GetThemeFilePath(themeName)))
         {
             return(LocaleStrings.GetLocalizedString(BluestacksUIColor.Load(BlueStacksUIColorManager.GetThemeFilePath(themeName)).DictThemeAvailable["ThemeDisplayName"], ""));
         }
         throw new Exception("Theme file not found exception " + themeName);
     }
     catch (Exception ex)
     {
         Logger.Warning("Error checking for theme availability in Theme file " + themeName + Environment.NewLine + ex.ToString());
         return("");
     }
 }
Exemplo n.º 4
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value == null || parameter == null)
     {
         return(Binding.DoNothing);
     }
     string[] strArray = parameter.ToString().Split('|');
     if (strArray.Length != 2)
     {
         return(Binding.DoNothing);
     }
     flag = false;
     if (!(value is bool flag) && value is bool?nullable)
     {
         flag = nullable.HasValue && nullable.Value;
     }
     return(!flag ? (object)LocaleStrings.GetLocalizedString(strArray[1], "") : (object)LocaleStrings.GetLocalizedString(strArray[0], ""));
 }
Exemplo n.º 5
0
        public static void InitLocalization(
            string localeDir = null,
            string vmName    = "Android",
            bool skipLocalePickFromRegistry = false)
        {
            LocaleStrings.sResourceLocation    = localeDir != null ? localeDir : Path.Combine(RegistryManager.Instance.UserDefinedDir, "Locales");
            LocaleStrings.sDictLocalizedString = new Dictionary <string, string>((IEqualityComparer <string>)StringComparer.InvariantCultureIgnoreCase);
            LocaleStrings.Locale = LocaleStrings.GetLocaleName(vmName, skipLocalePickFromRegistry);
            BlueStacks.Common.Globalization.PopulateLocaleStrings(LocaleStrings.sResourceLocation, LocaleStrings.sDictLocalizedString, "en-US");
            if (string.Compare(LocaleStrings.Locale, "en-US", StringComparison.OrdinalIgnoreCase) != 0)
            {
                BlueStacks.Common.Globalization.PopulateLocaleStrings(LocaleStrings.sResourceLocation, LocaleStrings.sDictLocalizedString, LocaleStrings.Locale);
            }
            EventHandler sourceUpdatedEvent = LocaleStrings.SourceUpdatedEvent;

            if (sourceUpdatedEvent == null)
            {
                return;
            }
            sourceUpdatedEvent((object)"Locale_Updated", (EventArgs)null);
        }
Exemplo n.º 6
0
        public static string GetLocalizedString(string id, string fallbackValue = "")
        {
            if (id == null)
            {
                return(string.Empty);
            }
            string str = id.Trim();

            try
            {
                if (LocaleStrings.sDictLocalizedString == null)
                {
                    LocaleStrings.InitLocalization((string)null, "Android", false);
                }
                str = !LocaleStrings.sDictLocalizedString.ContainsKey(id.ToUpper(CultureInfo.InvariantCulture)) ? (!string.IsNullOrEmpty(fallbackValue) ? fallbackValue : LocaleStrings.RemoveConstants(id)) : LocaleStrings.sDictLocalizedString[id.ToUpper(CultureInfo.InvariantCulture)];
            }
            catch
            {
                Logger.Warning("Localized string not available for: {0}", (object)id);
            }
            return(str);
        }
        public static Binding GetLocaleBinding(string path)
        {
            Binding binding = new Binding()
            {
                Source = (object)BlueStacksUIBinding.Instance
            };
            string str = "";

            if (path != null)
            {
                foreach (char ch in path)
                {
                    str = str + "^" + ch.ToString();
                }
            }
            binding.Path                = new PropertyPath("Instance.LocaleModel.[" + str.ToUpper(CultureInfo.InvariantCulture) + "]", new object[0]);
            binding.Mode                = BindingMode.OneWay;
            binding.FallbackValue       = (object)LocaleStrings.RemoveConstants(path);
            binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            LocaleStrings.AppendLocaleIfDoesntExist(path, LocaleStrings.RemoveConstants(path));
            return(binding);
        }
Exemplo n.º 8
0
        private void BuildResolutionsList()
        {
            int width;
            int height;

            Utils.GetWindowWidthAndHeight(out width, out height);
            ObservableCollection <ResolutionModel> observableCollection = new ObservableCollection <ResolutionModel>();

            observableCollection.Add(new ResolutionModel()
            {
                OrientationType          = OrientationType.Landscape,
                OrientationName          = LocaleStrings.GetLocalizedString("STRING_ORIENTATION_LANDSCAPE", ""),
                AvailableResolutionsDict = new Dictionary <string, string>()
                {
                    {
                        "960 x 540",
                        "960 x 540"
                    },
                    {
                        "1280 x 720",
                        "1280 x 720"
                    },
                    {
                        "1600 x 900",
                        "1600 x 900"
                    },
                    {
                        "1920 x 1080",
                        "1920 x 1080"
                    },
                    {
                        "2560 x 1440",
                        "2560 x 1440"
                    }
                },
                CombinedResolution      = string.Format("{0} x {1}", (object)width, (object)height),
                SystemDefaultResolution = string.Format("{0} x {1}", (object)width, (object)height)
            });
            observableCollection.Add(new ResolutionModel()
            {
                OrientationType          = OrientationType.Portrait,
                OrientationName          = LocaleStrings.GetLocalizedString("STRING_ORIENTATION_PORTRAIT", ""),
                AvailableResolutionsDict = new Dictionary <string, string>()
                {
                    {
                        "960 x 540",
                        "540 x 960"
                    },
                    {
                        "1280 x 720",
                        "720 x 1280"
                    },
                    {
                        "1600 x 900",
                        "900 x 1600"
                    },
                    {
                        "1920 x 1080",
                        "1080 x 1920"
                    },
                    {
                        "2560 x 1440",
                        "1440 x 2560"
                    }
                },
                CombinedResolution      = string.Format("{0} x {1}", (object)width, (object)height),
                SystemDefaultResolution = string.Format("{0} x {1}", (object)height, (object)width)
            });
            observableCollection.Add(new ResolutionModel()
            {
                OrientationType          = OrientationType.Custom,
                OrientationName          = LocaleStrings.GetLocalizedString("STRING_CUSTOM1", ""),
                AvailableResolutionsDict = new Dictionary <string, string>(),
                CombinedResolution       = string.Format("{0} x {1}", (object)width, (object)height),
                SystemDefaultResolution  = string.Format("{0} x {1}", (object)width, (object)height)
            });
            this.ResolutionsList = observableCollection;
        }
Exemplo n.º 9
0
        public void SettingsBtn_Click(object sender, RoutedEventArgs e)
        {
            CustomSettingsButton customSettingsButton = (CustomSettingsButton)sender;

            if (customSettingsButton == null)
            {
                return;
            }
            customSettingsButton.IsSelected = true;
            UserControl control = this.SettingsWindowControlsDict[customSettingsButton.Name];

            Logger.Info("Clicked {0} button", (object)customSettingsButton.Name);
            this.BringToFront(control);
            if (customSettingsButton.Name.Equals("STRING_SHORTCUT_KEY_SETTINGS", StringComparison.OrdinalIgnoreCase))
            {
                Stats.SendMiscellaneousStatsAsync("KeyboardShortcuts", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "shortcut_open", (string)null, (string)null, (string)null, (string)null, (string)null, "Android", 0);
            }
            else
            {
                Stats.SendMiscellaneousStatsAsync("settings", RegistryManager.Instance.UserGuid, LocaleStrings.GetLocalizedString(customSettingsButton.Name, ""), "MouseClick", RegistryManager.Instance.ClientVersion, Oem.Instance.OEM, (string)null, (string)null, (string)null, "Android", 0);
            }
        }
Exemplo n.º 10
0
 public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
 {
     return(values == null ? (object)string.Empty : (object)LocaleStrings.GetLocalizedString(values[0].ToString(), ""));
 }
Exemplo n.º 11
0
        public static string AssignErrorStringForInstallerExitCodes(
            int mInstallFailedErrorCode,
            string prefixKey)
        {
            string str1 = LocaleStrings.GetLocalizedString(prefixKey, "");
            string str2 = ((InstallerCodes)mInstallFailedErrorCode).ToString();
            string str3 = string.Empty;
            bool   flag = true;

            if (prefixKey != "STRING_ROLLBACK_FAILED_SORRY_MESSAGE")
            {
                switch (mInstallFailedErrorCode)
                {
                case -59:
                case -58:
                    str3 = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}\n{1}", (object)LocaleStrings.GetLocalizedString("STRING_OLD_INSTALLATION_INTERFERING", ""), (object)LocaleStrings.GetLocalizedString("STRING_TRY_RESTARTING_MACHINE", ""));
                    break;

                case -55:
                case -54:
                case -53:
                case -52:
                    str3 = LocaleStrings.GetLocalizedString("STRING_COULDNT_RESTORE_UNUSABLE", "");
                    break;

                case -51:
                case -49:
                case -43:
                case -42:
                case -41:
                case -40:
                case -39:
                case -38:
                case -37:
                case -36:
                case -35:
                case -33:
                    str3 = LocaleStrings.GetLocalizedString("STRING_ERROR_OCCURED_DEPLOYING_FILES", "");
                    break;

                case -46:
                case -45:
                case -44:
                case -32:
                    str3 = LocaleStrings.GetLocalizedString("STRING_FAILED_TO_RESTORE_OLD_DATA", "");
                    break;

                case -30:
                    str3 = LocaleStrings.GetLocalizedString("STRING_OLD_INSTALLATION_INTERFERING", "");
                    break;

                case -19:
                    str3 = LocaleStrings.GetLocalizedString("STRING_HYPERV_DISABLED_WARNING", "");
                    flag = false;
                    str1 = string.Empty;
                    break;

                case -18:
                    str3 = LocaleStrings.GetLocalizedString("STRING_HYPERV_INSTALLER_WARNING", "");
                    flag = false;
                    str1 = string.Empty;
                    break;

                case -17:
                    str3 = LocaleStrings.GetLocalizedString("STRING_DISABLED_VT", "");
                    flag = false;
                    str1 = string.Empty;
                    break;

                case -14:
                    str3 = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0} {1}", (object)LocaleStrings.GetLocalizedString("STRING_INSUFFICIENT_DISKSPACE", ""), (object)string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}GB", (object)5L));
                    break;

                default:
                    string id = "STRING_" + str2;
                    str3 = LocaleStrings.GetLocalizedString(id, "");
                    if (str3.Equals(id, StringComparison.InvariantCultureIgnoreCase))
                    {
                        str3 = LocaleStrings.GetLocalizedString("STRING_ERROR_OCCURED_DEPLOYING_FILES", "");
                        break;
                    }
                    break;
                }
            }
            if (Enumerable.Range(-30, 20).Contains <int>(mInstallFailedErrorCode) & flag)
            {
                str3 = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0} {1}", (object)LocaleStrings.GetLocalizedString("STRING_PREINSTALL_FAIL", ""), (object)str3);
            }
            return(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}\n{1}\n\n{2} {3}", (object)str1, (object)str3, (object)LocaleStrings.GetLocalizedString("STRING_ERROR_CODE_COLON", ""), (object)str2).TrimStart('\n'));
        }