internal void CloseTabAfterQuitPopup(string tabKey, bool sendStopAppToAndroid, bool forceClose) { try { Logger.Info("CloseTab after quitpopup, key: {0}, sendStopApp: {1}, forceClose: {2}", (object)tabKey, (object)sendStopAppToAndroid, (object)forceClose); if (!this.mDictTabs.ContainsKey(tabKey)) { return; } Logger.Info("mDict Tab contains key"); AppTabButton mDictTab = this.mDictTabs[tabKey]; if (mDictTab.mTabType != TabType.HomeTab) { Logger.Info("Button was not hometab"); if (this.ParentWindow.mDimOverlay != null && this.ParentWindow.mDimOverlay.Control != null) { Logger.Info("DimOverlay and control exist"); if (FeatureManager.Instance.IsCustomUIForNCSoft && (object)this.ParentWindow.mDimOverlay.Control.GetType() == (object)this.ParentWindow.ScreenLockInstance.GetType() || !FeatureManager.Instance.IsCustomUIForNCSoft) { Logger.Info("hiding"); this.ParentWindow.HideDimOverlay(); this.mPopup.IsOpen = false; } } } this.mLastPackageForQuitPopupDisplayed = ""; Logger.Info("Trying non hometab"); if (!(mDictTab.mTabType != TabType.HomeTab | forceClose)) { return; } Logger.Info("Button is not hometab or forceclose"); Publisher.PublishMessage(BrowserControlTags.tabClosing, this.ParentWindow.mVmName, new JObject((object)new JProperty("PackageName", (object)mDictTab.PackageName))); (mDictTab.Parent as Panel).Children.Remove((UIElement)mDictTab); this.mDictTabs.Remove(tabKey); Logger.Info("XXXSR: Tab removed"); if (mDictTab.mTabType == TabType.AppTab || mDictTab.mTabType == TabType.HomeTab) { this.ParentWindow.mCommonHandler.ToggleMacroAndSyncVisibility(); } if (sendStopAppToAndroid && mDictTab.mTabType == TabType.AppTab) { this.ParentWindow.mAppHandler.StopAppRequest(mDictTab.PackageName); } Logger.Info("MacroAndSync gone and StopApp sent"); this.ListTabHistory.RemoveAll((Predicate <string>)(n => n.Equals(tabKey, StringComparison.OrdinalIgnoreCase))); Logger.Info("TabHistory cleared"); if (this.ParentWindow.mDiscordhandler != null) { this.ParentWindow.mDiscordhandler.RemoveAppFromTimestampList(tabKey); } if (mDictTab.mTabType == TabType.AppTab) { GrmHandler.RefreshGrmIndicationForAllInstances(mDictTab.PackageName); } Publisher.PublishMessage(BrowserControlTags.currentlyRunningApps, this.ParentWindow.mVmName, new JObject((object)new JProperty("packages", (object)new JArray((object)this.mDictTabs.Values.Select <AppTabButton, string>((Func <AppTabButton, string>)(_ => _.TabKey)))))); if (Oem.IsOEMDmm && this.ListTabHistory.Count == 0) { this.ParentWindow.Hide(); this.ParentWindow.RestoreWindows(false); if (this.ParentWindow.mDMMRecommendedWindow != null) { this.ParentWindow.mDMMRecommendedWindow.Visibility = Visibility.Hidden; } this.ParentWindow.StaticComponents.mSelectedTabButton.IsPortraitModeTab = false; } else if (mDictTab.IsSelected) { Logger.Info("Button was selected"); if (this.ListTabHistory.Count != 0) { Logger.Info("goto tab"); this.GoToTab(this.ListTabHistory[this.ListTabHistory.Count - 1], true, false); } else { Logger.Fatal("No tab to go back to! Ignoring"); } } Logger.Info("Resizing tabs"); this.ResizeTabs(); } catch (Exception ex) { Logger.Error("XXXSR-UFD945 Couldn't close tab after quit popup.Ex: {0}", (object)ex); } }
internal void AddAppTab( string appName, string packageName, string activityName, string imageName, bool isSwitch, bool isLaunch, bool receivedFromImap = false) { this.DoExtraHandlingForApp(packageName); if (PostBootCloudInfoManager.Instance.mPostBootCloudInfo?.GameNotificationAppPackages?.NotificationModeAppPackages?.IsPackageAvailable(packageName).GetValueOrDefault()) { this.ParentWindow.EngineInstanceRegistry.LastNotificationEnabledAppLaunched = packageName; } if (this.mDictTabs.ContainsKey(packageName)) { this.GoToTab(packageName, isLaunch, receivedFromImap); } else { AppTabButton selectedTabButton = this.ParentWindow.StaticComponents.mSelectedTabButton; AppTabButton button = new AppTabButton(); button.Init(appName, packageName, activityName, imageName, this.ParentWindow.FrontendParentGrid, packageName); button.MouseUp += new MouseButtonEventHandler(this.AppTabButton_MouseUp); if (this.ParentWindow.mDiscordhandler != null) { this.ParentWindow.mDiscordhandler.AssignTabChangeEvent(button); } if (Oem.IsOEMDmm && this.ParentWindow.mDmmBottomBar != null) { button.EventOnTabChanged += new EventHandler <TabChangeEventArgs>(this.ParentWindow.mDmmBottomBar.Tab_Changed); } this.mDictTabs.Add(packageName, button); this.mPanel.Children.Add((UIElement)button); if (Oem.Instance.SendAppClickStatsFromClient) { ThreadPool.QueueUserWorkItem((WaitCallback)(obj => { AppInfo infoFromPackageName = new JsonParser(this.ParentWindow.mVmName).GetAppInfoFromPackageName(packageName); string appVersion = string.Empty; string appVersionName = string.Empty; if (infoFromPackageName != null) { if (!string.IsNullOrEmpty(infoFromPackageName.Version)) { appVersion = infoFromPackageName.Version; } if (!string.IsNullOrEmpty(infoFromPackageName.VersionName)) { appVersionName = infoFromPackageName.VersionName; } } BlueStacks.Common.Stats.SendAppStats(appName, packageName, appVersion, "HomeVersionNotKnown", BlueStacks.Common.Stats.AppType.app, this.ParentWindow.mVmName, appVersionName); })); } if (RegistryManager.Instance.InstallationType == InstallationTypes.GamingEdition) { button.Visibility = Visibility.Collapsed; } else if (selectedTabButton != null && selectedTabButton.IsPortraitModeTab && selectedTabButton.mTabType == TabType.AppTab) { button.IsPortraitModeTab = true; } this.ResizeTabs(); GrmHandler.RefreshGrmIndicationForAllInstances(packageName); Publisher.PublishMessage(BrowserControlTags.currentlyRunningApps, this.ParentWindow.mVmName, new JObject((object)new JProperty("packages", (object)new JArray((object)this.mDictTabs.Values.Select <AppTabButton, string>((Func <AppTabButton, string>)(_ => _.TabKey)))))); if (!isSwitch) { return; } this.GoToTab(packageName, isLaunch, receivedFromImap); } }