예제 #1
0
 private void CancelBTvDownload(object sender, EventArgs e)
 {
     Logger.Info("User cancelled BTV download");
     this.sDownloading = false;
     if (this.sDownloader == null)
     {
         return;
     }
     this.sDownloader.AbortDownload();
     if (!BTVManager.IsBTVInstalled())
     {
         return;
     }
     Directory.Delete(RegistryStrings.ObsDir, true);
 }
예제 #2
0
 public void MaybeDownloadAndLaunchBTv(MainWindow parentWindow)
 {
     if (!BTVManager.IsBTVInstalled())
     {
         if (this.sDownloading && this.sWindow != null)
         {
             BTVManager.BringToFront((CustomWindow)this.sWindow);
         }
         else
         {
             ExtensionPopupControl btvExtPopup = new ExtensionPopupControl();
             btvExtPopup.LoadExtensionPopupFromFolder("BTVExtensionPopup");
             System.Action action1;
             System.Action action2;
             btvExtPopup.DownloadClicked += (EventHandler)((o, e) =>
             {
                 BlueStacksUIUtils.CloseContainerWindow((FrameworkElement)btvExtPopup);
                 this.sDownloading = true;
                 this.sWindow = new CustomMessageWindow();
                 BlueStacksUIBinding.Bind(this.sWindow.TitleTextBlock, "STRING_BTV_DOWNLOAD", "");
                 BlueStacksUIBinding.Bind(this.sWindow.BodyTextBlock, "STRING_BTV_INSTALL_WAIT", "");
                 BlueStacksUIBinding.Bind(this.sWindow.BodyWarningTextBlock, "STRING_BTV_WARNING", "");
                 this.sWindow.AddButton(ButtonColors.Blue, "STRING_CANCEL", new EventHandler(this.CancelDownloadConfirmation), (string)null, false, (object)null, true);
                 this.sWindow.BodyWarningTextBlock.Visibility = Visibility.Visible;
                 this.sWindow.ProgressBarEnabled = true;
                 this.sWindow.IsWindowMinizable = true;
                 this.sWindow.IsWindowClosable = false;
                 this.sWindow.ImageName = "BTVTopBar";
                 this.sWindow.ShowInTaskbar = true;
                 this.sWindow.Owner = (Window)parentWindow;
                 this.sWindow.IsShowGLWindow = true;
                 this.sWindow.Show();
                 new Thread(closure_3 ?? (closure_3 = (ThreadStart)(() =>
                 {
                     if (!string.IsNullOrEmpty(RegistryManager.Instance.BtvDevServer))
                     {
                         BTVManager.sBTvUrl = RegistryManager.Instance.BtvDevServer;
                     }
                     string redirectedUrl = BTVManager.GetRedirectedUrl(BTVManager.sBTvUrl);
                     if (redirectedUrl == null)
                     {
                         Logger.Error("The download url was null");
                     }
                     else
                     {
                         string downloadPath = Path.Combine(Path.GetTempPath(), Path.GetFileName(new Uri(redirectedUrl).LocalPath));
                         this.sDownloader = new LegacyDownloader(3, redirectedUrl, downloadPath);
                         this.sDownloader.Download((LegacyDownloader.UpdateProgressCallback)(percent =>
                         {
                             // ISSUE: variable of a compiler-generated type
                             BTVManager.\u003C\u003Ec__DisplayClass25_0 cDisplayClass250 = this;
                             int percent1 = percent;
                             // ISSUE: reference to a compiler-generated field
                             this.sWindow.Dispatcher.Invoke((Delegate)(() => cDisplayClass250.\u003C\u003E4__this.sWindow.CustomProgressBar.Value = (double)percent1));
                         }), (LegacyDownloader.DownloadCompletedCallback)(filePath =>
                         {
                             this.sWindow.Dispatcher.Invoke((Delegate)(action1 ?? (action1 = (System.Action)(() =>
                             {
                                 this.sWindow.CustomProgressBar.Value = 100.0;
                                 this.sWindow.Close();
                             }))));
                             Logger.Info("Successfully downloaded BlueStacks TV");
                             this.sDownloading = false;
                             BTVManager.ExtractBTv(downloadPath);
                             parentWindow.Dispatcher.Invoke((Delegate)(action2 ?? (action2 = (System.Action)(() => parentWindow.mTopBar.mBtvButton.ImageName = "btv"))));
                         }), (LegacyDownloader.ExceptionCallback)(ex => Logger.Error("Failed to download file: {0}. err: {1}", (object)downloadPath, (object)ex.Message)), (LegacyDownloader.ContentTypeCallback)null, (LegacyDownloader.SizeDownloadedCallback)null, (LegacyDownloader.PayloadInfoCallback)null);
                     }
                 })))
                 {
                     IsBackground = true
                 }.Start();
             });
             btvExtPopup.Height = parentWindow.ActualHeight * 0.8;
             btvExtPopup.Width  = btvExtPopup.Height * 16.0 / 9.0;
             ContainerWindow containerWindow = new ContainerWindow(parentWindow, (System.Windows.Controls.UserControl)btvExtPopup, (double)(int)btvExtPopup.Width, (double)(int)btvExtPopup.Height, false, true, false, -1.0, (Brush)null);
         }
     }
     else
     {
         this.StartBlueStacksTV();
     }
 }