Beispiel #1
0
        private async void GenerateWikiCodeButton_Click(object sender, RoutedEventArgs e)
        {
            Settings.LogButtonClicked(sender as Button);
            SimpleLog.Info(String.Format("Generate Wikicode, LeagueSize={0}, Table={1}, Qual1Count={2}, Qual2Count={3}, Results={4}, Template={5}",
                                         League.TeamCount, TableCheckBox.IsChecked, Qual1PlacesComboBox.SelectedIndex, Qual2PlacesComboBox.SelectedIndex,
                                         ResultsCheckBox.IsChecked, (WikiTemplateComboBox.SelectedItem as LeagueWikiTemplate).Name));
            WikiCodeTextBox.Text = String.Empty;

            if (TableCheckBox.IsChecked == true)
            {
                try
                {
                    await League.CalculateTableAsync();

                    WikiCodeTextBox.Text += await WikiHelper.GenerateTableCodeAsync(League, Qual1PlacesComboBox.SelectedIndex, Qual2PlacesComboBox.SelectedIndex);
                }
                catch (Exception ex)
                {
                    SimpleLog.Log(ex);
                }
            }

            if (ResultsCheckBox.IsChecked == true && WikiTemplateComboBox.SelectedIndex >= 0)
            {
                try
                {
                    WikiCodeTextBox.Text += await WikiHelper.GenerateResultsCodeAsync(League, WikiTemplateComboBox.SelectedItem as LeagueWikiTemplate);
                }
                catch (Exception ex)
                {
                    SimpleLog.Log(ex);
                }
            }
        }