public MainWindow() { InitializeComponent(); KeyWindow keyWindow = new KeyWindow(); DictionaryManager dictionaryManager = new DictionaryManager(); MainPresenter presenter = new MainPresenter(this, keyWindow, dictionaryManager); changeLanguageButton.Click += changeLanguageButton_Click; translateButton.Click += translaleButton_Click; addToDictionaryButton.Click += addToDictionaryButton_Click; changeTextButton.Click += changeTextButton_Click; openDictionaryButton.Click += OpenDictionaryButton_Click; inputTextBox.Foreground = Brushes.Gray; outputTextBox.Foreground = Brushes.Gray; inputTextBox.Text = defaultSourceText; outputTextBox.Text = defaultTranslationText; inputTextBox.GotFocus += (object sender, RoutedEventArgs e) => { if (inputTextBox.Text == defaultSourceText) { inputTextBox.Foreground = Brushes.Black; inputTextBox.Text = string.Empty; } }; inputTextBox.LostFocus += (object sender, RoutedEventArgs e) => { if (string.IsNullOrWhiteSpace(inputTextBox.Text)) { inputTextBox.Foreground = Brushes.Gray; inputTextBox.Text = defaultSourceText; } }; outputTextBox.GotFocus += (object sender, RoutedEventArgs e) => { if (outputTextBox.Text == defaultTranslationText) { outputTextBox.Foreground = Brushes.Black; outputTextBox.Text = string.Empty; } }; outputTextBox.LostFocus += (object sender, RoutedEventArgs e) => { if (string.IsNullOrWhiteSpace(outputTextBox.Text)) { outputTextBox.Foreground = Brushes.Gray; outputTextBox.Text = defaultTranslationText; } }; this.Loaded += MainWindow_Loaded; this.Closing += MainWindow_Closing; this.Closed += MainWindow_Closed; }