Esempio n. 1
0
    public async void PatchStart(DownloadSingleCompleteDelegate callback)
    {
        bool isInstalledJava = await JAVAInstaller.isJavaInstalled();

        if (isInstalledJava == false)
        {
            await JAVAInstaller.DownloadJava();
        }

        downloadFileCount = patchDatas.Count;
        if (PatchCheck())
        {
            Debug.WriteLine(PatchCheck());
            downloadCompleteDelegate(downloadFileCount, downloadCompleteCount, downloadFailedCount);
            return;
        }
        else
        {
            foreach (var m in patchDatas)
            {
                await MakeDownloadURL(m);
            }
            System.Threading.Thread.Sleep(1000);
            foreach (var m in patchDatas)
            {
                DownloadFile(m, callback);
            }
        }
    }
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                var client   = new WebClient();
                var values   = new System.Collections.Specialized.NameValueCollection();
                var response = await client.UploadValuesTaskAsync(config.launcherStatusWebService, values);

                var responseString = Encoding.Default.GetString(response);
                if (responseString.Contains("disabled"))
                {
                    MessageBox.Show(SplashScreen.singleton.manager.GetString("launcherMaintenance"));
                    Application.Current.Shutdown();
                }
            }
            catch { }

            Windows.DebugOutputConsole console = new Windows.DebugOutputConsole();
            if (Window1.singleton.started == false)
            {
                Window1.singleton.started = true;


                string update = await AutoUpdater.CheckVersion();

                await AutoUpdater.Download(update);


                //SETTING UP JAVA
                if (await JAVAInstaller.isJavaInstalled() == false)
                {
                    await JAVAInstaller.DownloadJava();
                }
                transition.SelectedIndex = 1;
                await Task.Delay(350);

                Window1.singleton.MainPage.Navigate(new Pages.Login());
            }
        }