private void UpdatePlayButton()
        {
            Task.Run(async() =>
            {
                await Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, new Action(() =>
                {
                    var selected = InstallationsList.SelectedItem as Installation;
                    if (selected == null)
                    {
                        PlayButtonText.SetResourceReference(TextBlock.TextProperty, "MainPage_PlayButton");
                        MainPlayButton.IsEnabled = false;
                        return;
                    }

                    if (ConfigManager.GameManager.IsDownloading || ConfigManager.GameManager.HasLaunchTask)
                    {
                        if (ConfigManager.GameManager.IsDownloading)
                        {
                            ProgressBarShowAnim();
                        }

                        MainPlayButton.IsEnabled    = false;
                        InstallationsList.IsEnabled = false;
                    }
                    else
                    {
                        ProgressBarGrid.Visibility  = Visibility.Collapsed;
                        MainPlayButton.IsEnabled    = true;
                        InstallationsList.IsEnabled = true;
                    }


                    if (selected.Version?.IsInstalled ?? false)
                    {
                        PlayButtonText.SetResourceReference(TextBlock.TextProperty, "MainPage_PlayButton");
                    }
                    else
                    {
                        PlayButtonText.SetResourceReference(TextBlock.TextProperty, "MainPage_PlayButton");
                    }
                }));
            });
        }
Exemplo n.º 2
0
        private void UpdatePlayButton()
        {
            Task.Run(async() =>
            {
                await Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, new Action(() =>
                {
                    var selected = InstallationsList.SelectedItem as MCInstallation;
                    if (selected == null)
                    {
                        PlayButtonText.SetResourceReference(TextBlock.TextProperty, "GameTab_PlayButton_Text");
                        MainPlayButton.IsEnabled = false;
                        return;
                    }

                    bool showProgress = ConfigManager.GameManager.IsUninstalling || ConfigManager.GameManager.IsDownloading || ConfigManager.GameManager.HasLaunchTask || ConfigManager.GameManager.IsBackingUp;

                    if (showProgress)
                    {
                        ProgressBarShowAnim();
                    }
                    else
                    {
                        ProgressBarHideAnim();
                    }

                    if (!ConfigManager.GameManager.IsGameNotOpen)
                    {
                        PlayButtonText.SetResourceReference(TextBlock.TextProperty, "GameTab_PlayButton_Kill_Text");
                    }
                    else
                    {
                        PlayButtonText.SetResourceReference(TextBlock.TextProperty, "GameTab_PlayButton_Text");
                    }
                }));
            });
        }