private void Button_Click_1(object sender, RoutedEventArgs e) { Message m = new Message(); m.Text = XText.Text; m.Topic = XTopic.Text; m.From = DataSaver.CurrentUser; try { m.To = GetAddresant(); } catch { MessageBox.Show("Невозможно отправить письмо без адресата"); } if (m.Text.Length == 0 && m.Topic.Length == 0) { MessageBox.Show("Невозможно отправить пустое письмо"); return; } DataBaseInterface.SendMessage(DataSaver.UId, DataSaver.PasswordHash, m); ((MainWindow)Application.Current.MainWindow).Navigate(new PMailForm()); }