private void InitializeComponents() { int height = 70; int width = 220; this.SuspendLayout(); this.StartPosition = FormStartPosition.CenterScreen; this.Icon = Utils.GetApplicationIcon(); this.Text = Oem.Instance.BlueStacksApkHandlerTitle; this.SizeGripStyle = SizeGripStyle.Hide; this.ShowIcon = true; this.MaximizeBox = false; this.MinimizeBox = false; this.ShowInTaskbar = true; this.FormBorderStyle = FormBorderStyle.FixedDialog; this.ClientSize = new Size(width, height); this.m_Label = new Label(); this.m_Label.Location = new Point(width / 4, 5); this.m_Label.Size = new Size(width, 35); this.m_Label.Text = LocaleStrings.GetLocalizedString("STRING_USER_WAIT", ""); this.m_ProgressBar = new ProgressBar(); this.m_ProgressBar.Location = new Point(width / 4, 40); this.m_ProgressBar.Size = new Size(width / 2, 20); this.m_ProgressBar.Style = ProgressBarStyle.Marquee; this.m_ProgressBar.MarqueeAnimationSpeed = 25; this.Controls.Add((Control)this.m_Label); this.Controls.Add((Control)this.m_ProgressBar); this.ResumeLayout(false); this.PerformLayout(); Logger.Info("HDApkInstaller: Components Initialized"); }
protected override void Save(object param) { if (this.Status == Status.Progress) { Logger.Info("Compatibility check is running"); } else if (this.IsRestartRequired()) { if (Oem.IsOEMDmm) { this.RestartInstanceHandler(); this.ParentWindow.Close(); } else { CustomMessageWindow customMessageWindow = new CustomMessageWindow(); customMessageWindow.Owner = this.Owner; customMessageWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; customMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_RESTART_BLUESTACKS", ""); customMessageWindow.BodyTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_RESTART_BLUESTACKS_MESSAGE", ""); customMessageWindow.AddButton(ButtonColors.Blue, "STRING_RESTART_NOW", (EventHandler)((o, e) => { this.RestartInstanceHandler(); BlueStacksUIUtils.RestartInstance(this._VmName, false); }), (string)null, false, (object)null, true); customMessageWindow.AddButton(ButtonColors.White, "STRING_DISCARD_CHANGES", (EventHandler)((o, e) => this.Init()), (string)null, false, (object)null, true); customMessageWindow.ShowDialog(); } } else { this.SaveEngineSettings(""); this.AddToastPopupUserControl(LocaleStrings.GetLocalizedString("STRING_CHANGES_SAVED", "")); } }
private void DeleteScriptImg_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { MacroRecording currentRecording = MacroGraph.Instance.Vertices.Cast <MacroRecording>().Where <MacroRecording>((Func <MacroRecording, bool>)(macro => string.Equals(macro.Name, this.mRecording.Name, StringComparison.InvariantCultureIgnoreCase))).FirstOrDefault <MacroRecording>(); if (currentRecording == null) { return; } if (currentRecording.Parents.Count > 0) { this.mDeleteScriptMessageWindow = new CustomMessageWindow(); this.mDeleteScriptMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_DELETE_DEPENDENT_MACRO", ""); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(LocaleStrings.GetLocalizedString("STRING_MACRO_IN_USE_BY_OTHER_MACROS", "")); stringBuilder.Append(" "); stringBuilder.Append(string.Format((IFormatProvider)CultureInfo.InvariantCulture, LocaleStrings.GetLocalizedString("STRING_MACRO_LOSE_CONFIGURABILITY", ""), (object)this.mRecording.Name)); this.mDeleteScriptMessageWindow.BodyTextBlock.Text = stringBuilder.ToString(); this.mDeleteScriptMessageWindow.AddButton(ButtonColors.Red, LocaleStrings.GetLocalizedString("STRING_DELETE_ANYWAY", ""), (EventHandler)((o, evt) => { for (int i = currentRecording.Parents.Count - 1; i >= 0; i--) { MacroRecording macroRecording = MacroGraph.Instance.Vertices.Cast <MacroRecording>().Where <MacroRecording>((Func <MacroRecording, bool>)(macro => macro.Equals((object)currentRecording.Parents[i]))).FirstOrDefault <MacroRecording>(); this.mMacroRecorderWindow.FlattenRecording(currentRecording.Parents[i] as MacroRecording, false); CommonHandlers.SaveMacroJson(currentRecording.Parents[i] as MacroRecording, (currentRecording.Parents[i] as MacroRecording).Name + ".json"); foreach (SingleMacroControl child in this.mMacroRecorderWindow.mScriptsStackPanel.Children) { if (child.mRecording.Name.ToLower(CultureInfo.InvariantCulture).Trim() == macroRecording.Name.ToLower(CultureInfo.InvariantCulture).Trim()) { child.mScriptSettingsImg.ImageName = "macro_settings"; } } MacroGraph.Instance.DeLinkMacroChild((BiDirectionalVertex <MacroRecording>)(currentRecording.Parents[i] as MacroRecording)); } this.DeleteMacroScript(); CommonHandlers.RefreshAllMacroRecorderWindow(); }), (string)null, false, (object)null, true); this.mDeleteScriptMessageWindow.AddButton(ButtonColors.White, LocaleStrings.GetLocalizedString("STRING_DONT_DELETE", ""), (EventHandler)((o, evt) => {}), (string)null, false, (object)null, true); this.mDeleteScriptMessageWindow.CloseButtonHandle((EventHandler)((o, evt) => {}), (object)null); this.mDeleteScriptMessageWindow.Owner = (Window)this.ParentWindow; this.mDeleteScriptMessageWindow.ShowDialog(); } else if (!this.ParentWindow.EngineInstanceRegistry.ShowMacroDeletePopup) { this.DeleteMacroScript(); } else { this.mDeleteScriptMessageWindow = new CustomMessageWindow(); this.mDeleteScriptMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_DELETE_MACRO", ""); this.mDeleteScriptMessageWindow.BodyTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_DELETE_SCRIPT", ""); this.mDeleteScriptMessageWindow.CheckBox.Content = (object)LocaleStrings.GetLocalizedString("STRING_DOWNLOAD_GOOGLE_APP_POPUP_STRING_04", ""); this.mDeleteScriptMessageWindow.CheckBox.Visibility = Visibility.Visible; this.mDeleteScriptMessageWindow.CheckBox.IsChecked = new bool?(false); this.mDeleteScriptMessageWindow.AddButton(ButtonColors.Red, LocaleStrings.GetLocalizedString("STRING_DELETE", ""), new EventHandler(this.FlattenTargetMacrosAndDeleteSourceMacro), (string)null, false, (object)null, true); this.mDeleteScriptMessageWindow.AddButton(ButtonColors.White, LocaleStrings.GetLocalizedString("STRING_CANCEL", ""), (EventHandler)((o, evt) => this.ParentWindow.EngineInstanceRegistry.ShowMacroDeletePopup = !this.mDeleteScriptMessageWindow.CheckBox.IsChecked.Value), (string)null, false, (object)null, true); this.mDeleteScriptMessageWindow.CloseButtonHandle((EventHandler)((o, evt) => {}), (object)null); this.mDeleteScriptMessageWindow.Owner = (Window)this.ParentWindow; this.mDeleteScriptMessageWindow.ShowDialog(); } }
private void SetContent() { BlueStacksUIBinding.Bind(this.mEnableVt.mTitleText, "STRING_ENABLE_VIRT", ""); BlueStacksUIBinding.Bind(this.mEnableVt.mBodyText, "STRING_ENABLE_VIRT_BODY", ""); this.mEnableVt.mHyperLink.Inlines.Clear(); this.mEnableVt.mHyperLink.Inlines.Add(LocaleStrings.GetLocalizedString("STRING_ENABLE_VIRT_HYPERLINK", "")); this.mEnableVt.mImage.ImageName = "virtualization"; BlueStacksUIBinding.Bind(this.mDiasbleHyperV.mTitleText, "STRING_DISABLE_HYPERV", ""); BlueStacksUIBinding.Bind(this.mDiasbleHyperV.mBodyText, "STRING_DISABLE_HYPERV_BODY", ""); this.mDiasbleHyperV.mHyperLink.Inlines.Clear(); this.mDiasbleHyperV.mHyperLink.Inlines.Add(LocaleStrings.GetLocalizedString("STRING_DISABLE_HYPERV_HYPERLINK", "")); this.mDiasbleHyperV.mImage.ImageName = "hypervisor"; BlueStacksUIBinding.Bind(this.mConfigureAntivirus.mTitleText, "STRING_CONFIGURE_ANTIVIRUS", ""); BlueStacksUIBinding.Bind(this.mConfigureAntivirus.mBodyText, "STRING_CONFIGURE_ANTIVIRUS_BODY", ""); this.mConfigureAntivirus.mHyperLink.Inlines.Clear(); this.mConfigureAntivirus.mHyperLink.Inlines.Add(LocaleStrings.GetLocalizedString("STRING_CONFIGURE_ANTIVIRUS_HYPERLINK", "")); this.mConfigureAntivirus.mImage.ImageName = "antivirus"; BlueStacksUIBinding.Bind(this.mPowerPlan.mTitleText, "STRING_POWER_PLAN", ""); BlueStacksUIBinding.Bind(this.mPowerPlan.mBodyText, "STRING_POWER_PLAN_BODY", ""); this.mPowerPlan.mHyperLink.Inlines.Clear(); this.mPowerPlan.mHyperLink.Inlines.Add(LocaleStrings.GetLocalizedString("STRING_POWER_PLAN_HYPERLINK", "")); this.mPowerPlan.mImage.ImageName = "powerplan"; BlueStacksUIBinding.Bind(this.mUpgradeComputer.mTitleText, "STRING_UPGRADE_SYSTEM", ""); BlueStacksUIBinding.Bind(this.mUpgradeComputer.mBodyText, "STRING_UPGRADE_SYSTEM_BODY", ""); this.mUpgradeComputer.mHyperLink.Inlines.Clear(); this.mUpgradeComputer.mHyperLink.Inlines.Add(LocaleStrings.GetLocalizedString("STRING_UPGRADE_SYSTEM_HYPERLINK", "")); this.mUpgradeComputer.mImage.ImageName = "upgrade"; }
private string CheckIfDependentScriptsHaveInvalidName(ImportMacroScriptsControl scriptControl) { string str = "TEXT_VALID"; foreach (UIElement child1 in scriptControl.mDependentScriptsPanel.Children) { CustomTextBox customTextBox = child1 as CustomTextBox; string text = customTextBox.Text; if (text.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0) { customTextBox.InputTextValidity = TextValidityOptions.Error; str = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0} {1} {2}", (object)LocaleStrings.GetLocalizedString("STRING_MACRO_NAME_ERROR", ""), (object)Environment.NewLine, (object)"\\ / : * ? \" < > |"); } else if (((IEnumerable <string>)Constants.ReservedFileNamesList).Contains <string>(text.Trim().ToLower(CultureInfo.InvariantCulture))) { customTextBox.InputTextValidity = TextValidityOptions.Error; str = LocaleStrings.GetLocalizedString("STRING_MACRO_FILE_NAME_ERROR", ""); } else if (scriptControl.IsScriptInRenameMode()) { foreach (MacroRecording vertex in (Collection <BiDirectionalVertex <MacroRecording> >)MacroGraph.Instance.Vertices) { if (vertex.Name.ToLower(CultureInfo.InvariantCulture).Trim() == text.ToLower(CultureInfo.InvariantCulture).Trim()) { customTextBox.InputTextValidity = TextValidityOptions.Error; return(LocaleStrings.GetLocalizedString("STRING_DUPLICATE_MACRO_NAME_WARNING", "")); } } foreach (ImportMacroScriptsControl child2 in this.mScriptsStackPanel.Children) { if (child2 != scriptControl && scriptControl.IsScriptInRenameMode()) { bool?isChecked = child2.mContent.IsChecked; bool flag = true; if (isChecked.GetValueOrDefault() == flag & isChecked.HasValue) { if (child2.mImportName.Text.ToLower(CultureInfo.InvariantCulture).Trim() == text.ToLower(CultureInfo.InvariantCulture).Trim()) { customTextBox.InputTextValidity = TextValidityOptions.Error; str = LocaleStrings.GetLocalizedString("STRING_DUPLICATE_MACRO_NAME_WARNING", ""); } else { foreach (UIElement child3 in child2.mDependentScriptsPanel.Children) { if ((child3 as CustomTextBox).Text.ToLower(CultureInfo.InvariantCulture).Trim() == text.ToLower(CultureInfo.InvariantCulture).Trim()) { customTextBox.InputTextValidity = TextValidityOptions.Error; str = LocaleStrings.GetLocalizedString("STRING_DUPLICATE_MACRO_NAME_WARNING", ""); break; } } } } } } } } return(str); }
private void DeleteImg_MouseDown(object sender, MouseButtonEventArgs e) { if (!this.mSchemeName.IsReadOnly) { this.HandleNameEdit(this); } if (!this.ParentWindow.EngineInstanceRegistry.ShowSchemeDeletePopup) { this.DeleteControlScheme(); e.Handled = true; } else { this.mDeleteScriptMessageWindow = new CustomMessageWindow(); this.mDeleteScriptMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_DELETE_SCHEME", ""); this.mDeleteScriptMessageWindow.BodyTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_DELETE_SCHEME_CONFIRMATION", ""); this.mDeleteScriptMessageWindow.CheckBox.Content = (object)LocaleStrings.GetLocalizedString("STRING_DOWNLOAD_GOOGLE_APP_POPUP_STRING_04", ""); this.mDeleteScriptMessageWindow.CheckBox.Visibility = Visibility.Visible; this.mDeleteScriptMessageWindow.CheckBox.IsChecked = new bool?(false); this.mDeleteScriptMessageWindow.AddButton(ButtonColors.Blue, LocaleStrings.GetLocalizedString("STRING_DELETE", ""), new EventHandler(this.UpdateSettingsAndDeleteScheme), (string)null, false, (object)null, true); this.mDeleteScriptMessageWindow.AddButton(ButtonColors.White, LocaleStrings.GetLocalizedString("STRING_CANCEL", ""), (EventHandler)((o, evt) => { KeymapCanvasWindow.sIsDirty = false; GuidanceWindow.sIsDirty = false; }), (string)null, false, (object)null, true); this.mDeleteScriptMessageWindow.CloseButtonHandle((EventHandler)((o, evt) => {}), (object)null); this.mDeleteScriptMessageWindow.Owner = (Window)this.CanvasWindow; this.mDeleteScriptMessageWindow.ShowDialog(); e.Handled = true; } }
private void BGCreateNewInstance_RunWorkerCompleted( object sender, RunWorkerCompletedEventArgs e) { if (!(e.Result is Dictionary <string, string> result)) { return; } if (result["status"].Equals("success", StringComparison.InvariantCultureIgnoreCase)) { InstalledOem.SetInstalledCoexistingOems(); RegistryManager.RegistryManagers[this.currentDownloadingOem.AppPlayerOem].Guest[result["vmname"]].DisplayName = Strings.ProductDisplayName + " " + Utils.GetVmIdFromVmName(result["vmname"]) + " " + this.currentDownloadingOem.Suffix; Publisher.PublishMessage(BrowserControlTags.oemInstallCompleted, this.ParentWindow.mVmName, (JObject)null); } else { if (!result["status"].Equals("fail", StringComparison.InvariantCultureIgnoreCase)) { return; } Publisher.PublishMessage(BrowserControlTags.oemInstallFailed, this.ParentWindow.mVmName, new JObject() { ["MessageTitle"] = (JToken)LocaleStrings.GetLocalizedString("STRING_INSTALL_FAIL", ""), ["MessageBody"] = (JToken)LocaleStrings.GetLocalizedString("STRING_INSTALLATION_FAILED", ""), ["ActionType"] = (JToken)"failed" }); } }
private void DiskCleanupBtn_Click(object sender, RoutedEventArgs e) { this.ParentWindow.Dispatcher.Invoke((Delegate)(() => { if (ProcessUtils.IsAlreadyRunning("Global\\BlueStacks_DiskCompactor_Lockbgp")) { CustomMessageWindow customMessageWindow = new CustomMessageWindow(); customMessageWindow.ImageName = "disk_cleanup_popup_window"; customMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_DISK_CLEANUP_MULTIPLE_RUN_HEADING", ""); customMessageWindow.BodyTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_DISK_CLEANUP_MULTIPLE_RUN_MESSAGE", ""); customMessageWindow.AddButton(ButtonColors.Blue, "STRING_OK", (EventHandler)null, (string)null, false, (object)null, true); customMessageWindow.CloseButtonHandle((Predicate <object>)null, (object)null); customMessageWindow.Owner = (Window)this.ParentWindow; customMessageWindow.ShowDialog(); } else { CustomMessageWindow customMessageWindow = new CustomMessageWindow(); customMessageWindow.ImageName = "disk_cleanup_popup_window"; customMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_DISK_CLEANUP", ""); customMessageWindow.BodyTextBlockTitle.Text = LocaleStrings.GetLocalizedString("STRING_DISK_CLEANUP_MESSAGE", ""); customMessageWindow.BodyTextBlockTitle.Visibility = Visibility.Visible; customMessageWindow.BodyTextBlockTitle.FontWeight = FontWeights.Regular; customMessageWindow.BodyTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_CONTINUE_CONFIRMATION", ""); customMessageWindow.AddButton(ButtonColors.White, "STRING_CLOSE", (EventHandler)null, (string)null, false, (object)null, true); customMessageWindow.AddButton(ButtonColors.Blue, "STRING_CONTINUE", (EventHandler)((sender1, e1) => this.LaunchDiskCompaction(sender, (MouseButtonEventArgs)null)), (string)null, false, (object)null, true); customMessageWindow.CloseButtonHandle((Predicate <object>)null, (object)null); customMessageWindow.Owner = (Window)this.ParentWindow; customMessageWindow.ShowDialog(); } })); }
private bool AddAppNames() { try { Logger.Info("In Method AddAppNames"); Logger.Info("Getting installed apps"); Logger.Info("Requesting Agent"); new Dictionary <string, string>() { { "vmname", MultiInstanceStrings.VmName } }; List <BlueStacks.Common.AppInfo> list = ((IEnumerable <BlueStacks.Common.AppInfo>) new JsonParser(BlueStacks.Common.Strings.CurrentDefaultVmName).GetAppList()).ToList <BlueStacks.Common.AppInfo>(); int count = list.Count; AppInfo[] array = new AppInfo[count]; if (array == null || array.Length == 0) { Logger.Info("AppInfo null"); return(false); } for (int index = 0; index < count; ++index) { array[index] = new AppInfo(list[index].Name, list[index].Package, list[index].Version); array[index].name = Regex.Replace(array[index].name, "\\t|\\n|\\r", string.Empty); } foreach (AppInfo appInfo in array) { if (string.IsNullOrEmpty(appInfo.name) || string.IsNullOrEmpty(appInfo.package)) { Logger.Info("Empty app name or package"); return(false); } Logger.Info("App Package Name: " + appInfo.package + " App Name: " + appInfo.name); } Array.Sort <AppInfo>(array, (Comparison <AppInfo>)((x, y) => string.Compare(x.name, y.name, StringComparison.Ordinal))); ComboBoxItem comboBoxItem1 = new ComboBoxItem(); comboBoxItem1.Content = (object)LocaleStrings.GetLocalizedString("STRING_SELECT", ""); comboBoxItem1.Tag = (object)null; this.mAppListComboBox.Items.Add((object)comboBoxItem1); foreach (AppInfo appInfo in array) { ComboBoxItem comboBoxItem2 = new ComboBoxItem(); comboBoxItem2.Content = (object)Regex.Replace(appInfo.name, "\\t|\\n|\\r", string.Empty); comboBoxItem2.Tag = (object)Regex.Replace(appInfo.package, "\\t|\\n|\\r", string.Empty); this.mAppListComboBox.Items.Add((object)comboBoxItem2); } ComboBoxItem comboBoxItem3 = new ComboBoxItem(); comboBoxItem3.Content = (object)"Other"; comboBoxItem3.Tag = (object)"Other"; this.mAppListComboBox.Items.Add((object)comboBoxItem3); return(true); } catch (Exception ex) { Logger.Error(string.Format((IFormatProvider)CultureInfo.CurrentCulture, "Error Occured, Err: {0}", (object)ex.ToString())); return(false); } }
private void KeyPropertyNameTextBox_IsVisibleChanged( object _1, DependencyPropertyChangedEventArgs _2) { if (this.mKeyPropertyNameTextBox.IsVisible) { return; } string key = this.ActionItemProperty; if (this.ActionItemProperty.EndsWith("_alt1", StringComparison.InvariantCulture)) { int length = this.ActionItemProperty.IndexOf("_alt1", StringComparison.InvariantCulture); if (length > 0) { key = this.ActionItemProperty.Substring(0, length); } } if (string.Equals(LocaleStrings.GetLocalizedString("STRING_ENTER_GUIDANCE_TEXT", ""), this.mKeyPropertyNameTextBox.Text, StringComparison.InvariantCultureIgnoreCase) || string.IsNullOrEmpty(this.mKeyPropertyNameTextBox.Text.Trim())) { foreach (IMAction imAction in this.lstActionItem) { imAction.Guidance.Remove(key); } } else { KeymapCanvasWindow.sIsDirty = true; foreach (IMAction imAction in this.lstActionItem) { imAction.Guidance[key] = this.mKeyPropertyNameTextBox.Text; } this.ParentWindow.SelectedConfig.AddString(this.mKeyPropertyNameTextBox.Text); } }
private void AbleDisableAppName(bool showDropdown) { Logger.Info("In Method AbleDisableAppName"); Logger.Info("Show apps list dropdown: " + showDropdown.ToString()); if (showDropdown) { this.mAppListComboBox.Items.Clear(); if (!this.AddAppNames()) { Logger.Info("AddAppNames returns false"); this.mAppNameGrid.Visibility = Visibility.Visible; this.mAppListComboBox.Visibility = Visibility.Collapsed; this.mAppNameTitle.Text = LocaleStrings.GetLocalizedString("STRING_APP_NAME", ""); } else { Logger.Info("AddAppNames returns true"); this.mAppNameGrid.Visibility = Visibility.Collapsed; this.mAppListComboBox.Visibility = Visibility.Visible; this.mAppNameTitle.Text = LocaleStrings.GetLocalizedString("STRING_SELECT_APP_NAME", ""); this.mAppListComboBox.SelectedIndex = 0; } } else { Logger.Info("User not selected App not working"); this.mAppListComboBox.Visibility = Visibility.Collapsed; this.mAppNameGrid.Visibility = Visibility.Visible; } }
private void RunBinary(string fileName, string args, string text, string title) { try { Logger.Info("In method RunBinary"); string str = Path.Combine(RegistryStrings.InstallDir, fileName); using (Process process = new Process()) { process.StartInfo.FileName = str; process.StartInfo.Arguments = args; process.EnableRaisingEvents = true; process.Disposed += (EventHandler)((sender, e) => this.Dispatcher.Invoke((Delegate)(() => { this.Visibility = Visibility.Hidden; this.ShowInTaskbar = false; if (!Oem.Instance.IsHideMessageBoxIconInTaskBar) { CustomMessageWindow customMessageWindow = new CustomMessageWindow(); customMessageWindow.TitleTextBlock.Text = title; customMessageWindow.BodyTextBlock.Text = text; customMessageWindow.AddButton(ButtonColors.Blue, LocaleStrings.GetLocalizedString("STRING_OK", ""), (EventHandler)null, (string)null, false, (object)null, true); customMessageWindow.ShowDialog(); } this.Close(); }))); process.Start(); } } catch (Exception ex) { Logger.Error("Error occured, Err: {0}", (object)ex.ToString()); } }
private void TroubleshootIfPossible(string subCategory) { Logger.Info("In method TroubleshootIfPossible"); if (subCategory.Contains("RPCError")) { Logger.Info("RPC Error detected"); CustomMessageWindow customMessageWindow = new CustomMessageWindow(); customMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_RPC_FORM", ""); customMessageWindow.BodyTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_TROUBLESHOOTER", ""); customMessageWindow.AddButton(ButtonColors.Blue, LocaleStrings.GetLocalizedString("STRING_RESOLVE_AUTOMATIC", ""), new EventHandler(this.TroubleshootRPCConfirmationHandler), (string)null, false, (object)null, true); customMessageWindow.AddButton(ButtonColors.White, LocaleStrings.GetLocalizedString("STRING_CANCEL", ""), (EventHandler)null, (string)null, false, (object)null, true); customMessageWindow.Owner = (Window)this; customMessageWindow.ShowDialog(); } else { if (!subCategory.Contains("StuckOnLoading") && !subCategory.Contains("GreyScreen")) { return; } Logger.Info("Stuck on loading detected"); CustomMessageWindow customMessageWindow = new CustomMessageWindow(); customMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_STUCK_AT_INITIALIZING_FORM", ""); customMessageWindow.BodyTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_TROUBLESHOOTER", ""); customMessageWindow.AddButton(ButtonColors.Blue, LocaleStrings.GetLocalizedString("STRING_RESOLVE_AUTOMATIC", ""), new EventHandler(this.TroubleshootStuckConfirmationHandler), (string)null, false, (object)null, true); customMessageWindow.AddButton(ButtonColors.White, LocaleStrings.GetLocalizedString("STRING_CANCEL", ""), (EventHandler)null, (string)null, false, (object)null, true); customMessageWindow.Owner = (Window)this; customMessageWindow.ShowDialog(); } }
private void PerformSaveInstanceNameOperations() { try { this.ReadOnlyInstanceName = true; this.SetFocusOnInstanceName = false; if (this.EditInstanceImage == "macro_name_save") { this.InstanceName = string.IsNullOrEmpty(this.InstanceName.Trim()) ? this.mLastVmDisplayName : this.InstanceName.Trim(); if (!this.InstanceName.IsValidFileName()) { string str = LocaleStrings.GetLocalizedString("STRING_INSTANCE_NAME_ERROR", "") + " \n \\ / : * ? \" < > |"; Messenger.Default.Send <ToastPopupMessage>(new ToastPopupMessage() { Message = str, Duration = 3.0, IsShowCloseImage = true }); this.InstanceName = this.mLastVmDisplayName; } if (this.mLastVmDisplayName.Trim() != this.InstanceName) { Messenger.Default.Send <InstanceOperationMessage>(new InstanceOperationMessage() { Operation = Operation.VerifyInstanceName, VmName = this.mVmName, LastVMName = this.mLastVmDisplayName, NewVmDisplayName = this.InstanceName }); if (!this.mIsDisplayNameVerified) { string str = LocaleStrings.GetLocalizedString("STRING_INSTANCE_NAME_ALREADY_EXISTS", "") ?? ""; Messenger.Default.Send <ToastPopupMessage>(new ToastPopupMessage() { Message = str, Duration = 3.0, IsShowCloseImage = true }); this.InstanceName = this.mLastVmDisplayName; } } RegistryManager.RegistryManagers[this.OEM].Guest[this.VmName].DisplayName = this.InstanceName; this.mInstanceDisplayName = this.InstanceName; if (!string.IsNullOrEmpty(this.InstanceName) && this.mLastVmDisplayName != this.InstanceName) { Messenger.Default.Send <InstanceOperationMessage>(new InstanceOperationMessage() { Operation = Operation.UpdateInstanceName, VmName = this.mVmName, LastVMName = this.mLastVmDisplayName }); } } this.EditInstanceImage = "edit_icon"; } catch (Exception ex) { Logger.Error("Error in naming instance : " + ex?.ToString()); } }
private void AddElement(ShortcutKeys ele) { ShortcutKeyControlElement keyControlElement = new ShortcutKeyControlElement(this.ParentWindow, this.ParentSettingsWindow); BlueStacksUIBinding.Bind(keyControlElement.mShortcutNameTextBlock, ele.ShortcutName, ""); string[] strArray = ele.ShortcutKey.Split(new char[2] { '+', ' ' }, StringSplitOptions.RemoveEmptyEntries); string str = string.Empty; foreach (string key in strArray) { str = str + LocaleStrings.GetLocalizedString(Constants.ImapLocaleStringsConstant + IMAPKeys.GetStringForUI(key), "") + " + "; } this.mShortcutUIElements[ele.ShortcutCategory].Item2.Add(keyControlElement); if (!string.IsNullOrEmpty(str)) { keyControlElement.mShortcutKeyTextBox.Text = str.Substring(0, str.Length - 3); } keyControlElement.mUserDefinedConfigList = new List <ShortcutKeys>() { ele }; if (!ele.ReadOnlyTextbox) { return; } keyControlElement.mShortcutKeyTextBox.IsEnabled = false; }
protected override void Save(object param) { if (Oem.IsOEMDmm) { this.SaveDisplaySetting(); BlueStacksUIUtils.CloseContainerWindow((FrameworkElement)this); this.ParentWindow.Close(); } else { if (!this.IsDirty()) { return; } CustomMessageWindow customMessageWindow = new CustomMessageWindow(); customMessageWindow.Owner = (Window)this.ParentWindow; customMessageWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; customMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_RESTART_BLUESTACKS", ""); customMessageWindow.BodyTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_RESTART_BLUESTACKS_MESSAGE", ""); customMessageWindow.AddButton(ButtonColors.Blue, "STRING_RESTART_NOW", (EventHandler)((o, e) => { this.SaveDisplaySetting(); if (BlueStacksUIUtils.DictWindows.Count == 1) { App.defaultResolution = new Fraction((long)RegistryManager.Instance.Guest[Strings.CurrentDefaultVmName].GuestWidth, (long)RegistryManager.Instance.Guest[Strings.CurrentDefaultVmName].GuestHeight); PromotionManager.ReloadPromotionsAsync(); } BlueStacksUIUtils.CloseContainerWindow((FrameworkElement)this); BlueStacksUIUtils.RestartInstance(this.VmName, false); }), (string)null, false, (object)null, true); customMessageWindow.AddButton(ButtonColors.White, "STRING_DISCARD_CHANGES", (EventHandler)((o, e) => this.DiscardCurrentChangingModel()), (string)null, false, (object)null, true); customMessageWindow.ShowDialog(); } }
private void CreateShortcutCategory(string categoryName) { if (this.mShortcutUIElements.ContainsKey(categoryName)) { return; } string localizedString = LocaleStrings.GetLocalizedString(categoryName, ""); GroupBox groupBox1 = new GroupBox(); groupBox1.Content = (object)new StackPanel(); groupBox1.Header = (object)localizedString; groupBox1.Tag = (object)categoryName; groupBox1.Margin = new Thickness(0.0, 20.0, 0.0, 0.0); groupBox1.FontSize = 16.0; GroupBox groupBox2 = groupBox1; BlueStacksUIBinding.BindColor((DependencyObject)groupBox2, Control.ForegroundProperty, "SettingsWindowTabMenuItemLegendForeground"); groupBox2.BorderThickness = new Thickness(0.0); TextBlock textBlock = new TextBlock(); textBlock.Text = localizedString; textBlock.Tag = (object)categoryName; textBlock.FontStretch = FontStretches.ExtraExpanded; textBlock.HorizontalAlignment = HorizontalAlignment.Center; textBlock.Margin = new Thickness(0.0, 0.0, 0.0, 10.0); textBlock.TextWrapping = TextWrapping.WrapWithOverflow; BlueStacksUIBinding.BindColor((DependencyObject)textBlock, TextBlock.ForegroundProperty, "SettingsWindowTabMenuItemLegendForeground"); this.mShortcutUIElements.Add(categoryName, new BlueStacks.Common.Tuple <GroupBox, List <ShortcutKeyControlElement> >(groupBox2, new List <ShortcutKeyControlElement>())); }
private bool CheckIfEditedMacroNameIsAllowed(string text, ImportMacroScriptsControl item) { if (string.IsNullOrEmpty(text.Trim())) { BlueStacksUIBinding.Bind(item.mWarningMsg, LocaleStrings.GetLocalizedString("STRING_MACRO_NAME_NULL_MESSAGE", ""), ""); return(false); } foreach (MacroRecording vertex in (Collection <BiDirectionalVertex <MacroRecording> >)MacroGraph.Instance.Vertices) { if (vertex.Name.ToLower(CultureInfo.InvariantCulture).Trim() == text.ToLower(CultureInfo.InvariantCulture).Trim()) { return(false); } } foreach (ImportMacroScriptsControl child in this.mScriptsStackPanel.Children) { if (item != child) { bool?isChecked = child.mContent.IsChecked; bool flag = true; if (isChecked.GetValueOrDefault() == flag & isChecked.HasValue && child.IsScriptInRenameMode() && child.mImportName.Text.ToLower(CultureInfo.InvariantCulture).Trim() == text.ToLower(CultureInfo.InvariantCulture).Trim()) { return(false); } } } return(true); }
private static void StartingProgressWindow(ProgressWindow progressWindow) { Logger.Info("In Preference Manage"); if (!App.sOpt.s) { progressWindow.mProgressHeader.Text = LocaleStrings.GetLocalizedString("STRING_QUITTING", ""); if (App.sOpt.backup) { progressWindow.mProgressText.Text = LocaleStrings.GetLocalizedString("STRING_QUITTING_BLUESTACKS_WHILE_BACKUP_PROMPT", ""); } else if (App.sOpt.restore) { progressWindow.mProgressText.Text = LocaleStrings.GetLocalizedString("STRING_QUITTING_BLUESTACKS_WHILE_RESTORE_PROMPT", ""); } App.ShowWindow(progressWindow); } string dataDir = RegistryStrings.DataDir; if (App.sOpt.restore) { new Restore(progressWindow).RestoreData(dataDir, App.sOpt.path); } else { if (!App.sOpt.backup) { return; } new Backup(progressWindow).BackupData(dataDir, App.sOpt.path); } }
private void MacroName_TextChanged(object sender, TextChangedEventArgs e) { if (this.mMacroNameStackPanel.Visibility != Visibility.Visible) { return; } if (string.IsNullOrEmpty(this.MacroName.Text.Trim())) { this.mErrorText.Text = LocaleStrings.GetLocalizedString("STRING_MACRO_NAME_NULL_MESSAGE", ""); this.MacroName.InputTextValidity = TextValidityOptions.Error; } else if (this.MacroName.Text.Trim().IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) >= 0) { this.mErrorText.Text = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0} {1} {2}", (object)LocaleStrings.GetLocalizedString("STRING_MACRO_NAME_ERROR", ""), (object)Environment.NewLine, (object)"\\ / : * ? \" < > |"); this.MacroName.InputTextValidity = TextValidityOptions.Error; } else if (((IEnumerable <string>)Constants.ReservedFileNamesList).Contains <string>(this.MacroName.Text.Trim().ToLower(CultureInfo.InvariantCulture))) { this.mErrorText.Text = LocaleStrings.GetLocalizedString("STRING_MACRO_FILE_NAME_ERROR", ""); this.MacroName.InputTextValidity = TextValidityOptions.Error; } else if (MacroGraph.Instance.Vertices.Cast <MacroRecording>().Any <MacroRecording>((Func <MacroRecording, bool>)(macro => string.Equals(macro.Name, this.MacroName.Text.Trim(), StringComparison.InvariantCultureIgnoreCase)))) { this.mErrorText.Text = LocaleStrings.GetLocalizedString("STRING_MACRO_NOT_SAVED_MESSAGE", ""); this.MacroName.InputTextValidity = TextValidityOptions.Error; } else { this.MacroName.InputTextValidity = TextValidityOptions.Success; } this.mErrorNamePopup.IsOpen = this.MacroName.InputTextValidity == TextValidityOptions.Error; this.MergedMacroRecording.Name = this.MacroName.Text; this.CheckIfCanSave(); }
private static void CheckIfAlreadyRunning() { if (!ProcessUtils.CheckAlreadyRunningAndTakeLock("Global\\BlueStacks_Log_Collector_Lockbgp", out App.sLogCollectorLock)) { return; } bool flag = false; Logger.Info("LogCollector already running."); if (App.sOpt.Boot || App.sOpt.Apk || (App.sOpt.D || App.sOpt.Thin) || (App.sOpt.Silent || App.sOpt.Hidden)) { flag = true; } if (!flag) { IntPtr window = InteropWindow.FindWindow((string)null, LocaleStrings.GetLocalizedString("STRING_BST_SUPPORT_UTILITY", "")); if (window != IntPtr.Zero) { InteropWindow.SetForegroundWindow(window); } else { CustomMessageWindow customMessageWindow = new CustomMessageWindow(); customMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_BST_SUPPORT_UTILITY", ""); customMessageWindow.BodyTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_LOGCOLLECTOR_RUNNING", ""); customMessageWindow.AddButton(ButtonColors.Blue, LocaleStrings.GetLocalizedString("STRING_OK", ""), (EventHandler)null, (string)null, false, (object)null, true); customMessageWindow.ShowDialog(); } } App.KillApplication(); }
private void Bookmark_img_MouseDown(object sender, MouseButtonEventArgs e) { if (!this.mSchemeName.IsReadOnly) { this.HandleNameEdit(this); } if (this.ParentWindow.SelectedConfig.ControlSchemesDict.ContainsKey(this.mSchemeName.Text)) { IMControlScheme imControlScheme = this.ParentWindow.SelectedConfig.ControlSchemesDict[this.mSchemeName.Text]; if (imControlScheme.IsBookMarked) { imControlScheme.IsBookMarked = false; this.mBookmarkImg.ImageName = "bookmark"; } else { List <IMControlScheme> controlSchemes = this.ParentWindow.SelectedConfig.ControlSchemes; if ((controlSchemes != null ? (controlSchemes.Count <IMControlScheme>((Func <IMControlScheme, bool>)(scheme => scheme.IsBookMarked)) < 5 ? 1 : 0) : 0) != 0) { imControlScheme.IsBookMarked = true; this.mBookmarkImg.ImageName = "bookmarked"; } else { this.CanvasWindow.SidebarWindow.AddToastPopup(LocaleStrings.GetLocalizedString("STRING_BOOKMARK_SCHEMES_WARNING", "")); } } this.CanvasWindow.SidebarWindow.FillProfileCombo(); KeymapCanvasWindow.sIsDirty = true; } e.Handled = true; }
private void GetSearchTextFromCloud() { new Thread((ThreadStart)(() => { try { this.defaultSearchBoxText = LocaleStrings.GetLocalizedString("STRING_SEARCH", ""); string urlWithParams = WebHelper.GetUrlWithParams(WebHelper.GetServerHost() + "/app_center_searchdefaultquery", (string)null, (string)null, (string)null); Logger.Debug("url for search api :" + urlWithParams); string json = BstHttpClient.Get(urlWithParams, (Dictionary <string, string>)null, false, string.Empty, 0, 1, 0, false, "bgp"); Logger.Debug("result for app_center_searchdefaultquery : " + json); JObject jobject = JObject.Parse(json); if ((bool)jobject["success"]) { string str = jobject["result"].ToString().Trim(); if (!string.IsNullOrEmpty(str)) { this.defaultSearchBoxText = str; } Logger.Debug("response from search text cloud api :" + str); } } catch (Exception ex) { Logger.Warning("Failed to fetch text from cloud... Err : " + ex.ToString()); } this.Dispatcher.Invoke((Delegate)(() => this.mSearchTextBox.Text = this.defaultSearchBoxText)); })) { IsBackground = true }.Start(); }
public static void Init(string vmName) { if (!Features.IsFeatureEnabled(64UL)) { Logger.Info("Disabling systray support because feature is disabled."); } else { SysTray.s_AgentOnlineText = LocaleStrings.GetLocalizedString("STRING_APP_PLAYER_ONLINE", ""); SysTray.s_AgentOnlineText = Oem.Instance.GetTitle(SysTray.s_AgentOnlineText); SysTray.s_SysTrayIcon = new NotifyIcon(); SysTray.s_SysTrayIcon.BalloonTipClicked += new EventHandler(SysTray.AppAndExplorerLauncher); SysTray.s_SysTrayIcon.Icon = Utils.GetApplicationIcon(); SysTray.s_SysTrayIcon.Text = SysTray.s_AgentOnlineText; if (Oem.Instance.IsShowVersionOnSysTrayToolTip) { SysTray.s_SysTrayIcon.Text += " (4.250.0.1070)"; } SysTray.s_SysTrayIcon.MouseDown += new System.Windows.Forms.MouseEventHandler(SysTray.OnSysTrayMouseDown); SysTray.s_SysTrayIcon.MouseUp += (System.Windows.Forms.MouseEventHandler)((x, e) => SysTray.OnSysTrayMouseUp(x, e, vmName)); SysTray.s_SysTrayIcon.Visible = true; if (!Features.IsFeatureEnabled(16384UL)) { SysTray.s_SysTrayIcon.Visible = false; } if (!Oem.Instance.IsSysTrayIconTextToBeBlueStacks3) { return; } SysTray.s_SysTrayIcon.Text = LocaleStrings.GetLocalizedString("STRING_BLUESTACKS", ""); } }
private static void CheckBlackScreenAndRestartGMifOccurs() { Logger.Info("In method CheckBlackScreenAndRestartGMifOccurs"); int num = 0; while (VMWindow.Instance.CheckBlackScreen() && num < 300) { ++num; Thread.Sleep(1000); } if (num >= 300) { Logger.Info("Black Screen occurs for 5 mins"); if (System.Windows.Forms.MessageBox.Show(LocaleStrings.GetLocalizedString("STRING_BLACKSCREEN_FORM", ""), LocaleStrings.GetLocalizedString("STRING_TROUBLESHOOTER", ""), MessageBoxButtons.OKCancel) == DialogResult.OK) { Logger.Info("User click Yes, Restartig GameManager"); HTTPUtils.SendRequestToClient("restartFrontend", new Dictionary <string, string>() { { "vmname", MultiInstanceStrings.VmName } }, MultiInstanceStrings.VmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp"); } else { Logger.Info("User clicked No"); } } else { Logger.Info("Frontend launched Successfully"); Stats.SendHomeScreenDisplayedStats(MultiInstanceStrings.VmName); } }
public static void ShowWarningMsg( string message, string captionTitle, ProgressWindow progress, EventHandler ContinueBtnhandler) { Logger.Info("Showing Warning Message prompt"); if (!App.sOpt.s) { progress.Dispatcher.Invoke((Delegate)(() => { CustomMessageWindow customMessageWindow = new CustomMessageWindow(); customMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString(captionTitle, ""); customMessageWindow.BodyTextBlock.Text = LocaleStrings.GetLocalizedString(message, ""); customMessageWindow.AddButton(ButtonColors.Blue, "STRING_CONTINUE", ContinueBtnhandler, (string)null, false, (object)null, true); customMessageWindow.AddButton(ButtonColors.White, "STRING_CANCEL", new EventHandler(DataManagerUtils.DataManagerUtils_CancelBtnHandler), (string)null, false, (object)null, true); customMessageWindow.CloseButtonHandle(new EventHandler(DataManagerUtils.DataManagerUtils_CancelBtnHandler), (object)null); customMessageWindow.Owner = (Window)progress; customMessageWindow.ShowDialog(); })); } else { ContinueBtnhandler((object)null, (EventArgs)null); } }
private void mCheckUpdateBtn_Click(object sender, RoutedEventArgs e) { if (string.Equals(this.mCheckUpdateBtn.Content.ToString(), LocaleStrings.GetLocalizedString("STRING_DOWNLOAD_UPDATE", ""), StringComparison.InvariantCulture)) { BlueStacksUpdater.DownloadNow(BlueStacksUpdater.sBstUpdateData, false); ClientStats.SendBluestacksUpdaterUIStatsAsync(ClientStatsEvent.SettingDownloadUpdate, ""); } else if (string.Equals(this.mCheckUpdateBtn.Content.ToString(), LocaleStrings.GetLocalizedString("STRING_INSTALL_UPDATE", ""), StringComparison.InvariantCulture)) { this.ParentWindow.ShowInstallPopup(); ClientStats.SendBluestacksUpdaterUIStatsAsync(ClientStatsEvent.SettingInstallUpdate, ""); } else { if (!string.Equals(this.mCheckUpdateBtn.Content.ToString(), LocaleStrings.GetLocalizedString("STRING_CHECK_UPDATES", ""), StringComparison.InvariantCulture) && !string.Equals(this.mCheckUpdateBtn.Content.ToString(), LocaleStrings.GetLocalizedString("STRING_RETRY_CONNECTION_ISSUE_TEXT1", ""), StringComparison.InvariantCulture)) { return; } this.ShowCheckingForUpdateGrid(); BlueStacksUpdater.sCheckUpdateBackgroundWorker.RunWorkerCompleted -= new RunWorkerCompletedEventHandler(this.HandleCheckForUpdateResult); BlueStacksUpdater.sCheckUpdateBackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.HandleCheckForUpdateResult); BlueStacksUpdater.SetupBlueStacksUpdater(this.ParentWindow, false); ClientStats.SendBluestacksUpdaterUIStatsAsync(ClientStatsEvent.SettingCheckUpdate, ""); } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); if (!this.CheckForSupportedVersion()) { if (!App.sOpt.s) { CustomMessageWindow customMessageWindow = new CustomMessageWindow(); customMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_UNSUPPORTED_VERSION", ""); customMessageWindow.BodyTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_VERSION_NOT_SUPPORTED", ""); customMessageWindow.AddButton(ButtonColors.Blue, LocaleStrings.GetLocalizedString("STRING_EXIT", ""), (EventHandler)((o, args) => App.ExitApplication(-1)), (string)null, false, (object)null, true); customMessageWindow.CloseButtonHandle((EventHandler)((o, args) => App.ExitApplication(-1)), (object)null); customMessageWindow.ShowDialog(); } else { App.ExitApplication(-1); } } else { MainWindow mainWindow = new MainWindow(); if (!App.sOpt.s) { mainWindow.Show(); } else { Stats.SendMiscellaneousStatsAsync("DiskCompactionStats", "DiskCompaction Started", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, App.sOpt.vmname, App.sOpt.relaunch.ToString(), App.sOpt.s.ToString(), (string)null, "Android", 0); DiskCompactionHelper.Instance.StartCompaction(); } } }
public void Show() { this.Hide(); this.mToast = new Toast(this.mParent, LocaleStrings.GetLocalizedString("STRING_FULL_SCREEN_TOAST", "")); Animate.AnimateWindow(this.mToast.Handle, 500, 262148); this.mToast.Show(); this.mTimer.Start(); }
private void GamepadIcon_MouseEnter(object sender, MouseEventArgs e) { this.mIconText.Text = this.mAppIconModel.IsGamepadConnected ? LocaleStrings.GetLocalizedString("STRING_GAMEPAD_CONNECTED", "") : LocaleStrings.GetLocalizedString("STRING_GAMEPAD_DISCONNECTED", ""); this.mAppIconModel.AppNameTooltip = (string)null; this.mGamePadToolTipPopup.PlacementTarget = (UIElement)this.mGamepadIcon; this.mGamePadToolTipPopup.IsOpen = true; this.mGamePadToolTipPopup.StaysOpen = true; }