Example #1
0
 private void Button_Click_5(object sender, RoutedEventArgs e)
 {
     try
     {
         for (int i = 0; i < gameList.Items.Count; i++)
         {
             if (File.Exists(_gameNames[i].IconName))
             {
                 continue;
             }
             var update =
                 new DownloadWindow(
                     "https://raw.githubusercontent.com/teknogods/TeknoParrotUIThumbnails/master/" +
                     _gameNames[i].IconName, _gameNames[i].IconName, false);
             update.ShowDialog();
         }
     }
     catch
     {
         // ignored
     }
 }
Example #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            LoadParrotData();
            //CreateConfigValue();

            foreach (var gameProfile in GameProfileLoader.GameProfiles)
            {
                ComboBoxItem item = new ComboBoxItem
                {
                    Content = gameProfile.GameName,
                    Tag     = gameProfile
                };

                GameListComboBox.Items.Add(item);

                if (_parrotData.SaveLastPlayed && gameProfile.GameName == _parrotData.LastPlayed)
                {
                    GameListComboBox.SelectedItem = item;
                }
            }

            new Thread(() =>
            {
                ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                Thread.CurrentThread.IsBackground    = true;
                try
                {
                    string contents;
                    using (var wc = new WebClient())
                        contents = wc.DownloadString("https://teknoparrot.com/api/version");
                    if (UpdateChecker.CheckForUpdate(GameVersion.CurrentVersion, contents))
                    {
                        if (MessageBox.Show(
                                $"There is a new version available: {contents} (currently using {GameVersion.CurrentVersion}). Would you like to download it?",
                                "New update!", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
                        {
                            Thread.CurrentThread.IsBackground = false;
                            //Process.Start("https://teknoparrot.com");

                            Application.Current.Dispatcher.Invoke((Action) delegate {
                                Views.DownloadWindow update = new Views.DownloadWindow();
                                update.ShowDialog();
                            });
                        }
                    }
                }
                catch (Exception)
                {
                    // Ignored
                }
            }).Start();

            if (_parrotData.UseDiscordRPC)
            {
                DiscordRPC.UpdatePresence(new DiscordRPC.RichPresence
                {
                    details       = "Main Menu",
                    largeImageKey = "teknoparrot",
                });
            }

            Title = "TeknoParrot UI " + GameVersion.CurrentVersion;
        }