private static void AddAppPlayerMenuItems(string vmName) { if (Oem.Instance.IsShowAllInstancesToBeAddedInContextMenuOfSysTray && NotificationWindow.Instance.IsOverrideDesktopNotificationSettingsDict.ContainsValue(true)) { SysTray.AddShowAllInstancesContextMenu(); } if (Oem.Instance.IsOnlyStopButtonToBeAddedInContextMenuOFSysTray) { SysTray.AddStopContextMenu(vmName); } else { ToolStripSeparator toolStripSeparator1 = new ToolStripSeparator(); ToolStripSeparator toolStripSeparator2 = new ToolStripSeparator(); SysTray.AddZipLogsContextMenu(); if (Features.IsFeatureEnabled(32UL)) { SysTray.AddBstUsageContextMenu(); } SysTray.s_ContextMenuStrip.Items.Add((ToolStripItem)toolStripSeparator1); SysTray.AddStopContextMenu(vmName); SysTray.s_ContextMenuStrip.ShowCheckMargin = false; SysTray.s_ContextMenuStrip.ShowImageMargin = false; } }
private static void AddContextMenus(string vmName) { if (SysTray.s_ContextMenuStrip != null) { SysTray.s_ContextMenuStrip.Dispose(); } SysTray.s_ContextMenuStrip = new ContextMenuStrip(); SysTray.s_SysTrayIcon.ContextMenuStrip = SysTray.s_ContextMenuStrip; SysTray.AddAppPlayerMenuItems(vmName); }
public HDAgent() { string vmName = "Android"; SysTray.Init(vmName); Utils.AddMessagingSupport(out HDAgent.sOemWindowMapper); HDAgent.clipboardClient = new ClipboardMgr(); HDAgent.clipboardClient.Show(); HDAgent.CheckAnnouncementAsync(vmName); TimelineStatsSender.Init(vmName); }
private static void OnSysTrayMouseUp(object sender, System.Windows.Forms.MouseEventArgs e, string vmName) { if (e.Button == MouseButtons.Left && Oem.Instance.IsLefClickOnTrayIconLaunchPartner) { Logger.Info("Starting Partner on systray icon click"); Stats.SendCommonClientStatsAsync("notification_mode", "systray_clicked", vmName, string.Empty, "open", "", ""); Logger.Info("Notification mode : Off"); ProcessUtils.GetProcessObject(Utils.GetPartnerExecutablePath(), vmName, false).Start(); } else { SysTray.AddContextMenus(vmName); typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic).Invoke((object)SysTray.s_SysTrayIcon, (object[])null); } }
public static void ShowInfoShort( string title, string message, string vmName, string package, string id = "0") { title = Oem.Instance.GetTitle(title); id = !id.Equals("200", StringComparison.InvariantCultureIgnoreCase) || !package.Equals("com.bluestacks.filemanager", StringComparison.InvariantCultureIgnoreCase) ? Guid.NewGuid().ToString() : "200"; Dictionary <string, string> data = new Dictionary <string, string>() { { "app_name", title }, { "msg", message }, { "pkg", package }, { "vmname", vmName }, { nameof(id), id } }; switch (NotificationManager.Instance.IsShowNotificationForKey(title, vmName)) { case MuteState.NotMuted: case MuteState.AutoHide: HTTPUtils.SendRequestToClient("addNotificationInDrawer", data, vmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp"); break; } if (!NotificationManager.Instance.IsDesktopNotificationToBeShown(title)) { return; } SysTray.ShowTrayStatus(ToolTipIcon.Info, title, message, 1000, vmName, package, id); }
public static void AppAndExplorerLauncher(object sender, EventArgs e) { Logger.Info("Clicked on BalloonTip"); string vmName = "Android"; try { string localizedString1 = LocaleStrings.GetLocalizedString("STRING_INSTALL_SUCCESS", ""); string localizedString2 = LocaleStrings.GetLocalizedString("STRING_INSTALL_UPDATES", ""); string localizedString3 = LocaleStrings.GetLocalizedString("STRING_UNINSTALL_SUCCESS", ""); string balloonTipTitle = ((NotifyIcon)sender).BalloonTipTitle; string balloonTipText = ((NotifyIcon)sender).BalloonTipText; string str; if (balloonTipText.Contains(localizedString1) || balloonTipText.Contains(localizedString2)) { str = balloonTipText.Substring(0, balloonTipText.LastIndexOf(localizedString1) - 1); } else { if (balloonTipText.Contains(localizedString3)) { return; } str = balloonTipTitle; } if (string.Compare(str, "Successfully copied files:", true) == 0 || string.Compare(str, "Cannot copy files:", true) == 0) { SysTray.LaunchExplorer(balloonTipText); } else { Logger.Info("Launching " + str); string packageName = "com.bluestacks.appmart"; string activityName = "com.bluestacks.appmart.StartTopAppsActivity"; string fileName = HDAgent.s_InstallDir + "\\HD-RunApp.exe"; if (!new JsonParser(vmName).GetAppInfoFromAppName(str, out packageName, out string _, out activityName)) { Logger.Error("Failed to launch app: {0}. No info found in json. Starting home app", (object)str); Process.Start(fileName, string.Format("-p {0} -a {1} -vmname:{2}", (object)packageName, (object)activityName, (object)vmName)); } else { Process.Start(fileName, string.Format("-p {0} -a {1} -vmname:{2}", (object)packageName, (object)activityName, (object)vmName)); } }
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", ""); } }
public static void AppInstalled( string name, string package, string activity, string img, string version, string isUpdate, string vmName, string source, string campaignName, string clientVersion, bool isGl3Required, bool isVideoPresent, string apkType, string versionName) { Logger.Info("Replacing invalid characters, if any, with whitespace"); ApkInstall.sAppName = Regex.Replace(name, "[\\x22\\\\\\/:*?|<>]", " "); ApkInstall.sPackageName = package; ApkInstall.sLaunchableActivityName = activity; ApkInstall.sAppIcon = img; ApkInstall.sVersion = version; ApkInstall.sGl3Required = isGl3Required; ApkInstall.sVideoPresent = isVideoPresent; ApkInstall.sVersionName = versionName; ApkInstall.sIsGamepadCompatible = Utils.CheckGamepadCompatible(package); ApkInstall.sOriginalJson = new JsonParser(vmName).GetAppList(); ApkInstall.AddToJson(vmName); Stats.SendAppInstallStats(name, package, version, versionName, "true", isUpdate, source, vmName, campaignName, clientVersion, apkType); string str1 = Path.Combine(RegistryStrings.GadgetDir, string.Format("{0}.{1}.png", (object)package, (object)activity)); string str2 = Path.Combine(RegistryStrings.GadgetDir, string.Format("{0}.png", (object)package)); if (System.IO.File.Exists(str2)) { if (!System.IO.File.Exists(str1)) { System.IO.File.Copy(str2, str1, false); } } else if (Oem.Instance.IsDownloadIconFromWeb) { try { Utils.DownloadIcon(package, "", false); } catch { } } if (Oem.Instance.IsOEMWithBGPClient) { ApkInstall.InformPartner(vmName, package, isUpdate); } if (Features.IsFeatureEnabled(8192UL)) { ApkInstall.CreateAppShortcut(vmName, isUpdate); } Logger.Info("InstallApk: Got AppName: {0}", (object)ApkInstall.sAppName); string str3 = ApkInstall.sAppName + " "; string message = string.Compare(isUpdate, "true", true) != 0 ? str3 + LocaleStrings.GetLocalizedString("STRING_INSTALL_SUCCESS", "") : str3 + LocaleStrings.GetLocalizedString("STRING_UPDATE_SUCCESS", ""); try { if (Features.IsFeatureEnabled(2UL)) { if (Array.IndexOf <string>(ApkInstall.sIgnoreEvents, package) == -1) { SysTray.ShowInfoShort(LocaleStrings.GetLocalizedString("STRING_BLUESTACKS", ""), message, vmName, package, "0"); } else { Logger.Debug("Not showing notification for: " + package); } } else { Logger.Info("Not showing install notification..."); } } catch (Exception ex) { Logger.Error("Failed to get ShowInstallerNotification value. err: " + ex.Message); } }
public static void AppUninstalled( string packageName, string vmName, string source, string campaignName, string clientVersion) { string appName = AppUninstaller.RemoveFromJson(packageName, vmName); try { if (Oem.Instance.IsCreateDesktopIconForApp) { if (string.Compare(vmName, "Android", true) == 0) { foreach (string file in Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "*.lnk", SearchOption.AllDirectories)) { try { if (Utils.IsShortcutArgumentContainsPackage(file, packageName)) { File.Delete(file); } } catch (Exception ex) { Logger.Warning("Error while checking file for deleting shortcut, filename: " + file); } } } } } catch (Exception ex) { Logger.Warning("Error while deleting shortcut icons for apps from desktop. Error: " + ex.ToString()); } if (Oem.Instance.IsOEMWithBGPClient) { try { HTTPUtils.SendRequestToClient("appUninstalled", new Dictionary <string, string>() { { "package", packageName }, { "name", appName } }, vmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp"); } catch (Exception ex) { Logger.Error("Exception in AppUninstalled: " + ex.ToString()); } } AppUninstaller.DeleteGlAppDataIfExist(packageName); Logger.Info("Sending App Uninstall stats"); string versionFromPackage = HDAgent.GetVersionFromPackage(packageName, vmName); string versionNameFromPackage = HDAgent.GetVersionNameFromPackage(packageName, vmName); Stats.SendAppInstallStats(appName, packageName, versionFromPackage, versionNameFromPackage, "false", "false", source, vmName, campaignName, clientVersion, ""); if (appName == "") { appName = packageName; } string message = string.Format("{0} {1}", (object)appName, (object)LocaleStrings.GetLocalizedString("STRING_UNINSTALL_SUCCESS", "")); if (!Features.IsFeatureEnabled(4UL)) { return; } SysTray.ShowInfoShort(LocaleStrings.GetLocalizedString("STRING_BLUESTACKS", ""), message, vmName, packageName, "0"); }