private static void FixupGuestDisplay_FixAspectRatio() { float num1 = LayoutManager.IsPortrait() || LayoutManager.mEmulatedPortraitMode ? (float)LayoutManager.mConfiguredGuestSize.Height / (float)LayoutManager.mConfiguredGuestSize.Width : (float)LayoutManager.mConfiguredGuestSize.Width / (float)LayoutManager.mConfiguredGuestSize.Height; Size clientSize = VMWindow.Instance.ClientSize; double width1 = (double)clientSize.Width; clientSize = VMWindow.Instance.ClientSize; double height1 = (double)clientSize.Height; float num2 = (float)(width1 / height1); if ((double)num2 > (double)num1) { clientSize = VMWindow.Instance.ClientSize; float num3 = (float)clientSize.Width / num2 * num1; ref Rectangle local1 = ref LayoutManager.mScaledDisplayArea; clientSize = VMWindow.Instance.ClientSize; int num4 = (clientSize.Width - (int)num3) / 2; local1.X = num4; LayoutManager.mScaledDisplayArea.Y = 0; LayoutManager.mScaledDisplayArea.Width = (int)num3; ref Rectangle local2 = ref LayoutManager.mScaledDisplayArea;
private static void PerformDeferredSetup() { if (Opt.Instance.sysPrep) { return; } Logger.Info("Console PerformDeferredSetup"); Stats.SendBootStats("frontend", true, false, MultiInstanceStrings.VmName); VMWindow.Instance.SendOrientationToGuest(); if (RegistryManager.Instance.DefaultGuest.ConfigSynced == 0) { Logger.Info("Config not synced. Syncing now."); ThreadPool.QueueUserWorkItem((WaitCallback)(stateInfo => { VmCmdHandler.SyncConfig(InputMapper.GetKeyMappingParserVersion(), MultiInstanceStrings.VmName); VmCmdHandler.SetKeyboard(LayoutManager.IsDesktop(), MultiInstanceStrings.VmName); })); } else { string currentKeyboardLayout = Utils.GetCurrentKeyboardLayout(); VMWindow.Instance.SetKeyboardLayout(currentKeyboardLayout); Logger.Info("Config already synced."); } ThreadPool.QueueUserWorkItem((WaitCallback)(stateInfo => { Logger.Info("Started fqdnSender thread for agent"); VmCmdHandler.FqdnSend(0, "Agent", MultiInstanceStrings.VmName); Logger.Info("fqdnSender thread exiting"); })); ThreadPool.QueueUserWorkItem((WaitCallback)(stateInfo => { Logger.Info("Started fqdnSender thread for frontend"); VmCmdHandler.FqdnSend(0, "frontend", MultiInstanceStrings.VmName); Logger.Info("fqdnSender thread exiting"); })); UIHelper.RunOnUIThread((Control)VMWindow.Instance, (UIHelper.Action)(() => { try { string text = System.Windows.Clipboard.GetText(System.Windows.TextDataFormat.Text); Logger.Debug("sending clipboard data to android.." + text); HTTPUtils.SendRequestToGuestAsync("clipboard", new Dictionary <string, string>() { { "text", text } }, MultiInstanceStrings.VmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp"); } catch (Exception ex) { Logger.Error(" error in sending clipboard data to android.." + ex?.ToString()); } })); ThreadPool.QueueUserWorkItem((WaitCallback)(stateInfo => VmCmdHandler.SetMachineType(LayoutManager.IsDesktop(), MultiInstanceStrings.VmName))); AndroidBootUp.GpsAttach(); SensorDevice.Instance.Start(MultiInstanceStrings.VmName); AndroidBootUp.CameraAttach(); AndroidBootUp.SendControllerEventInternal("controller_flush", (UIHelper.Action)(() => { foreach (int key in VMWindow.Instance.mControllerMap.Keys) { SensorDevice.Instance.ControllerAttach(SensorDevice.Type.Accelerometer); AndroidBootUp.SendControllerEvent("attach", key, VMWindow.Instance.mControllerMap[key]); } VMWindow.Instance.mControllerMap.Clear(); })); ThreadPool.QueueUserWorkItem((WaitCallback)(stateInfo => { Logger.Info("Checking for Black Screen Error"); AndroidBootUp.CheckBlackScreenAndRestartGMifOccurs(); })); }
internal static void FixupGuestDisplay() { VMWindow.Instance.Invalidate(); LayoutManager.FixupGuestDisplay_FixAspectRatio(); LayoutManager.FixupGuestDisplay_FixOpenGLSubwindow(); }
public LoadingScreen( Point loadingScreenLocation, Size loadingScreenSize, string barType, bool isFullScreenButtonVisible) { Logger.Info("LoadingScreen({0})", (object)loadingScreenSize); this.SetImageDir(); this.LoadImages(); this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); this.Location = loadingScreenLocation; this.Size = loadingScreenSize; this.BackColor = Color.FromArgb(35, 147, 213); this.appLogo = new Label(); Logger.Info("Using splash logo"); this.appLogo.BackgroundImage = this.splashLogoImage; this.appLogo.Width = this.appLogo.BackgroundImage.Width; this.appLogo.Height = this.appLogo.BackgroundImage.Height; this.appLogo.BackColor = Color.Transparent; this.installDir = RegistryStrings.InstallDir; string str = "LoadingScreenAppTitle"; if (str.StartsWith("DynamicText")) { this.mLstDynamicString = new List <string>((IEnumerable <string>)str.Split(new char[1] { ';' }, StringSplitOptions.RemoveEmptyEntries)); if (this.mLstDynamicString.Count > 0) { this.mLstDynamicString.Remove("DynamicText"); System.Timers.Timer timer = new System.Timers.Timer(5000.0); timer.Elapsed += new ElapsedEventHandler(this.TimerElapsed); str = this.mLstDynamicString[0]; timer.Start(); } } this.appNameText.Text = str; this.appNameText.TextAlign = ContentAlignment.MiddleCenter; this.appNameText.Width = loadingScreenSize.Width; this.appNameText.Height = 50; this.appNameText.UseMnemonic = false; this.appNameText.ForeColor = Color.White; this.appNameText.BackColor = Color.Transparent; LoadingScreen.StatusText statusText = new LoadingScreen.StatusText(); statusText.TextAlign = ContentAlignment.MiddleCenter; statusText.Width = loadingScreenSize.Width; statusText.Height = 40; statusText.UseMnemonic = false; statusText.ForeColor = Color.White; statusText.BackColor = Color.Transparent; this.statusText = (Label)statusText; LoadingScreen.NewProgressBar newProgressBar = new LoadingScreen.NewProgressBar(barType); newProgressBar.Width = 336; newProgressBar.Height = 10; newProgressBar.Value = 0; this.progressBar = newProgressBar; if (barType == "Marquee") { this.progressTimer = new System.Windows.Forms.Timer() { Interval = 50 }; this.progressTimer.Tick += (EventHandler)((obj, evt) => this.progressBar.Invalidate()); this.progressTimer.Start(); } Label label1 = new Label(); label1.BackgroundImage = this.whiteLogoImage; label1.BackgroundImageLayout = ImageLayout.Stretch; label1.Width = 48; label1.Height = 44; label1.BackColor = Color.Transparent; this.whiteLogo = label1; Label label2 = new Label(); label2.BackgroundImage = this.closeButtonImage; label2.BackgroundImageLayout = ImageLayout.Stretch; label2.Width = 24; label2.Height = 24; label2.BackColor = Color.Transparent; this.closeButton = label2; this.closeButton.Click += (EventHandler)((obj, evt) => VMWindow.Instance.Close()); this.closeButton.Visible = false; Label label3 = new Label(); label3.BackgroundImage = this.fullScreenButtonImage; label3.BackgroundImageLayout = ImageLayout.Stretch; label3.Width = 24; label3.Height = 24; label3.BackColor = Color.Transparent; this.fullScreenButton = label3; this.fullScreenButton.Click += (EventHandler)((obj, evt) => { LayoutManager.ToggleFullScreen(); this.FullScreenToggled(); }); if (!isFullScreenButtonVisible) { this.fullScreenButton.Visible = false; } this.SetLocations(); this.Controls.Add((Control)this.appLogo); this.Controls.Add((Control)this.appNameText); this.Controls.Add((Control)this.progressBar); this.Controls.Add((Control)this.statusText); this.Controls.Add((Control)this.whiteLogo); this.Controls.Add((Control)this.closeButton); this.Controls.Add((Control)this.fullScreenButton); this.whiteLogo.Visible = false; }