Ejemplo n.º 1
0
 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 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 UnifyButton_Click(object sender, RoutedEventArgs e1)
        {
            if (this.mOriginalMacroRecording == null)
            {
                this.mOriginalMacroRecording = new MacroRecording();
            }
            this.mOriginalMacroRecording.CopyFrom(this.MergedMacroRecording);
            CustomMessageWindow customMessageWindow = new CustomMessageWindow();

            customMessageWindow.TitleTextBlock.Text = string.Format((IFormatProvider)CultureInfo.InvariantCulture, LocaleStrings.GetLocalizedString("STRING_UNIFY_0", ""), (object)this.mOriginalMacroRecording.Name);
            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, "STRING_UNIFIYING_LOSE_CONFIGURE", "");
            bool closeWindow = false;

            customMessageWindow.AddButton(ButtonColors.Blue, string.Format((IFormatProvider)CultureInfo.InvariantCulture, LocaleStrings.GetLocalizedString("STRING_CONTINUE", ""), (object)"").Trim(), (EventHandler)((o, evt) =>
            {
                ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "merge_unify", (string)null, (string)null, (string)null, (string)null, (string)null, "Android");
                this.mMacroRecorderWindow.FlattenRecording(this.mOriginalMacroRecording, false);
                CommonHandlers.SaveMacroJson(this.mOriginalMacroRecording, this.mOriginalMacroRecording.Name + ".json");
                CommonHandlers.RefreshAllMacroRecorderWindow();
                closeWindow = true;
            }), (string)null, false, (object)null, true);
            customMessageWindow.AddButton(ButtonColors.White, "STRING_CANCEL", (EventHandler)((o, evt) => ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "merge_unify_cancel", (string)null, (string)null, (string)null, (string)null, (string)null, "Android")), (string)null, false, (object)null, true);
            customMessageWindow.CloseButtonHandle((EventHandler)((o, e2) => ClientStats.SendMiscellaneousStatsAsync("MacroOperations", RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, "merge_unify_cancel", (string)null, (string)null, (string)null, (string)null, (string)null, "Android")), (object)null);
            customMessageWindow.Owner = (Window)this;
            customMessageWindow.ShowDialog();
            if (!closeWindow)
            {
                return;
            }
            this.CloseWindow();
        }
Ejemplo n.º 4
0
 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();
         }
     }));
 }
Ejemplo n.º 5
0
        private void RevertBtnClick(object sender, RoutedEventArgs e)
        {
            CustomMessageWindow customMessageWindow = new CustomMessageWindow();

            customMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_RESTORE_DEFAULTS", "");
            customMessageWindow.BodyTextBlock.Text  = LocaleStrings.GetLocalizedString("STRING_RESTORE_SHORTCUTS", "");
            customMessageWindow.AddButton(ButtonColors.Red, LocaleStrings.GetLocalizedString("STRING_RESTORE_BUTTON", ""), (EventHandler)((o, evt) =>
            {
                this.RestoreDefaultShortcuts();
                this.mRevertBtn.IsEnabled = false;
            }), (string)null, false, (object)null, true);
            customMessageWindow.AddButton(ButtonColors.White, LocaleStrings.GetLocalizedString("STRING_CANCEL", ""), (EventHandler)((o, evt) => {}), (string)null, false, (object)null, true);
            customMessageWindow.CloseButtonHandle((Predicate <object>)null, (object)null);
            customMessageWindow.Owner = (Window)this.ParentWindow;
            customMessageWindow.ShowDialog();
        }
Ejemplo n.º 6
0
        private static void CheckIfAlreadyRunning()
        {
            try
            {
                if (ProcessUtils.IsAlreadyRunning("Global\\BlueStacks_DiskCompactor_Lockbgp"))
                {
                    Logger.Info("Disk compaction is running in background");
                    foreach (string str in GetProcessExecutionPath.GetApplicationPath(Process.GetProcessesByName("DiskCompactionTool")))
                    {
                        if (str.Equals(Path.Combine(RegistryStrings.InstallDir, "DiskCompactionTool.exe"), StringComparison.InvariantCultureIgnoreCase))
                        {
                            CustomMessageWindow customMessageWindow = new CustomMessageWindow()
                            {
                                ImageName = "ProductLogo"
                            };
                            customMessageWindow.TitleTextBlock.Text = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}", (object)LocaleStrings.GetLocalizedString("STRING_EXIT_BLUESTACKS_DUE_TO_DISK_COMPACTION_HEADING", ""));
                            customMessageWindow.BodyTextBlock.Text  = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}", (object)LocaleStrings.GetLocalizedString("STRING_EXIT_BLUESTACKS_DUE_TO_DISK_COMPACTION_MESSAGE", ""));
                            customMessageWindow.AddButton(ButtonColors.Blue, "STRING_OK", (EventHandler)null, (string)null, false, (object)null, true);
                            customMessageWindow.CloseButtonHandle((Predicate <object>)null, (object)null);
                            customMessageWindow.ShowDialog();
                            Logger.Info("Disk compaction running for this instance. Exiting this instance");
                            App.ExitApplication();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Failed to check if disk compaction is running: " + ex.Message);
            }
            string runningProcName;

            if (ProcessUtils.IsAnyInstallerProcesRunning(out runningProcName) && !string.IsNullOrEmpty(runningProcName))
            {
                Logger.Info(runningProcName + " process is running. Exiting BlueStacks MultiInstance Manager");
                Environment.Exit(-1);
            }
            if (!ProcessUtils.CheckAlreadyRunningAndTakeLock("Global\\BlueStacks_MultiInstanceManager_Lockbgp", out App.sMultiInstanceManagerLock))
            {
                return;
            }
            Utils.BringToFront("BlueStacks Multi-Instance Manager");
            App.ExitApplication();
        }
 public static void ShowErrorMsg(string message, string captionTitle, ProgressWindow progress)
 {
     Logger.Info("Showing Error 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_EXIT", new EventHandler(DataManagerUtils.DataManagerUtils_ExitBtnHandler), (string)null, false, (object)null, true);
             customMessageWindow.CloseButtonHandle(new EventHandler(DataManagerUtils.DataManagerUtils_ExitBtnHandler), (object)null);
             customMessageWindow.Owner = (Window)progress;
             customMessageWindow.ShowInTaskbar = true;
             customMessageWindow.Title = Strings.ProductDisplayName;
             progress.Hide();
             customMessageWindow.ShowDialog();
         }));
     }
     else
     {
         DataManagerUtils.DataManagerUtils_ExitBtnHandler((object)null, (EventArgs)null);
     }
 }
Ejemplo n.º 8
0
        private static void CheckIfAlreadyRunning()
        {
            try
            {
                if (ProcessUtils.IsAlreadyRunning("Global\\BlueStacks_DiskCompactor_Lockbgp"))
                {
                    Logger.Info("Disk compaction is running in background");
                    foreach (string str in GetProcessExecutionPath.GetApplicationPath(Process.GetProcessesByName("DiskCompactionTool")))
                    {
                        if (str.Equals(Path.Combine(RegistryStrings.InstallDir, "DiskCompactionTool.exe"), StringComparison.InvariantCultureIgnoreCase))
                        {
                            CustomMessageWindow customMessageWindow = new CustomMessageWindow();
                            customMessageWindow.ImageName           = "ProductLogo";
                            customMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_EXIT_BLUESTACKS_DUE_TO_DISK_COMPACTION_HEADING", "");
                            customMessageWindow.BodyTextBlock.Text  = LocaleStrings.GetLocalizedString("STRING_EXIT_BLUESTACKS_DUE_TO_DISK_COMPACTION_MESSAGE", "");
                            customMessageWindow.AddButton(ButtonColors.Blue, "STRING_OK", (EventHandler)null, (string)null, false, (object)null, true);
                            customMessageWindow.CloseButtonHandle((Predicate <object>)null, (object)null);
                            customMessageWindow.ShowDialog();
                            Logger.Info("Disk compaction running for this instance. Exiting this instance");
                            App.ExitApplication();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Failed to check if disk compaction is running: " + ex.Message);
            }
            string runningProcName;

            if (!Opt.Instance.force && ProcessUtils.IsAnyInstallerProcesRunning(out runningProcName) && !string.IsNullOrEmpty(runningProcName))
            {
                Logger.Info(runningProcName + " process is running. Exiting BlueStacks");
                App.ExitApplication();
            }
            if (ProcessUtils.CheckAlreadyRunningAndTakeLock("Global\\BlueStacks_BlueStacksUI_Lockbgp", out App.mBluestacksUILock))
            {
                try
                {
                    Logger.Info("Relaunching client for vm : " + Opt.Instance.vmname);
                    Dictionary <string, string> data = new Dictionary <string, string>()
                    {
                        {
                            "vmname",
                            Opt.Instance.vmname
                        },
                        {
                            "hidden",
                            Opt.Instance.h.ToString((IFormatProvider)CultureInfo.InvariantCulture)
                        }
                    };
                    if (Opt.Instance.launchedFromSysTray)
                    {
                        data.Add("all", "True");
                    }
                    if (!string.IsNullOrEmpty(Opt.Instance.Json))
                    {
                        data.Add("json", Opt.Instance.Json);
                        Logger.Debug("OpenPackage result: " + HTTPUtils.SendRequestToClient("openPackage", data, Opt.Instance.vmname, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp"));
                    }
                    else
                    {
                        Logger.Debug("ShowWindow result: " + HTTPUtils.SendRequestToClient("showWindow", data, Opt.Instance.vmname, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp"));
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error(ex.ToString());
                }
                Logger.Info("BlueStacksUI already running. Exiting this instance");
                App.ExitApplication();
            }
            else
            {
                try
                {
                    Logger.Debug("Checking for existing process not exited");
                    List <Process> list = ((IEnumerable <Process>)Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName)).ToList <Process>();
                    if (!ProcessUtils.IsLockInUse("Global\\BlueStacks_BlueStacksUI_Closing_Lockbgp"))
                    {
                        return;
                    }
                    foreach (Process process in list)
                    {
                        if (process.Id != Process.GetCurrentProcess().Id)
                        {
                            process.Kill();
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.Warning("Ignoring error closing previous instances" + ex.ToString());
                }
            }
        }