Помогите исправить ошибку в тексте программы на C#. Работаю с проектом WPF
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Championship
{
///
/// Interaction logic for Create1.xaml
///
public partial class Create1 : Page
{
public object Create1(bool P_G)
{
InitializeComponent();
StackPanel textInputStackPanel = new StackPanel();
Button textInputeButton = new Button();
TextBox textInputTextBox = new TextBox();
textInputeButton.Content = "Open";
// Attach elements to StackPanel.
textInputStackPanel.Children.Add(textInputeButton);
textInputStackPanel.Children.Add(textInputTextBox);
// Attach event handlers.
textInputStackPanel.KeyDown += new KeyEventHandler(OnTextInputKeyDown);
textInputeButton.Click += new RoutedEventHandler(OnTextInputButtonClick);
P_G = false;
return P_G;
}
private void OnTextInputKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.O && Keyboard.Modifiers == ModifierKeys.Control)
{
handle();
e.Handled = true;
}
}
private void OnTextInputButtonClick(object sender, RoutedEventArgs e)
{
handle();
e.Handled = true;
}
public object handle()
{
int b;
if (!P_G) !!!Строка ошибки
{
//ввод количества голов
b = Convert.ToInt32(Tex.Text);
Tex.Text = null;
string bs = b.ToString();
MessageBox.Show("Успешно Забито " + bs + " голов. ");
}
else
{
MessageBox.Show("Вы уже ввели количество голов. Если вы допустили ощибку, хотите исправить? ");
}
}
}
}
Error1The name 'P_G' does not exist in the current context
Строка ошибки: if (!P_G) !!!Строка ошибки